From 50b23d6e567d0c0b2c5718e7250f6af9d5d3398a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Wed, 8 Mar 2023 18:28:52 +0100 Subject: [PATCH 1/3] [IMP] package: add task label Add the task label before every log line in the console. This helps to know what is logging what. The current task \"build:* -- --watch\" is split into smaller task without argument. Otherwise, the labels would also include the argument, making it very long [build:js -- --watch] => [watch:ts] the "serve" task is also rename to better reflect what it does: serving static files. In v15, we also have a "server" task which could be confusing X-original-commit: 6aede4dcd21c33ecb17dc0b15b47ef343e36c222 --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 53fec61862..9ed3b955f8 100644 --- a/package.json +++ b/package.json @@ -12,21 +12,21 @@ ], "scripts": { "serve-static": "live-server --open=demo --watch=build/o_spreadsheet.js,build/o_spreadsheet.xml,demo", - "dev": "npm-run-all build --parallel server serve-static watch:*", + "dev": "npm-run-all --print-label build --parallel server serve-static watch:*", "server": "node tools/server/main.js", "build:js": "tsc --module es6 --incremental", - "bundle:js": "rollup -c -m --configDev", - "bundle:xml": "node tools/bundle_xml/main.js", - "build": "npm-run-all build:js bundle:js \"bundle:xml -- --outDir build\"", + "build:bundleJs": "rollup -c -m --configDev", + "build:bundleXml": "node tools/bundle_xml/main.js", + "build": "npm-run-all build:js build:bundleJs \"build:bundleXml -- --outDir build\"", "doc": "typedoc", "precommit": "npm run prettier && npm run doc", "test": "jest", "test:watch": "jest --watch", "prettier": "prettier . --write", "check-formatting": "prettier . --check", - "dist": "tsc --module es6 --declaration --declarationDir dist/types && rollup -c && npm run bundle:xml -- --outDir dist", + "dist": "tsc --module es6 --declaration --declarationDir dist/types && rollup -c && npm run build:bundleXml -- --outDir dist", "prepare": "husky install", - "watch:bundle": "npm run bundle:js -- --watch", + "watch:bundle": "npm run build:bundleJs -- --watch", "watch:ts": "npm run build:js -- --watch", "watch:xml": "node tools/bundle_xml/watch_xml_templates.js", "unzipXlsx": "node tools/bundle_xlsx/unzip_xlsx_demo.js", From fe496f0ad945046469c621042656a0358369a322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Wed, 8 Mar 2023 18:32:40 +0100 Subject: [PATCH 2/3] [IMP] package: disable console clearing In v15, a collaborative server was introduced. This server can raise errors (let's say if it cannot start because the port is already used). In the current situation, errors are cleared by ts watch mode. This makes it difficult to see and know what happened. X-original-commit: 8746ea2ba2f39bb097145c6aa01587bbe52ef35e --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index af9a4b6ae0..30fb086b8a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,7 @@ "strictNullChecks": true, "esModuleInterop": true, "allowJs": true, + "preserveWatchOutput": true, "sourceMap": true }, "include": ["src"], From 9cbd1b632ccd126e08fc05337f0d0035f0b596e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir=20=28rar=29?= Date: Thu, 9 Mar 2023 10:43:55 +0100 Subject: [PATCH 3/3] [FIX] server: Do not capture exit process event Exit events that are fired following an error of exectuion were silently caught. This would hide the reason of failure and make it very difficult to know what happened. X-original-commit: 6550810384d4b0683d18bfd8be6e9c574dc9a0a0 --- tools/server/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/server/main.js b/tools/server/main.js index 650a65a5bf..a33169af4b 100644 --- a/tools/server/main.js +++ b/tools/server/main.js @@ -42,11 +42,11 @@ if (fs.existsSync(currentSessionFile)) { } // save the messages before exiting gracefully -[`exit`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`].forEach((eventType) => { - process.on(eventType, () => { +[`SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`].forEach((eventType) => { + process.on(eventType, (code) => { log(`writing ${messages.length} messages to ${currentSessionFile}`); fs.writeFileSync(currentSessionFile, JSON.stringify(messages)); - process.exit(); + process.exit(code); }); });