generator-ts-exe

0.1.5 • Public • Published

generator-ts-exe

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.

Install

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

Usage

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. 

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.

Project Structure

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

TODO

  • Add LICENSE.txt generation derived from the selection provided to the prompt.
  • CLI options for shorthand bootstrapping and automation.
  • Conditional yarn or npm use in the scaffold output.

Package Sidebar

Install

npm i generator-ts-exe

Weekly Downloads

1

Version

0.1.5

License

ISC

Unpacked Size

12.8 kB

Total Files

22

Last publish

Collaborators

  • mdrx