Skip to content

Commit

Permalink
feat: update node@16
Browse files Browse the repository at this point in the history
  • Loading branch information
okhiroyuki committed Mar 21, 2023
1 parent edd4997 commit 3b61079
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.19.0
16.17.1
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 3 additions & 18 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -23,37 +22,25 @@ 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);
n.stdout.setEncoding('utf-8');
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();
Expand All @@ -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']);
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
}
}

0 comments on commit 3b61079

Please sign in to comment.