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 build: node_modules
npm run build npm run build
chmod +x dist/wtc
clean: clean:
rm -r dist node_modules rm -r dist node_modules

View file

@ -37,13 +37,7 @@ wtc
== Update == Update
The easiest way to update is to first remove the program and then install again To update, just run the install command again
[,shell]
----
npm r -g work-time-calculator
npm i -g work-time-calculator
----
== Rationale == 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", "main": "src/main.ts",
"type": "module", "type": "module",
"bin": { "bin": {
"wtc": "dist/wtc" "wtc": "bin/wtc"
}, },
"scripts": { "scripts": {
"build": "rollup -c" "build": "rollup -c"
@ -34,7 +34,6 @@
"@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/eslint-plugin": "^6.10.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"rollup": "^4.5.1", "rollup": "^4.5.1",
"rollup-plugin-add-shebang": "^0.3.1",
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"dependencies": { "dependencies": {

View file

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