# Install dependencies
npm i
-
TypeScript source files should be placed in directories with
_ts
suffix. JavaScript files in these directories will be ignored bygit
(.gitignore
). -
JavaScript files will be ignored by TypeScript compiler (
tsconfig.json
). -
Transpiled JavaScript will be created side-by-side in
*.ts
files.
# Compile TypeScript
tsc -p .
# Start TypeScript compiler in 'watch' mode
npm run dev
Inputs can be created as text files to be piped as stdin
.
# TypeScript (assuming source is compiled, see above)
node _template_ts < _template_ts\in.txt
# JavaScript
node _template_js < _template_js\in.txt
# To pipe output to a file (note that the out.txt will be created in current directory)
node _template_ts < _template_ts\in.txt > out.txt
To diff both files, use VS Code file compare feature by selecting both files and choose
Compare Selected
in the context menu.
The profiles Debug TS
and Debug JS
are defined in .vscode/launch.json
for debugging TypeScript and JavaScript source respectively. Open the source file before starting the debug session. The content of Input needs to be piped to in.txt
will be piped in as stdin
.stdin
in the debug session.
The project is setup with Mocha test framework for unit testing. Tests should be suffix with .test.js
or .test.ts
, See .mocharc.json
.
# Run all tests (TypeScript will be compiled first)
npm test
# Run all tests in watch mode
npm run test:watch
npm run lint
ESLint is configured with recommended ruleset. See .eslintrc.js
for details.