diff --git a/common/tools/hextobin/build.sh b/common/tools/hextobin/build.sh index 702e6610f0..48c8542510 100755 --- a/common/tools/hextobin/build.sh +++ b/common/tools/hextobin/build.sh @@ -1,11 +1,4 @@ #!/usr/bin/env bash -# -# Builds hextobin.js -# - -# Exit on command failure and when using unset variables: -set -eu - ## START STANDARD BUILD SCRIPT INCLUDE # adjust relative paths as necessary THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" @@ -23,20 +16,9 @@ builder_describe "Build hextobin" clean configure build builder_describe_outputs \ configure /node_modules \ build build/index.js + builder_parse "$@" -if builder_start_action clean; then - npm run clean - builder_finish_action success clean -fi - -if builder_start_action configure; then - verify_npm_setup - builder_finish_action success configure -fi - -if builder_start_action build; then - npm run build - builder_finish_action success build -fi - +builder_run_action clean rm -rf build/ node_modules/ +builder_run_action configure verify_npm_setup +builder_run_action build tsc --build diff --git a/common/tools/hextobin/hextobin.ts b/common/tools/hextobin/hextobin.ts index 503b18d4b1..e53e08ddbc 100644 --- a/common/tools/hextobin/hextobin.ts +++ b/common/tools/hextobin/hextobin.ts @@ -1,7 +1,6 @@ #!/usr/bin/env node -import * as fs from 'fs'; -import * as rd from 'readline'; import * as program from 'commander'; +import hextobin from './index.js'; let inputFilename: string = ""; let outputFilename: string = ""; @@ -43,6 +42,4 @@ function exitDueToUsageError(message: string): never { return process.exit(64); // SysExits.EX_USAGE } -import hextobin from './index'; - hextobin(inputFilename, outputFilename, {silent: false}); diff --git a/common/tools/hextobin/package.json b/common/tools/hextobin/package.json index 155f829759..2ebb0e9f4e 100644 --- a/common/tools/hextobin/package.json +++ b/common/tools/hextobin/package.json @@ -1,6 +1,8 @@ { "name": "@keymanapp/hextobin", "description": "hextobin conversion tool", + "type": "module", + "private": true, "keywords": [ "keyman", "hex", @@ -14,14 +16,6 @@ "bin": { "hextobin": "build/hextobin.js" }, - "scripts": { - "clean": "tsc -b --clean", - "build": "tsc -b" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/keymanapp/keyman.git" - }, "devDependencies": { "@types/node": "^18.7.18" } diff --git a/common/tools/hextobin/tsconfig.json b/common/tools/hextobin/tsconfig.json index e32831fe73..db0a65ae9d 100644 --- a/common/tools/hextobin/tsconfig.json +++ b/common/tools/hextobin/tsconfig.json @@ -1,19 +1,9 @@ { - "extends": "../../../tsconfig-base.json", - "compilerOptions": { - "composite": true, - "declaration": true, - "target": "ES2020", - "module": "CommonJS", - "moduleResolution": "node", - "rootDir": ".", - "outDir": "build/", - }, - "exclude": [ - "node_modules" - ], - "files": [ - "index.ts", - "hextobin.ts" - ] + "extends": "../../../tsconfig.esm-base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build/" + }, + "exclude": ["node_modules"], + "files": ["index.ts", "hextobin.ts"] } diff --git a/tsconfig.esm.json b/tsconfig.esm.json index c58550431a..47c0ef92e9 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -47,5 +47,6 @@ // { "path": "./web/tools/sourcemap-root/tsconfig.json" }, { "path": "./common/web/lm-message-types/" }, { "path": "./common/web/lm-worker/" }, + { "path": "./common/tools/hextobin/" } ] } \ No newline at end of file