Browse Source

Bump updatenotification

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
John Molakvoæ (skjnldsv) 6 years ago
parent
commit
fd147cc3fd

+ 9 - 2
.drone.yml

@@ -14,10 +14,17 @@ pipeline:
     when:
       matrix:
         TESTS: jsunit
-  vue-builds:
+  vue-build-settings:
     image: node
     commands:
-     - ./build/vue-builds.sh
+     - ./build/vue-builds.sh ./settings/js/main.js
+    when:
+      matrix:
+        TESTS: vue-builds
+  vue-build-updatenotification:
+    image: node
+    commands:
+     - ./build/vue-builds.sh ./apps/updatenotification/js/merged.js
     when:
       matrix:
         TESTS: vue-builds

+ 2 - 2
.gitignore

@@ -32,8 +32,8 @@
 !/apps/admin_audit
 !/apps/updatenotification
 /apps/updatenotification/build
-/apps/updatenotification/js/merged.js
-/apps/updatenotification/js/merged.js.map
+#/apps/updatenotification/js/merged.js
+#/apps/updatenotification/js/merged.js.map
 /apps/updatenotification/js/*.hot-update.*
 /apps/updatenotification/node_modules
 !/apps/theming

+ 13 - 4
apps/updatenotification/Makefile

@@ -3,14 +3,15 @@ app_name=updatenotification
 project_dir=$(CURDIR)/../$(app_name)
 build_dir=$(CURDIR)/build
 source_dir=$(build_dir)/$(app_name)
-sign_dir=$(build_dir)/sign
 
-all: package
+all: dev-setup build-js-production package
 
-dev-setup: clean npm-update build-js
+dev-setup: clean clean-dev npm-init
+
+npm-init:
+	npm install
 
 npm-update:
-	rm -rf node_modules
 	npm update
 
 build-js:
@@ -19,9 +20,17 @@ build-js:
 build-js-production:
 	npm run build
 
+watch-js:
+	npm run watch
+
 clean:
+	rm -f js/merged.js
+	rm -f js/merged.js.map
 	rm -rf $(build_dir)
 
+clean-dev:
+	rm -rf node_modules
+
 package: clean build-js-production
 	mkdir -p $(source_dir)
 	rsync -a \

+ 0 - 54
apps/updatenotification/js-src/app.js

@@ -1,54 +0,0 @@
-/**
- * @copyright (c) 2018 Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- */
-
-/* global $, define */
-
-define(function (require) {
-	"use strict";
-
-	return {
-
-		/** @type {Vue|null} */
-		vm: null,
-
-		/**
-		 * Initialise the app
-		 */
-		initialise: function() {
-			var data = JSON.parse($('#updatenotification').attr('data-json'));
-			var Vue = require('vue');
-			var vSelect = require('vue-select');
-			Vue.component('v-select', vSelect.VueSelect);
-			Vue.mixin({
-				methods: {
-					t: function(app, text, vars, count, options) {
-						return OC.L10N.translate(app, text, vars, count, options);
-					},
-					n: function(app, textSingular, textPlural, count, vars, options) {
-						return OC.L10N.translatePlural(app, textSingular, textPlural, count, vars, options);
-					}
-				}
-			});
-			this.vm = new Vue(require('./components/root.vue'));
-
-			this.vm.newVersionString = data.newVersionString;
-			this.vm.lastCheckedDate = data.lastChecked;
-			this.vm.isUpdateChecked = data.isUpdateChecked;
-			this.vm.updaterEnabled = data.updaterEnabled;
-			this.vm.downloadLink = data.downloadLink;
-			this.vm.isNewVersionAvailable = data.isNewVersionAvailable;
-			this.vm.updateServerURL = data.updateServerURL;
-			this.vm.currentChannel = data.currentChannel;
-			this.vm.channels = data.channels;
-			this.vm.notifyGroups = data.notifyGroups;
-			this.vm.isDefaultUpdateServerURL = data.isDefaultUpdateServerURL;
-			this.vm.versionIsEol = data.versionIsEol;
-		}
-	};
-});

+ 6 - 4
apps/updatenotification/js-src/components/root.vue

@@ -79,11 +79,13 @@
 </template>
 
 <script>
-	export default {
-		name: "root",
-
-		el: '#updatenotification',
+	import vSelect from 'vue-select';
 
+	export default {
+		name: 'root',
+		components: {
+			vSelect,
+		},
 		data: function () {
 			return {
 				newVersionString: '',

+ 30 - 7
apps/updatenotification/js-src/init.js

@@ -19,13 +19,36 @@
  */
 
 /* global define, $ */
+import Vue from 'vue';
+import Root from './components/root'
 
-define(function(require) {
-	'use strict';
+var data = JSON.parse($('#updatenotification').attr('data-json'));
+Vue.mixin({
+	methods: {
+		t: function(app, text, vars, count, options) {
+			return OC.L10N.translate(app, text, vars, count, options);
+		},
+		n: function(app, textSingular, textPlural, count, vars, options) {
+			return OC.L10N.translatePlural(app, textSingular, textPlural, count, vars, options);
+		}
+	}
+});
 
-	var App = require('./app');
+const vm = new Vue({
+	render: h => h(Root)
+}).$mount('#updatenotification');
+
+
+vm.newVersionString = data.newVersionString;
+vm.lastCheckedDate = data.lastChecked;
+vm.isUpdateChecked = data.isUpdateChecked;
+vm.updaterEnabled = data.updaterEnabled;
+vm.downloadLink = data.downloadLink;
+vm.isNewVersionAvailable = data.isNewVersionAvailable;
+vm.updateServerURL = data.updateServerURL;
+vm.currentChannel = data.currentChannel;
+vm.channels = data.channels;
+vm.notifyGroups = data.notifyGroups;
+vm.isDefaultUpdateServerURL = data.isDefaultUpdateServerURL;
+vm.versionIsEol = data.versionIsEol;
 
-	$(function() {
-		App.initialise();
-	});
-});

+ 28 - 0
apps/updatenotification/js-src/webpack.common.js

@@ -0,0 +1,28 @@
+const path = require('path')
+const { VueLoaderPlugin } = require('vue-loader');
+
+module.exports = {
+	entry: './js-src/init.js',
+  output: {
+		path: path.resolve(__dirname, '../js'),
+		publicPath: '/',
+		filename: 'merged.js'
+  },
+  module: {
+    rules: [
+      {
+        test: /\.vue$/,
+        loader: 'vue-loader',
+      }
+    ]
+  },
+  plugins: [
+    new VueLoaderPlugin()
+  ],
+  resolve: {
+    alias: {
+      'vue$': 'vue/dist/vue.esm.js'
+    },
+    extensions: ['*', '.js', '.vue', '.json']
+  }
+}

+ 0 - 56
apps/updatenotification/js-src/webpack.config.js

@@ -1,56 +0,0 @@
-var path = require('path');
-var webpack = require('webpack');
-
-module.exports = {
-	entry: './js-src/init.js',
-	output: {
-		path: path.resolve(__dirname, '../js'),
-		publicPath: '/',
-		filename: 'merged.js'
-	},
-	module: {
-		rules: [
-			{
-				test: /\.vue$/,
-				loader: 'vue-loader',
-				options: {
-					loaders: {
-					},
-					esModule: false
-					// other vue-loader options go here
-				}
-			}
-		]
-	},
-	resolve: {
-		alias: {
-			'vue-select': 'vue-select/dist/vue-select.js',
-			'vue': process.env.NODE_ENV === 'production' ? 'vue/dist/vue.min.js' : 'vue/dist/vue.js'
-		}
-	},
-	performance: {
-		hints: false
-	},
-	devtool: '#eval-source-map'
-};
-
-if (process.env.NODE_ENV === 'production') {
-	module.exports.devtool = '#source-map';
-	// http://vue-loader.vuejs.org/en/workflow/production.html
-	module.exports.plugins = (module.exports.plugins || []).concat([
-		new webpack.DefinePlugin({
-			'process.env': {
-				NODE_ENV: '"production"'
-			}
-		}),
-		new webpack.optimize.UglifyJsPlugin({
-			sourceMap: true,
-			compress: {
-				warnings: false
-			}
-		}),
-		new webpack.LoaderOptionsPlugin({
-			minimize: true
-		})
-	]);
-}

+ 12 - 0
apps/updatenotification/js-src/webpack.dev.js

@@ -0,0 +1,12 @@
+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: '#eval-source-map',
+})

+ 7 - 0
apps/updatenotification/js-src/webpack.prod.js

@@ -0,0 +1,7 @@
+const merge = require('webpack-merge')
+const common = require('./webpack.common.js')
+
+module.exports = merge(common, {
+  mode: 'production',
+  devtool: '#source-map'
+})

File diff suppressed because it is too large
+ 0 - 0
apps/updatenotification/js/merged.js


File diff suppressed because it is too large
+ 0 - 0
apps/updatenotification/js/merged.js.map


File diff suppressed because it is too large
+ 601 - 189
apps/updatenotification/package-lock.json


+ 9 - 7
apps/updatenotification/package.json

@@ -1,6 +1,6 @@
 {
   "name": "notifications",
-  "version": "2.2.0",
+  "version": "2.3.0",
   "description": "This app provides a backend and frontend for the notification API available in Nextcloud.",
   "main": "init.js",
   "directories": {
@@ -8,8 +8,9 @@
     "test": "tests"
   },
   "scripts": {
-    "dev": "cross-env NODE_ENV=development webpack --progress --hot --config js-src/webpack.config.js --watch",
-    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules --config js-src/webpack.config.js",
+    "dev": "webpack --config js-src/webpack.dev.js",
+    "watch": "webpack --progress --watch --config js-src/webpack.dev.js",
+    "build": "webpack --progress --hide-modules --config js-src/webpack.prod.js",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "repository": {
@@ -27,11 +28,12 @@
     "vue-select": "^2.4.0"
   },
   "devDependencies": {
-    "cross-env": "^5.1.6",
     "css-loader": "^0.28.11",
-    "file-loader": "^1.1.6",
-    "vue-loader": "^13.7.0",
+    "file-loader": "^1.1.11",
+    "vue-loader": "^15.2.4",
     "vue-template-compiler": "^2.5.16",
-    "webpack": "^3.6.0"
+    "webpack": "^4.11.1",
+    "webpack-cli": "^3.0.3",
+    "webpack-merge": "^4.1.2"
   }
 }

+ 7 - 4
build/vue-builds.sh

@@ -2,10 +2,13 @@
 
 declare -a apps=("./settings/js/main.js" "./apps/updatenotification/js/merged.js")
 root=$(pwd)
+entryFile=$1
 
-for i in "${apps[@]}"
-do
-	entryFile=$i
+if [ ! -f "$entryFile" ]
+then
+	echo "The build file $entryFile does not exists"
+	exit 2
+else
 	backupFile="$entryFile.orig"
 	path=$(dirname "$entryFile")
 
@@ -31,4 +34,4 @@ do
 	else
 		echo "$entryFile build is up-to-date"
 	fi
-done
+fi

File diff suppressed because it is too large
+ 0 - 93
settings/js/main.js


File diff suppressed because it is too large
+ 0 - 0
settings/js/main.js.map


+ 30 - 11
settings/package-lock.json

@@ -2595,7 +2595,8 @@
         "ansi-regex": {
           "version": "2.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "aproba": {
           "version": "1.2.0",
@@ -2616,12 +2617,14 @@
         "balanced-match": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "brace-expansion": {
           "version": "1.1.11",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "balanced-match": "^1.0.0",
             "concat-map": "0.0.1"
@@ -2636,17 +2639,20 @@
         "code-point-at": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "concat-map": {
           "version": "0.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "console-control-strings": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "core-util-is": {
           "version": "1.0.2",
@@ -2763,7 +2769,8 @@
         "inherits": {
           "version": "2.0.3",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "ini": {
           "version": "1.3.5",
@@ -2775,6 +2782,7 @@
           "version": "1.0.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "number-is-nan": "^1.0.0"
           }
@@ -2789,6 +2797,7 @@
           "version": "3.0.4",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "brace-expansion": "^1.1.7"
           }
@@ -2796,12 +2805,14 @@
         "minimist": {
           "version": "0.0.8",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "minipass": {
           "version": "2.2.4",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "safe-buffer": "^5.1.1",
             "yallist": "^3.0.0"
@@ -2820,6 +2831,7 @@
           "version": "0.5.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "minimist": "0.0.8"
           }
@@ -2900,7 +2912,8 @@
         "number-is-nan": {
           "version": "1.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "object-assign": {
           "version": "4.1.1",
@@ -2912,6 +2925,7 @@
           "version": "1.4.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "wrappy": "1"
           }
@@ -2997,7 +3011,8 @@
         "safe-buffer": {
           "version": "5.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "safer-buffer": {
           "version": "2.1.2",
@@ -3033,6 +3048,7 @@
           "version": "1.0.2",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "code-point-at": "^1.0.0",
             "is-fullwidth-code-point": "^1.0.0",
@@ -3052,6 +3068,7 @@
           "version": "3.0.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "ansi-regex": "^2.0.0"
           }
@@ -3095,12 +3112,14 @@
         "wrappy": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "yallist": {
           "version": "3.0.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         }
       }
     },

+ 2 - 2
settings/webpack.common.js

@@ -4,8 +4,8 @@ const { VueLoaderPlugin } = require('vue-loader');
 module.exports = {
   entry: './src/main.js',
   output: {
-    path: __dirname + '/js',
-    publicPath: '/dist/',
+    path: path.resolve(__dirname, './js'),
+    publicPath: '/',
     filename: 'main.js'
   },
   module: {

Some files were not shown because too many files changed in this diff