Fix running on older nodejs versions

The shebang does not work without extension
This commit is contained in:
Marko Korhonen 2023-11-23 20:24:35 +02:00
parent 536aaa01b0
commit 6bbfd25745
Signed by: FunctionalHacker
GPG key ID: A7F78BCB859CD890
5 changed files with 8 additions and 13 deletions

View file

@ -13,7 +13,6 @@ node_modules:
build: node_modules
npm run build
chmod +x dist/wtc
clean:
rm -r dist node_modules

View file

@ -37,13 +37,7 @@ wtc
== Update
The easiest way to update is to first remove the program and then install again
[,shell]
----
npm r -g work-time-calculator
npm i -g work-time-calculator
----
To update, just run the install command again
== Rationale

4
bin/wtc Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
DIR="$(dirname "$(readlink -f "$0")")"
node "$DIR/../dist/wtc.js" "$@"

View file

@ -15,7 +15,7 @@
"main": "src/main.ts",
"type": "module",
"bin": {
"wtc": "dist/wtc"
"wtc": "bin/wtc"
},
"scripts": {
"build": "rollup -c"
@ -34,7 +34,6 @@
"@typescript-eslint/eslint-plugin": "^6.10.0",
"eslint-config-prettier": "^9.0.0",
"rollup": "^4.5.1",
"rollup-plugin-add-shebang": "^0.3.1",
"tslib": "^2.6.2"
},
"dependencies": {

View file

@ -1,15 +1,14 @@
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import shebang from 'rollup-plugin-add-shebang';
/** @type {import('rollup').RollupOptions} */
const config = {
input: 'src/main.ts',
output: {
format: 'esm',
file: 'dist/wtc',
file: 'dist/wtc.js',
},
plugins: [typescript(), terser(), shebang({ include: 'dist/wtc' })],
plugins: [typescript(), terser()],
external: [
'@iarna/toml',
'chalk',