sample-nodejs-project gets you started with a walking skeleton for your next node.js library or app.
Forget about the boilerplate stuff and get started on your project.
- Backwards compatible Javascript through Babel. Modify
.babelrc
to update its configuration. - Typescript support. Modify
.tsconfig.json
,tsconfig.cjs.json
andtsconfig.esm.json
to update its configuration. - Linting through ESlint. Modify
.eslintrc
to update its configuration. - Docs Generation through Typedoc.
- Unit Testing through Mocha.
- Unit Testing Coverage through Istanbul. Modify
.nycrc.json
to update its configuration. - Unit Testing Coverage reporting through CodeClimate.
- Standard Commit Messages through commitizen.
- Automated releases through semantinc-release. Modify
release.config.js
to update its configuration. - Github Actions for PR commits: linting, testing, coverage, CodeClimate code quality
- Github Actions for merging PRs: automated releases (Github tagging only).
Install nvm (node version manager)
# install and use the version specified in .nvmrc
nvm i
# install global packages
npm install -g commitizen
# install node_modules
npm install
# run TypeScript compilation process
npm run build
# build docs
npm run docs
# run linter
npm run lint src/
# run unit tests without coverage
npm run test
# run unit tests with coverage
npm run test:coverage
# run example
node examples/hello-world.cjs.js
Besides the instructions above, do the following:
- Delete CHANGELOG.md. It will be regenerated in your first release.
- Set the
version
field inpackage.json
to1.0.0
. - Update attributes in
package.json
. - Update the
README.md
accordingly. - Generate the following secrets for your Github Actions (Repo -> Settings -> Secrets)
GH_TOKEN
: Create a personal token. This is needed for the automated semantic releases.CC_TEST_REPORTER_ID
: Once you add your repo to CodeClimate, go to Repo Settings -> Test Coverage. Get theTest Reporter ID
from there. This is needed to send the test coverage to CodeClimate.
- Taking advantage of commitizen auto-formatting
# instead of git commit, use
git cz
- Testing semantic releases locally
GITHUB_TOKEN=your_token npx semantic-release --dry-run