chore(common): convert hextobin to ES Modules

Fixes #9675.
This commit is contained in:
Marc Durdin 2023-10-04 11:04:36 +07:00
parent e7ac526c69
commit f69f28bbd5
5 changed files with 15 additions and 51 deletions

View file

@ -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

View file

@ -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});

View file

@ -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"
}

View file

@ -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"]
}

View file

@ -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/" }
]
}