Skip to content
/ template-npm-pkg Public template

a template to generate repositories for NPM packages

License

Notifications You must be signed in to change notification settings

kaskadi/template-npm-pkg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Actions workflows status

Build workflow status Publish workflow status

CodeClimate


Repository initialization

When creating a repository from this template an init workflow (see here) will run. This workflow uses kaskadi-cli in order to properly initialize your repository by:

  • updating the names refering to the template in relevant files (for example package.json, package-lock.json, etc.) and renaming some files if need be
  • automatically adding your repository to Code Climate
  • automatically setting REPORTER_ID secret inside of your repository for test coverage upload to Code Climate. This may fail because of Code Climate infrastructure latency in setting up your repository. In such case your workflow will emit a warning telling you to set REPORTER_ID manually

Testing

mocha, chai, nyc, dotenv & standard are available as dev dependencies.

A build workflow (see here) is running on pull request and will execute your test suite before allowing you to merge your PR. It also has a coverage job already prepared that you can comment out as soon as your testing is in place and your REPORTER_ID is in the repository secrets. This is the ID on Code Climate used for uploading code coverage reports.

Beside running your unit tests, this workflow also runs a static code analysis to find any vulnerability in your code. If a vulnerability is found, a notification will appear in the Security tab of your repository.


Documentation

This repository comes with a generate-docs job inside of the publish workflow that generates documentation automatically for you using JSDOC. It'll check all your .js files for JSDOC-like comments in order to build its documentation. See here for more information.

If you would like to see the workflow configuration, head here.

You can configure the template used to generate the action documentation here.


Publishing

Publishing to NPM is done automatically via a publish workflow (see here). This workflow will run on push. It checks the currently published version versus the one in package.json and if those versions differ then it publishes to NPM.

Before publishing, this workflow also runs a static code analysis to find any vulnerability in your code. If a vulnerability is found, a notification will appear in the Security tab of your repository.

Beside this analysis, the workflow will run your unit tests right before publishing to make sure that no bugs have been introduced.

Warning: in order for this workflow to work properly, you'll have to manually publish your package on initial publish.


Installation

npm i template-npm-pkg

API documentation

help

You can use JSDoc comments in your .js files to generate automatically documentation for your package via the generate-docs workflow.

About

a template to generate repositories for NPM packages

Topics

Resources

License

Stars

Watchers

Forks