Early Exit if Node Version is Lower (#870)

This commit is contained in:
Rajarshee Chatterjee
2024-04-03 09:35:05 +05:30
committed by GitHub
parent 39523ac032
commit 3ce32096f2
2 changed files with 16 additions and 9 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ app.get('/', (req, res) => {
}); });
app.listen(port, host, () => { app.listen(port, host, () => {
console.log(`Testing plugins web listening on http://localhost:${port}`); console.log(`Server listening at http://localhost:${port}`);
}); });
//Dayjs localization //Dayjs localization
+15 -8
View File
@@ -1,18 +1,25 @@
import { TscWatchClient } from 'tsc-watch/client'; import { TscWatchClient } from 'tsc-watch/client';
const nodeVersion = Number(process.versions.node.split('.')[0]);
if (nodeVersion < 18) {
console.error(
`\nYou are using Node.js ${process.versions.node}. For lnreader-plugins, Node.js version >= v18.0.0 is required.`,
);
process.exit(1);
}
const watch = new TscWatchClient(); const watch = new TscWatchClient();
let port = Number(process.argv[2]); let port = Number(process.argv[2]);
if (!port) { if (!port) {
console.log(`Port not specified! Setting default 3000! console.log(
Run \`npm start -- <port>\` to change it `No port specified; defaulting to 3000. Change it with 'npm start -- <PORT>'.`,
`); );
port = 3000; port = 3000;
} }
watch.start('--onSuccess', `node ./.js/index.js ${port}`); watch.start('--onSuccess', `node ./.js/index.js ${port}`);
try {
} catch (e) {
watch.kill(); // Fatal error, kill the compiler instance.
}