From 3b61079eeac10d918af45a3e92ef6e869e67c676 Mon Sep 17 00:00:00 2001 From: Hiroyuki Okada Date: Tue, 21 Mar 2023 14:12:43 +0900 Subject: [PATCH] feat: update node@16 --- .node-version | 2 +- README.md | 4 ++-- main.js | 21 +++------------------ package.json | 21 +++++++++++---------- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/.node-version b/.node-version index 260a0e2..c85fa1b 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -12.19.0 +16.17.1 diff --git a/README.md b/README.md index 394ec7d..6870444 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ git clone https://github.com/okhiroyuki/redmobile-modules-generator.git ## Requirements -- RedMobile v7.x or higher -- node.js @ 12.19.0 +- RedMobile v8.x or higher +- node.js @ 16.17.1 ## Usage diff --git a/main.js b/main.js index 4f3ef3d..098777d 100644 --- a/main.js +++ b/main.js @@ -2,7 +2,6 @@ const fs = require('fs'); const archiver = require('archiver'); const childProcess = require('child_process'); const modclean = require('modclean'); -const rimraf = require('rimraf'); const distDir = 'dist'; const targetDir = 'node_modules'; @@ -23,25 +22,13 @@ const zipArchive = async () => { const archive = archiver('zip', { zlib: { level: 9 } }); - + archive.pipe(output); archive.directory(targetDir, false); await archive.finalize(); } -const cleanDir = (dir) => { - return new Promise((resolve) => { - if (fs.existsSync(dir)) { - rimraf(dir, () => { - resolve(); - }); - }else{ - resolve(); - } - }); -} - const runNpm = (cmd, args) => { return new Promise((resolve) => { let n = childProcess.spawn(cmd,args); @@ -49,11 +36,11 @@ const runNpm = (cmd, args) => { n.stdout.on('data', (data) => { console.log(`${data}`); }); - + n.stderr.on('data', (data) => { console.error(`${data}`); }); - + n.on('close', (code) => { console.log(`child process exited with code ${code}`); resolve(); @@ -62,9 +49,7 @@ const runNpm = (cmd, args) => { } (async() => { - await cleanDir(distDir); fs.mkdirSync(distDir); - await cleanDir(targetDir); fs.unlinkSync('package-lock.json'); try { await runNpm('npm',['i','--production']); diff --git a/package.json b/package.json index 761f9be..9735fa6 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { - "version": "0.2.0", + "version": "1.0.0", "description": "RedMobile Custom Module Generator", "main": "main.js", "scripts": { "serve": "node ./node_modules/node-red/red.js", - "build": "node main.js" + "build": "node main.js", + "prebuild": "npx rimraf dist" }, "dependencies": { "@red-mobile/red-mobile-nodes": "^2.7.5", - "archiver": "^5.2.0", + "archiver": "^5.3.1", "axios": "^0.25.0", "bcryptjs": "^2.4.3", "body-parser": "^1.19.0", @@ -18,18 +19,18 @@ "fs-extra": "^10.0.0", "modclean": "^3.0.0-beta.1", "multer": "^1.4.1", - "node-red": "^2.2.0", + "node-red": "^3.0.2", "node-red-contrib-image-output": "^0.6.3", "node-red-contrib-string": "^1.0.0", - "node-red-dashboard": "^3.1.5", + "node-red-dashboard": "^3.4.0", "node-red-node-base64": "^0.3.0", - "node-red-node-email": "^1.14.0", - "qs": "^6.10.0", - "rimraf": "^3.0.2", + "node-red-node-email": "^1.18.4", + "qs": "^6.11.1", + "rimraf": "^4.4.0", "uuid": "^8.3.2", - "ws": "^8.4.0" + "ws": "^8.13.0" }, "engines": { - "node": ">=12" + "node": ">=16" } }