diff --git a/.travis.yml b/.travis.yml index e99bc9270..323f0948a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,9 @@ addons: language: node_js matrix: include: + - node_js: "16" + script: + - ./node_modules/.bin/grunt no-coverage - node_js: "14" script: - ./node_modules/.bin/grunt && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage diff --git a/Gruntfile.js b/Gruntfile.js index a346a8c82..01f32cbfb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -16,7 +16,7 @@ var path = require("path"); var fs = require("fs-extra"); -var sass = require("node-sass"); +var sass = require("sass"); module.exports = function(grunt) { diff --git a/package.json b/package.json index 573c76ee1..249ea0bb0 100644 --- a/package.json +++ b/package.json @@ -106,8 +106,8 @@ "minami": "1.2.3", "mocha": "8.3.2", "node-red-node-test-helper": "^0.2.7", - "node-sass": "^5.0.0", "nodemon": "2.0.7", + "sass": "1.32.12", "should": "13.2.3", "sinon": "10.0.1", "stoppable": "^1.1.0", diff --git a/packages/node_modules/@node-red/editor-client/src/sass/flow.scss b/packages/node_modules/@node-red/editor-client/src/sass/flow.scss index f63c26279..503bdf5bd 100644 --- a/packages/node_modules/@node-red/editor-client/src/sass/flow.scss +++ b/packages/node_modules/@node-red/editor-client/src/sass/flow.scss @@ -255,11 +255,11 @@ g.red-ui-flow-node-selected { } } @each $current-color in red green yellow blue grey gray { - .red-ui-flow-node-status-dot-#{$current-color} { + .red-ui-flow-node-status-dot-#{""+$current-color} { fill: map-get($node-status-colors,$current-color); stroke: map-get($node-status-colors,$current-color); } - .red-ui-flow-node-status-ring-#{$current-color} { + .red-ui-flow-node-status-ring-#{""+$current-color} { fill: $view-background; stroke: map-get($node-status-colors,$current-color); } diff --git a/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html b/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html index 1ee1aa2b0..a18e5e8a8 100644 --- a/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html +++ b/packages/node_modules/@node-red/nodes/locales/ja/function/10-function.html @@ -19,8 +19,8 @@

入力メッセージはmsgという名称のJavaScriptオブジェクトで受け渡されます。

msgオブジェクトはmsg.payloadプロパティにメッセージ本体を保持するのが慣例です。

通常、コードはメッセージオブジェクト(もしくは複数のメッセージオブジェクト)を返却します。後続フローの実行を停止したい場合は、オブジェクトを返却しなくてもかまいません。

-

Node-REDの開始時もしくはフローの設定をデプロイした際実行される初期化コードを初期化処理タブに、ノードの停止もしくは再デプロイ時に実行される終了処理コードを終了処理タブに指定できます。

-

初期化処理タブの返却値としてPromiseを返却すると、入力メッセージの処理を開始する前にその完了を待ちます。

+

初期化処理タブにはノードの開始時に実行されるコードを、終了処理タブにはノードの終了時に実行されるコードを指定します。

+

初期化処理タブの返却値としてPromiseオブジェクトを返却すると、入力メッセージの処理を開始する前にその完了を待ちます。

詳細

コードの書き方の詳細については、オンラインドキュメントを参照してください。

メッセージの送信

diff --git a/scripts/build-custom-theme.js b/scripts/build-custom-theme.js index df3445c7d..e16b35e8b 100644 --- a/scripts/build-custom-theme.js +++ b/scripts/build-custom-theme.js @@ -22,10 +22,11 @@ +const os = require("os"); const nopt = require("nopt"); const path = require("path"); -const fs = require("fs") -const sass = require("node-sass"); +const fs = require("fs-extra"); +const sass = require("sass"); const knownOpts = { "help": Boolean, @@ -73,58 +74,58 @@ while((match = ruleRegex.exec(colorsFile)) !== null) { updatedColors.push(match[1]+": "+(customColors[match[1]]||match[2])+";") } -const result = sass.renderSync({ - outputStyle: "expanded", - file: path.join(__dirname,"../packages/node_modules/@node-red/editor-client/src/sass/style.scss"), - importer: function(url, prev, done){ - if (url === 'colors') { - return { - contents: updatedColors.join("\n") + +(async function() { + const tmpDir = os.tmpdir(); + const workingDir = await fs.mkdtemp(`${tmpDir}${path.sep}`); + await fs.copy(path.join(__dirname,"../packages/node_modules/@node-red/editor-client/src/sass/"),workingDir) + await fs.writeFile(path.join(workingDir,"colors.scss"),updatedColors.join("\n")) + + const result = sass.renderSync({ + outputStyle: "expanded", + file: path.join(workingDir,"style.scss"), + }); + + const css = result.css.toString() + const lines = css.split("\n"); + const colorCSS = [] + const nonColorCSS = []; + + let inKeyFrameBlock = false; + + lines.forEach(l => { + if (inKeyFrameBlock) { + nonColorCSS.push(l); + if (/^}/.test(l)) { + inKeyFrameBlock = false; } + } else if (/^@keyframes/.test(l)) { + nonColorCSS.push(l); + inKeyFrameBlock = true; + } else if (!/^ /.test(l)) { + colorCSS.push(l); + nonColorCSS.push(l); + } else if (/color|border|background|fill|stroke|outline|box-shadow/.test(l)) { + colorCSS.push(l); + } else { + nonColorCSS.push(l); } - return {file:path.join(__dirname,"../packages/node_modules/@node-red/editor-client/src/sass/"+url+".scss")} - } -}); + }); -const css = result.css.toString() -const lines = css.split("\n"); -const colorCSS = [] -const nonColorCSS = []; + const nrPkg = require("../package.json"); + const now = new Date().toISOString(); -let inKeyFrameBlock = false; + const header = `/* + * Theme generated with Node-RED ${nrPkg.version} on ${now} + */`; -lines.forEach(l => { - if (inKeyFrameBlock) { - nonColorCSS.push(l); - if (/^}/.test(l)) { - inKeyFrameBlock = false; - } - } else if (/^@keyframes/.test(l)) { - nonColorCSS.push(l); - inKeyFrameBlock = true; - } else if (!/^ /.test(l)) { - colorCSS.push(l); - nonColorCSS.push(l); - } else if (/color|border|background|fill|stroke|outline|box-shadow/.test(l)) { - colorCSS.push(l); + var output = sass.renderSync({outputStyle: parsedArgs.long?"expanded":"compressed",data:colorCSS.join("\n")}); + if (parsedArgs.out) { + + await fs.writeFile(parsedArgs.out,header+"\n"+output.css); } else { - nonColorCSS.push(l); + console.log(header); + console.log(output.css.toString()); } -}); - - -const nrPkg = require("../package.json"); -const now = new Date().toISOString(); - -const header = `/* - * Theme generated with Node-RED ${nrPkg.version} on ${now} - */`; - -var output = sass.renderSync({outputStyle: parsedArgs.long?"expanded":"compressed",data:colorCSS.join("\n")}); -if (parsedArgs.out) { - - fs.writeFileSync(parsedArgs.out,header+"\n"+output.css); -} else { - console.log(header); - console.log(output.css.toString()); -} + await fs.remove(workingDir); +})()