Scaffold a TypeScript executable project.
The resulting project will be bootstrapped to help you develop a Node.js utility written in TypeScript with production-grade process baked in.
Typical Yeoman and Yeoman generator usage is from the global PATH
$ yarn global add yo generator-ts-exe
or
$ npm install --global yo generator-ts-exe
No CLI options available yet. A basic prompt will fill out the package.json
and name the artifacts in the project's dist/
.
Note, the "License" prompt will not lead to a LICENSE.txt file produced - for now, you must add that yourself.
$ yo ts-exe
? Your project title (kebab-case) # foo
? Your project description # This project needs a description
? Author Name <email@example.com> (https://website.com) # ""
? License # ISC
After the new project has finished generating with no issues, you will have a new project directory, with the title you provided, in your current working directory. Then:
$ cd foo
At this point, you can use the npm scripts defined in thepackage.json
. The ones that are intended to be used directly are:
$ yarn dev # Run Jest in --watch mode continuously.
$ yarn start # Only compile the TS to JS and run the application normally.
$ yarn build-all # Run through all steps to output a production-grade JS file.
$ yarn build-exe # Same as "build-all" but output an executable binary.
If yarn
is not detected on your system, use npm run
instead.
The build scripts will output to the dist/
directory and give you a single JS file that a user can run through their local Node.js runtime, and optionally an executable binary to deploy.
The resulting project scaffold will include the following:
- a
src
folder with two TS files to verify that ES6 module support works - linting configuration via ESLint
- opinionated formatting via Prettier
- transpilation via TypeScript's
tsc
- unit testing via Jest with some dummy tests (one which fails by default).
- bundling via webpack
- minification and compatibility via Babel
- executable packaging via Pkg for portability
- a bare README.md file