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
yarn
ornpm install
installs all required dependencies.
Equivalent
npm run <script>
should also work
yarn test
run tests with ava.yarn build
will run JSDoc -> TypeScript typing conversion with jsdoc and tsd-jsdoc, changes to ./types.d.ts shoud be committed.yarn lint
will lint all of the files with xoyarn format
will run lint with--fix
option 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.