vscode with typescript and jest project generator. This package generate the project skeleton for visual studio code that use typescript as source code, and jest for unit test, eslint for linting and prettier for prettier codes. This generator also compose with generator-license.
For those who only need to setup eslint and prettier. Use the sub generator. (See instruction below)
This generator will also setup tsup, a tool for bundling codes into commonjs and esm at the same time.
First, install Yeoman and generator-vscode-typescript-jest using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-vscode-typescript-jest
Then generate your new project:
yo vscode-typescript-jest
yo vscode-typescript-jest:eslint-prettier
Note When using sub generator. If package.json already exist in the project, a warning message will be display. Giving you an warning that package.json is about to be overwritten, and asking user permission to proceed. But in reality, it does not overwrite the WHOLE package.json file, just inserting the dev dependencies for eslint and prettier. User can enter "d" option to see what will be inserted to the package.json before enter "y" option.
Note
You should runnpx npm-check-updates
check and update the dependencies, as newer version may had released since the publication of this generator.
./src
All the source codes go into this directory../dist
All built/transpile codes will output to this directory../__tests__
All test codes should go into this directory.
-
Run jest test
npm run test
-
If you just want to transpile typescript with tsc
npm run tsc
-
Auto restart when changes are saved
npm run dev
-
Output codes to commonjs & esm format at the same time
npm run build:tsup
- Yeoman has a heart of gold.
- Yeoman is a person with feelings and opinions, but is very easy to work with.
- Yeoman can be too opinionated at times but is easily convinced not to be.
- Feel free to learn more about Yeoman.
MIT © koonfoon