From 497da96fda60b17b8f4ea1eef78a47719c6e6573 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 25 Jun 2021 18:24:47 +0800 Subject: [PATCH] no message --- docker/php/php.conf | 4 ++-- package.json | 8 ++++--- resources/assets/js/pages/manage.vue | 10 +++++++++ version.js | 32 ++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 version.js diff --git a/docker/php/php.conf b/docker/php/php.conf index 74f52c2d..b72399d4 100644 --- a/docker/php/php.conf +++ b/docker/php/php.conf @@ -2,10 +2,10 @@ directory=/var/www # 生产环境 -command=php bin/laravels start -i +#command=php bin/laravels start -i # 开发环境 -#command=./bin/inotify ./app +command=./bin/inotify ./app numprocs=1 autostart=true diff --git a/package.json b/package.json index c5da8f5a..65e4450e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "DooTask", - "version": "0.2.12", - "description": "DooTask is task management system", + "version": "0.2.13", + "description": "DooTask is task management system.", "scripts": { "dev": "npm run development", "development": "mix", @@ -9,7 +9,9 @@ "watch-poll": "mix watch -- --watch-options-poll=1000", "hot": "mix watch --hot", "prod": "npm run production", - "production": "mix --production" + "production": "mix --production", + "version": "node ./version.js", + "native": "node ./nativefier.js" }, "devDependencies": { "axios": "^0.21", diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 99aaacdb..db0c431f 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -203,6 +203,7 @@ export default { '$route' (route) { this.curPath = route.path; }, + dialogMsgPush(data) { if (this.natificationHidden && this.natificationReady) { const {id, dialog_id, type, msg} = data; @@ -238,6 +239,15 @@ export default { }) } } + }, + + natificationHidden(val) { + clearTimeout(this.notificationTimeout); + if (!val) { + this.notificationTimeout = setTimeout(() => { + this.notificationClass.close(); + }, 6000); + } } }, diff --git a/version.js b/version.js new file mode 100644 index 00000000..b9120ef1 --- /dev/null +++ b/version.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const path = require("path"); +const exec = require('child_process').exec; +const packageFile = path.resolve(process.cwd(), "package.json"); + +function runExec(command, cb) { + exec(command, function (err, stdout, stderr) { + if (err != null) { + return cb(new Error(err), null); + } else if (typeof (stderr) != "string") { + return cb(new Error(stderr), null); + } else { + return cb(null, stdout); + } + }); +} + +runExec("git rev-list --all --count", function (err, response) { + if (err) { + console.error(err); + return; + } + let num = parseInt(response) + if (isNaN(num) || Math.floor(num % 100) < 0) { + console.error("get version error " + response); + return; + } + let ver = Math.floor(num / 10000) + "." + Math.floor(num / 100) + "." + Math.floor(num % 100) + let newResult = fs.readFileSync(packageFile, 'utf8').replace(/"version":\s*"(.*?)"/, `"version": "${ver}"`); + fs.writeFileSync(packageFile, newResult, 'utf8'); + console.log("new version: " + ver); +});