Move to webpack-vue-config

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2021-04-05 12:47:25 +02:00
parent 7f771fdfef
commit f08abfca9b
No known key found for this signature in database
GPG Key ID: 036FA7EB1A599178
10 changed files with 1335 additions and 102 deletions

View File

@ -5,7 +5,7 @@ module.exports = {
OC: false,
OCA: false,
moment: true,
$appVersion: true,
appVersion: true,
},
extends: [
'@nextcloud',

1319
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,9 +10,9 @@
"private": true,
"homepage": "https://github.com/nextcloud/tasks",
"scripts": {
"build": "NODE_ENV=production webpack --progress --config webpack.prod.js",
"dev": "NODE_ENV=development webpack --config webpack.dev.js",
"watch": "NODE_ENV=development webpack --progress --watch --config webpack.dev.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 tests",
"lint:fix": "eslint --ext .js,.vue src tests --fix",
"stylelint": "stylelint 'css/src/**/*.scss'",
@ -68,6 +68,7 @@
"@nextcloud/browserslist-config": "^2.1.0",
"@nextcloud/eslint-config": "^5.0.0",
"@nextcloud/eslint-plugin": "^2.0.0",
"@nextcloud/webpack-vue-config": "^4.0.1",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.2",
@ -81,21 +82,26 @@
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.8.0",
"eslint-webpack-plugin": "^2.5.3",
"file-loader": "^6.2.0",
"jest": "^26.6.3",
"jest-environment-jsdom-sixteen": "^1.0.3",
"jest-serializer-vue": "^2.0.2",
"mockdate": "^3.0.5",
"node-polyfill-webpack-plugin": "^1.1.0",
"node-sass": "^5.0.0",
"prettier-eslint": "^12.0.0",
"raw-loader": "^4.0.2",
"sass": "^1.32.8",
"sass-loader": "^11.0.1",
"style-loader": "^2.0.0",
"stylelint": "^13.12.0",
"stylelint-config-recommended-scss": "^4.2.0",
"stylelint-scss": "^3.19.0",
"stylelint-webpack-plugin": "^2.1.1",
"svg-sprite": "^1.5.0",
"terser-webpack-plugin": "^5.1.1",
"url-loader": "^4.1.1",
"vue-jest": "^3.0.7",
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.6.12",

View File

@ -69,7 +69,7 @@ Vue.prototype.t = Vue.prototype.$t
Vue.prototype.n = Vue.prototype.$n
Vue.prototype.$OC = OC
Vue.prototype.$OCA = OCA
Vue.prototype.$appVersion = $appVersion
Vue.prototype.$appVersion = appVersion
OCA.Tasks.$t = Vue.prototype.$t
OCA.Tasks.$n = Vue.prototype.$n

View File

@ -641,8 +641,7 @@ const actions = {
if (taskData.calendar.readOnly) {
return
}
const task = new Task('BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Nextcloud Tasks v' + $appVersion + '\nEND:VCALENDAR', taskData.calendar)
const task = new Task('BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Nextcloud Tasks v' + this._vm.$appVersion + '\nEND:VCALENDAR', taskData.calendar)
task.created = ICAL.Time.now()
task.summary = taskData.summary

View File

@ -1,4 +1,4 @@
<?php
script('tasks', 'tasks');
script('tasks', 'tasks-main');
style('tasks', 'tasks');

View File

@ -1,65 +0,0 @@
const path = require('path')
const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader')
const StyleLintPlugin = require('stylelint-webpack-plugin')
module.exports = {
entry: path.join(__dirname, 'src', 'main.js'),
output: {
path: path.resolve(__dirname, './js'),
publicPath: '/js/',
filename: 'tasks.js'
},
module: {
rules: [
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /src\/.*\.(js|vue)$/,
use: 'eslint-loader',
enforce: 'pre'
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-object-rest-spread'
],
presets: ['@babel/preset-env']
}
},
exclude: /node_modules\/(?!(p-limit|p-defer|p-queue|p-try|cdav-library))/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
plugins: [
new VueLoaderPlugin(),
new StyleLintPlugin(),
new webpack.DefinePlugin({
$appVersion: JSON.stringify(require('./package.json').version)
})
],
resolve: {
extensions: ['*', '.js', '.vue', '.json']
}
}

View File

@ -1,12 +0,0 @@
const { merge } = require('webpack-merge')
const common = require('./webpack.common.js')
module.exports = merge(common, {
mode: 'development',
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
devtool: 'cheap-source-map',
});

3
webpack.js Normal file
View File

@ -0,0 +1,3 @@
const webpackConfig = require('@nextcloud/webpack-vue-config')
module.exports = webpackConfig

View File

@ -1,17 +0,0 @@
const { merge } = require('webpack-merge')
const common = require('./webpack.common.js')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
optimization: {
minimizer: [new TerserPlugin({
terserOptions: {
output: {
comments: false,
}
},
})],
}
});