Example repo for a Node.js module with TypeScript typings (./types.d.ts) generated from JSDoc annotations.
Project setup, files/directories of interest are ./src/main.js, ./tests and ./types.d.ts.
├── LICENSE
├── README.md
├── node_modules
│ └── ...
├── package.json
├── src
│ └── main.js
├── tests
│ └── ping.js
├── types.d.ts
└── yarn.lock
Comes ready to develop with:
- ava for testing
- jsdoc and tsd-jsdoc to generate the ./types.d.ts file.
- xo for linting/formatting
Use the GitHub "Template" functionality or clone the repo (take care to remove the .git folder in that case).
- Node 12
- Yarn 1.x or npm
- Clone the repository
- Run
yarnornpm installinstalls all required dependencies.
Equivalent
npm run <script>should also work
yarn testrun tests with ava.yarn buildwill run JSDoc -> TypeScript typing conversion with jsdoc and tsd-jsdoc, changes to ./types.d.ts shoud be committed.yarn lintwill lint all of the files with xoyarn formatwill run lint with--fixoption on all the examples files (and tests).
This package is maintained by Hugo from Code with Hugo and Alpine.js Weekly.
Special thanks to:
Code is licensed under the MIT License.