Skip to content

Commit 9bc7ac8

Browse files
committed
All debugger to pause just breakpoint nodes
1 parent 0a6404d commit 9bc7ac8

File tree

9 files changed

+788
-395
lines changed

9 files changed

+788
-395
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
resources
12
node_modules
23
dist

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-debugger",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "A flow debugger for Node-RED 2.x",
55
"repository": {
66
"type": "git",
@@ -10,13 +10,14 @@
1010
"build": "(tsc || exit 1) && npm run tslint && npm run copyAssets",
1111
"tslint": "tslint -c tslint.json -p tsconfig.json",
1212
"copyAssets": "node scripts/copy-static-assets.js",
13-
"dev": "nodemon --exec 'npm run build' -i dist -e 'ts html'",
13+
"dev": "nodemon --exec 'npm run build' -i dist -i resources -e 'ts html css'",
1414
"test": "npm run build"
1515
},
1616
"keywords": ["node-red","debugger"],
1717
"author": "Nick O'Leary <[email protected]>",
1818
"files": [
19-
"dist"
19+
"dist",
20+
"resources"
2021
],
2122
"license": "Apache-2",
2223
"node-red": {

scripts/copy-static-assets.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,48 @@ const minify = require("html-minifier").minify;
22
const fs = require("fs-extra");
33
const path = require("path");
44

5+
56
const projectRoot = path.join(__dirname,"..")
7+
const resources = path.join(projectRoot,"resources");
68
const dist = path.join(projectRoot,"dist");
79
const src = path.join(projectRoot,"src");
8-
const assets = [
10+
11+
const assets = {}
12+
assets[dist] = [
913
"flow-debugger.html",
1014
"locales"
11-
];
15+
]
16+
assets[resources] = [
17+
"style.css"
18+
]
1219

13-
(async function() {
20+
async function copyStaticAssets(dist,assets) {
1421
await fs.mkdir(dist,{recursive: true});
1522
for (let i=0; i<assets.length; i++) {
1623
if (/\.html/.test(assets[i])) {
1724
const content = await fs.readFile(path.join(src,assets[i]),"utf-8")
1825
await fs.writeFile(path.join(dist,assets[i]), minify(content, {minifyCSS: true, minifyJS: true}))
26+
} else if (/\.js/.test(assets[i])) {
27+
await fs.copy(path.join(src,assets[i]),path.join(dist,assets[i]))
28+
} else if (/\.css/.test(assets[i])) {
29+
const rawCSS = await fs.readFile(path.join(src,assets[i]),"utf-8");
30+
const minifiedCSS = minify("<style>"+rawCSS+"</style>", {minifyCSS: true});
31+
const finalCSS = minifiedCSS.substring(7,minifiedCSS.length-8)
32+
await fs.writeFile(path.join(dist,assets[i]), finalCSS)
1933
} else {
2034
await fs.mkdir(path.join(dist,assets[i]), {recursive: true});
2135
await fs.copy(path.join(src,assets[i]),path.join(dist,assets[i]))
2236
}
2337
}
38+
}
39+
40+
41+
42+
(async function() {
43+
const destinations = Object.keys(assets);
44+
for (let i=0, l=destinations.length; i<l; i++) {
45+
await copyStaticAssets(destinations[i],assets[destinations[i]]);
46+
}
2447
})().catch(err => {
2548
console.error(err);
2649
process.exit(1);

0 commit comments

Comments
 (0)