diff --git a/lib/subflow/index.js b/lib/subflow/index.js index 8a3d0a4..bd9e7c5 100644 --- a/lib/subflow/index.js +++ b/lib/subflow/index.js @@ -54,7 +54,7 @@ function createJSON(dstPath, flow, encoding, key) { else { sf.flow = newFlow; } - const data = JSON.stringify(sf, null, "\t"); + const data = JSON.stringify(sf, null, 4); fs.writeFileSync(dstPath, data); } @@ -79,6 +79,7 @@ module.exports = async function(data, options) { if (!data.license || (data.license === "")) { data.license = "unknown"; } + data.keywords = data.keywords || meta.keywords; data.info = meta.info; var params = { diff --git a/lib/swagger/index.js b/lib/swagger/index.js index 2c6d0f5..360802f 100644 --- a/lib/swagger/index.js +++ b/lib/swagger/index.js @@ -24,7 +24,7 @@ async function getSpec(src, data) { let response = await axios.get(src, requestOptions); spec = response.data; } else if (/\.yaml$/.test(src)) { - spec = yamljs.load(util.skipBom(await fs.promises.readFile(src))); + spec = yamljs.load(src); } else if (/\.json/.test(src)) { spec = JSON.parse(util.skipBom(await fs.promises.readFile(src))); } else { diff --git a/templates/function/package.json.mustache b/templates/function/package.json.mustache index 095a498..bf1f3cb 100644 --- a/templates/function/package.json.mustache +++ b/templates/function/package.json.mustache @@ -6,7 +6,11 @@ "scripts": { "test": "mocha \"test/**/*_spec.js\" --timeout 3000" }, + "engines": { + "node": ">=12.0.0" + }, "node-red": { + "version": ">=1.3.7", "nodes": { "{{&nodeName}}": "node.js" } diff --git a/templates/subflow/README.md.mustache b/templates/subflow/README.md.mustache index cae8709..a3b2239 100644 --- a/templates/subflow/README.md.mustache +++ b/templates/subflow/README.md.mustache @@ -9,6 +9,8 @@ Run the following command in your Node-RED user directory - typically `~/.node-r npm install {{&projectName}} +{{#nodeRead}} ## Information {{&nodeRead}} +{{/nodeRead}} diff --git a/templates/subflow/package.json.mustache b/templates/subflow/package.json.mustache index 9902cc9..a492866 100644 --- a/templates/subflow/package.json.mustache +++ b/templates/subflow/package.json.mustache @@ -7,7 +7,11 @@ "{{name}}"{{^last}}, {{/last}} {{/keywords}} ], + "engines": { + "node": ">=12.0.0" + }, "node-red": { + "version": ">=1.3.7", "nodes": { "{{&nodeName}}": "subflow.js" } diff --git a/templates/swagger/package.json.mustache b/templates/swagger/package.json.mustache index 67049b0..5d7b4f3 100644 --- a/templates/swagger/package.json.mustache +++ b/templates/swagger/package.json.mustache @@ -6,7 +6,11 @@ "scripts": { "test": "mocha \"test/**/*_spec.js\" --timeout 3000" }, + "engines": { + "node": ">=12.0.0" + }, "node-red": { + "version": ">=1.3.7", "nodes": { "{{&nodeName}}": "node.js" } @@ -19,7 +23,7 @@ "dependencies": { "q": "1.5.1", "request": "2.88.2", - "file-type": "17.1.1" + "file-type": "16.5.3" }, "devDependencies": { "mocha": "9.2.1", diff --git a/templates/webofthings/package.json.mustache b/templates/webofthings/package.json.mustache index a134e96..4b18e4b 100644 --- a/templates/webofthings/package.json.mustache +++ b/templates/webofthings/package.json.mustache @@ -1,37 +1,41 @@ { - "name": "{{&projectName}}", - "version": "{{&projectVersion}}", - "description": "Node-RED node for {{&nodeName}}", - "main": "node.js", - "scripts": { - "test": "mocha \"test/**/*_spec.js\"" - }, - "node-red": { - "nodes": { - "{{&nodeName}}": "node.js" - } - }, - "keywords": [ - {{#keywords}} - "{{name}}"{{^last}}, {{/last}} - {{/keywords}} - ], - "dependencies": { - "https-proxy-agent": "5.0.0", - "request": "2.88.2", - "ws": "8.5.0", - "url-template": "2.0.8", - "ajv": "8.10.0", - "coap": "1.0.3" - }, - "devDependencies": { - "node-red": "2.2.2", - "node-red-node-test-helper": "0.2.7" - }, - "license": "{{&licenseName}}", - "wot": { - {{#wotmeta}} - "{{name}}": "{{value}}"{{^last}}, {{/last}} - {{/wotmeta}} + "name": "{{&projectName}}", + "version": "{{&projectVersion}}", + "description": "Node-RED node for {{&nodeName}}", + "main": "node.js", + "scripts": { + "test": "mocha \"test/**/*_spec.js\"" + }, + "engines": { + "node": ">=12.0.0" + }, + "node-red": { + "version": ">=1.3.7", + "nodes": { + "{{&nodeName}}": "node.js" } + }, + "keywords": [ + {{#keywords}} + "{{name}}"{{^last}}, {{/last}} + {{/keywords}} + ], + "dependencies": { + "https-proxy-agent": "5.0.0", + "request": "2.88.2", + "ws": "8.5.0", + "url-template": "2.0.8", + "ajv": "8.10.0", + "coap": "1.0.3" + }, + "devDependencies": { + "node-red": "2.2.2", + "node-red-node-test-helper": "0.2.7" + }, + "license": "{{&licenseName}}", + "wot": { + {{#wotmeta}} + "{{name}}": "{{value}}"{{^last}}, {{/last}} + {{/wotmeta}} + } }