/open-source-starter

Open source project starter

Primary LanguageJavaScriptMIT LicenseMIT

Open Source Starter

Pre-configured starter for open source Node projects with automated releases

travis build travis build release number dependencies status dev dependencies status

commitizen semantic-release prettier license

This starter provides all necessary setup to quickly start an open source project, with fully automated release, tests, generate CHANGELOG.md, version bump, publish to NPM.

Content

Babel : Use next generation JavaScript

All .js files in src/ will be compiled with Babel and added in the dist/ folder

Config : .babelrc

ESLint : A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease

config: .eslintrc

Prettier : Opinionated code formatter

config: .prettierrc

Husky : Use git hooks with ease

Here it just call lint-staged on pre-commit

config: "husky" in package.json

lint-staged : Run linters against staged git files

Here it calls ESLint and Prettier on git add

config: "lint-staged" in package.json

Commitizen : Conventional commit messages CLI

Semantic Release : Fully automated version management and package publishing

Jest : JavaScript Testing Framework

Add your test files either in src/ with my-file.spec.js format, or in the __tests__ folder at your project root directory

config : jest.config.js

Requirements

note: this repo use Github actions, but you can use any continuous integration system you want, see semantic-release-cli documentation for or more informations.

Installation

  1. Fork or clone this repo git clone https://github.com/JimmyBeldone/open-source-starter.git
  2. Run yarn setup
  3. Configure semantic-release with semantic-release-cli : npx semantic-release-cli setup. semantic-release-cli
  4. You're all set !

Usage

Stage a file

git add src/my-file.js

From now on when you will use git add on a file in src/, it will be automatically linted and prettified.

Use conventional commit

yarn commit

This script will open Commitizen to help you write conventional commit

Release / Publish

All you need to do is merge on master branch, simple as that.

It will :

  1. Triggers CI
  2. Run your test during CI
  3. Run semantic-release steps :
    • Analyse your commits
    • Bump version
    • Add release notes
    • Generate CHANGELOG.md
    • Publish to NPM & Github

Contributing

Contributions are welcome ! See contributing guidelines

License

MIT

Copyright (c) 2019 Jimmy Beldone