A template for starting an npm package with testing, linting, styling, types, CI, and documentation.
MIT License
This is a template NPM package repository. Get started with the following commands:
git clone https://github.com/Antman261/npm-package-template.git my-package
cd my-package
rm -rf .git
git init
git remote add origin https://github.com/<YOUR USERNAME>/<YOUR REPOSITORY>
nvm use
npm i
Where my-package
is the name of your package
Now you can begin developing your package!
npm run watch
Use this during development to run tests on changenpm run build
Build your librarynpm run build-docs
Builds the documentation using TypeDoc and TypeDoc Markdown
Hosting your docs on GitHub Pages makes it easier to read the full documentation for your package. TypeDoc will generate markdown for your JSDoc comments. GitHub's Jekyll engine then parses and renders the markdown into HTML on their pages server.
Set up a GitHub Pages site for your package as a project site with the following steps:
Settings
Pages
main
(or master
) and the directory to /docs
A basic CircleCI config is included in this template. It will install dependencies and run tests. Use this to ensure that pull requests from contributors pass tests.
Also consider setting up branch protection and requiring passing checks from CircleCI for pull requests.
You'll need to update the following files and properties to finish setting up your package:
package.json
=> "name"
package.json
=> "description"
package.json
=> "repository.url"
package.json
=> "author"
CONTRIBUTING.md
-- Update for your projectLICENSE
-- Add your name to the copyright notice or replace with another license.README.md
-- Time to update the file you're reading! Add your own description and usage examples for your package.After completing the above you can use npm publish
to publish your package, complete with type definitions and docs.