Bump deps and use npm7

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2021-06-14 08:55:36 +02:00
parent 0a6791dc89
commit e7a034d43d
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
16 changed files with 17475 additions and 3697 deletions

View File

@ -1,11 +1,3 @@
module.exports = {
plugins: ['@babel/plugin-syntax-dynamic-import'],
presets: [
[
'@babel/preset-env',
{
modules: false
}
]
]
}
const babelConfig = require('@nextcloud/babel-config')
module.exports = babelConfig

Binary file not shown.

Binary file not shown.

Binary file not shown.

20685
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@
"license": "agpl",
"private": true,
"scripts": {
"build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.js",
"build": "NODE_ENV=production webpack --progress --config webpack.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.js",
"lint": "eslint --ext .js,.vue src",
@ -58,47 +58,22 @@
"extends @nextcloud/browserslist-config"
],
"engines": {
"node": ">=10.0.0"
"node": ">=14.0.0"
},
"devDependencies": {
"@babel/core": "^7.14.5",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.14.5",
"@nextcloud/babel-config": "^1.0.0-beta.1",
"@nextcloud/browserslist-config": "^2.1.0",
"@nextcloud/eslint-config": "^3.0.0",
"@nextcloud/eslint-plugin": "^2.0.0",
"@nextcloud/webpack-vue-config": "^2.0.0",
"@nextcloud/eslint-config": "^5.1.0",
"@nextcloud/stylelint-config": "^1.0.0-beta.0",
"@nextcloud/webpack-vue-config": "^4.0.3",
"@vue/test-utils": "^1.2.0",
"autoprefixer": "^9.8.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"babel-loader-exclude-node-modules-except": "^1.2.1",
"css-loader": "^4.3.0",
"eslint": "^7.28.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^7.11.0",
"eslint-webpack-plugin": "^2.5.4",
"module-replace-webpack-plugin": "0.0.12",
"node-sass": "^5.0.0",
"node-sass": "^6.0.0",
"node-sass-utils": "^1.1.3",
"postcss-loader": "^4.2.0",
"postcss-loader": "^6.1.0",
"raw-loader": "^4.0.2",
"sass-loader": "^10.1.1",
"style-loader": "^2.0.0",
"stylelint": "^13.13.1",
"stylelint-config-recommended-scss": "^4.2.0",
"stylelint-scss": "^3.19.0",
"stylelint-webpack-plugin": "^2.1.1",
"url-loader": "^4.1.1",
"vue-loader": "^15.9.7",
"vue-template-compiler": "^2.6.12",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-merge": "^5.8.0",
"workbox-webpack-plugin": "^6.1.1"
}
}

View File

@ -1,5 +1,5 @@
module.exports = {
plugins: [
require('autoprefixer')
]
require('autoprefixer'),
],
}

View File

@ -143,6 +143,8 @@ export default {
</script>
<style lang="scss" scoped>
@import '../mixins/GridSizes.scss';
.icon-confirm {
transform: rotate(180deg)
}
@ -168,38 +170,20 @@ export default {
flex-grow: 0;
flex-shrink: 0;
}
}
// generate variants based on grid sizes
// TODO: use mixins/GridSizes as soon as node-sass supports it
// needs node-sass 5.0 (with libsass 3.6)
// https://github.com/sass/node-sass/pull/2312
$previous: 0;
@each $size, $config in get('sizes') {
$marginTop: map-get($config, 'marginTop');
$marginW: map-get($config, 'marginW');
// Specific grid spacing
@include grid-sizes using ($marginTop, $marginW) {
// we space this with 2/3 margin top, 1/3 margin bottom
margin-top: ($marginTop - 44px) * 2 / 3;
// if this is the last entry, only use min-width
$rule: '(min-width: #{$previous}px) and (max-width: #{$size}px)';
@if $size == 'max' {
$rule: '(min-width: #{$previous}px)';
}
@media #{$rule} {
.photos-navigation {
// we space this with 2/3 margin top, 1/3 margin bottom
top: ($marginTop - 44px) * 2 / 3;
// padding-left: $marginW;
@if $marginW >= 44px {
&__back {
margin: 0 (($marginW - 44px) / 2);
}
}
&--root &__title {
padding-left: #{$marginW - 44}px;
@if $marginW >= 44px {
&__back {
margin: 0 (($marginW - 44px) / 2);
}
}
&--root &__title {
padding-left: #{$marginW - 44}px;
}
}
$previous: $size;
}
</style>

View File

@ -19,23 +19,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
@use 'sass:map';
// needs node-sass 5.0 (with libsass 3.6)
// https://github.com/sass/node-sass/pull/2312
@mixin grid-sizes() {
$previous: 0;
@each $size, $config in get('sizes') {
@each $size, $config in $sizes {
$count: map-get($config, 'count');
$marginTop: map-get($config, 'marginTop');
$marginW: map-get($config, 'marginW');
@if $size == 'max' {
@media (min-width: #{$previous}px) {
@content;
@content($marginTop, $marginW);
}
} @else {
@media (min-width: #{$previous}px) and (max-width: #{$size}px) {
@content;
@content($marginTop, $marginW);
}
}
$previous: $size;

View File

@ -1,84 +0,0 @@
/**
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
const sass = require('node-sass')
const sassUtils = require('node-sass-utils')(sass)
// sass plugin to implement js configs into scss
const sassVars = require('../assets/grid-sizes')
// Allows us to use js variables in sass so we can havea global config
// https://github.com/planetflash/sharing_variables_js_sass/
const convertStringToSassDimension = function(result) {
// Only attempt to convert strings
if (typeof result !== 'string') {
return result
}
const cssUnits = [
'rem',
'em',
'vh',
'vw',
'vmin',
'vmax',
'ex',
'%',
'px',
'cm',
'mm',
'in',
'pt',
'pc',
'ch',
]
const parts = result.match(/[a-zA-Z]+|[0-9]+/g)
const value = parts[0]
const unit = parts[parts.length - 1]
if (cssUnits.indexOf(unit) !== -1) {
result = new sassUtils.SassDimension(parseInt(value, 10), unit)
}
return result
}
module.exports = function(keys) {
keys = keys.getValue().split('.')
let result = sassVars
for (let i = 0; i < keys.length; i++) {
result = result[keys[i]]
// Convert to SassDimension if dimenssion
if (typeof result === 'string') {
result = convertStringToSassDimension(result)
} else if (typeof result === 'object') {
Object.keys(result).forEach(function(key) {
const value = result[key]
result[key] = convertStringToSassDimension(value)
})
}
}
result = sassUtils.castToSass(result)
return result
}

View File

@ -0,0 +1,46 @@
/**
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// sass plugin to implement js configs into scss
// eslint-disable-next-line node/no-extraneous-require
const sass = require('sass')
const { sizes } = require('../assets/grid-sizes')
const gridConfigKeys = Object.keys(sizes)
const gridConfigMap = new sass.types.Map(gridConfigKeys.length)
gridConfigKeys.forEach((size, index) => {
const config = sizes[size]
const configMap = new sass.types.Map(3)
configMap.setKey(0, new sass.types.String('count'))
configMap.setValue(0, new sass.types.Number(config.count))
configMap.setKey(1, new sass.types.String('marginTop'))
configMap.setValue(1, new sass.types.Number(config.marginTop))
configMap.setKey(2, new sass.types.String('marginW'))
configMap.setValue(2, new sass.types.Number(config.marginW))
gridConfigMap.setKey(index, new sass.types.String(size))
gridConfigMap.setValue(index, configMap)
})
module.exports = `$sizes: ${gridConfigMap};`

View File

@ -251,20 +251,11 @@ export default {
</script>
<style lang="scss" scoped>
$previous: 0;
@each $size, $config in get('sizes') {
$marginTop: map-get($config, 'marginTop');
$marginW: map-get($config, 'marginW');
// if this is the last entry, only use min-width
$rule: '(min-width: #{$previous}px) and (max-width: #{$size}px)';
@if $size == 'max' {
$rule: '(min-width: #{$previous}px)';
@import '../mixins/GridSizes.scss';
.grid-container {
@include grid-sizes using ($marginTop, $marginW) {
padding: 0px #{$marginW}px 256px #{$marginW}px;
}
@media #{$rule} {
.grid-container {
padding: #{$marginTop}px #{$marginW}px 256px #{$marginW}px;
}
}
$previous: $size;
}
</style>

View File

@ -279,20 +279,11 @@ export default {
</script>
<style lang="scss" scoped>
$previous: 0;
@each $size, $config in get('sizes') {
$marginTop: map-get($config, 'marginTop');
$marginW: map-get($config, 'marginW');
// if this is the last entry, only use min-width
$rule: '(min-width: #{$previous}px) and (max-width: #{$size}px)';
@if $size == 'max' {
$rule: '(min-width: #{$previous}px)';
@import '../mixins/GridSizes.scss';
.grid-container {
@include grid-sizes using ($marginTop, $marginW) {
padding: 0px #{$marginW}px 256px #{$marginW}px;
}
@media #{$rule} {
.grid-container {
padding: #{$marginTop}px #{$marginW}px 256px #{$marginW}px;
}
}
$previous: $size;
}
</style>

View File

@ -295,20 +295,11 @@ export default {
</script>
<style lang="scss" scoped>
$previous: 0;
@each $size, $config in get('sizes') {
$marginTop: map-get($config, 'marginTop');
$marginW: map-get($config, 'marginW');
// if this is the last entry, only use min-width
$rule: '(min-width: #{$previous}px) and (max-width: #{$size}px)';
@if $size == 'max' {
$rule: '(min-width: #{$previous}px)';
@import '../mixins/GridSizes.scss';
.grid-container {
@include grid-sizes using ($marginTop, $marginW) {
padding: 0px #{$marginW}px 256px #{$marginW}px;
}
@media #{$rule} {
.grid-container {
padding: 0px #{$marginW}px 256px #{$marginW}px;
}
}
$previous: $size;
}
</style>

View File

@ -1,32 +1,3 @@
module.exports = {
extends: 'stylelint-config-recommended-scss',
rules: {
indentation: 'tab',
'selector-type-no-unknown': null,
'number-leading-zero': null,
'rule-empty-line-before': [
'always',
{
ignore: ['after-comment', 'inside-block'],
},
],
'declaration-empty-line-before': [
'never',
{
ignore: ['after-declaration'],
},
],
'comment-empty-line-before': null,
'selector-type-case': null,
'selector-list-comma-newline-after': null,
'no-descending-specificity': null,
'string-quotes': 'single',
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['v-deep'],
},
],
},
plugins: ['stylelint-scss'],
}
const babelConfig = require('@nextcloud/stylelint-config')
module.exports = babelConfig

View File

@ -1,103 +1,79 @@
const { merge } = require('webpack-merge')
const path = require('path')
const webpack = require('webpack')
const webpackConfig = require('@nextcloud/webpack-vue-config')
const webpackRules = require('@nextcloud/webpack-vue-config/rules')
const SassGetGridConfig = require('./src/utils/SassGetGridConfig')
const ModuleReplaceWebpackPlugin = require('module-replace-webpack-plugin')
const SassGridConfig = require('./src/utils/SassGridConfig')
const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except')
const WorkboxPlugin = require('workbox-webpack-plugin')
const config = {
module: {
rules: [
{
test: /\.svg$/,
// illustrations
loader: 'raw-loader',
},
{
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
'postcss-loader',
{
loader: 'sass-loader',
options: {
sassOptions: {
functions: {
'get($keys)': SassGetGridConfig,
},
},
},
},
],
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: BabelLoaderExcludeNodeModulesExcept([
'@essentials/request-timeout',
'@nextcloud/event-bus',
'camelcase',
'hot-patcher',
'semver',
'vue-virtual-grid',
'webdav',
]),
},
],
webpackRules.RULE_JS.exclude = BabelLoaderExcludeNodeModulesExcept([
'@essentials/request-timeout',
'@nextcloud/event-bus',
'camelcase',
'hot-patcher',
'semver',
'vue-virtual-grid',
'webdav',
])
webpackRules.RULE_SCSS.use = [
'style-loader',
'css-loader',
'postcss-loader',
{
loader: 'sass-loader',
options: {
additionalData: SassGridConfig,
},
},
plugins: [
// patch webdav/dist/request.js
new ModuleReplaceWebpackPlugin({
modules: [{
test: /request.js/,
replace: './src/patchedRequest.js',
exclude: [/patchedRequest.js$/],
}],
}),
new WorkboxPlugin.GenerateSW({
swDest: 'photos-service-worker.js',
clientsClaim: true,
skipWaiting: true,
exclude: [new RegExp('.*')], // don't do precaching
inlineWorkboxRuntime: true,
sourcemap: false,
]
// Define runtime caching rules.
runtimeCaching: [{
// Match any preview file request
urlPattern: /^.*\/core\/preview\?fileId=.*/,
webpackConfig.module.rules = Object.values(webpackRules)
webpackConfig.module.rules.push({
test: /\.svg$/,
// illustrations
loader: 'raw-loader',
})
// Apply a strategy.
handler: 'CacheFirst',
webpackConfig.plugins.push(
// patch webdav/dist/request.js
new webpack.NormalModuleReplacementPlugin(
/request.js/,
function(resource) {
if (resource.context.indexOf('webdav/dist') > -1) {
resource.request = path.join(__dirname, 'src/patchedRequest.js')
}
},
),
new WorkboxPlugin.GenerateSW({
swDest: 'photos-service-worker.js',
clientsClaim: true,
skipWaiting: true,
exclude: [new RegExp('.*')], // don't do precaching
inlineWorkboxRuntime: true,
sourcemap: false,
options: {
// Use a custom cache name.
cacheName: 'images',
// Define runtime caching rules.
runtimeCaching: [{
// Match any preview file request
urlPattern: /^.*\/core\/preview\?fileId=.*/,
// Only cache 10000 images.
expiration: {
maxAgeSeconds: 3600 * 24 * 7, // one week
maxEntries: 10000,
},
// Apply a strategy.
handler: 'CacheFirst',
options: {
// Use a custom cache name.
cacheName: 'images',
// Only cache 10000 images.
expiration: {
maxAgeSeconds: 3600 * 24 * 7, // one week
maxEntries: 10000,
},
}],
}),
],
}
},
}],
})
)
// Remove svg from default url-loader
const svgRule = webpackConfig.module.rules.find(rule => rule.test && rule.test.toString().indexOf('|svg') !== -1)
svgRule.test = new RegExp(svgRule.test.toString().replace('|svg', ''))
// Merge configs
const mergedConfigs = merge(config, webpackConfig)
// Remove duplicate rules by the `test` key
mergedConfigs.module.rules = mergedConfigs.module.rules
.filter((v, i, a) => a.findIndex(t => (t.test.toString() === v.test.toString())) === i)
// Merge rules by replacing existing tests
module.exports = mergedConfigs
module.exports = webpackConfig