The goals of the template are to:
- Ease the contribution of the library by providing reproducible environments for developers and CI
- Automate as much as possible, from testing to releasing and upgrading dependencies
- Provide good defaults for users of Visual Studio Code
- EditorConfig: easy contributions from any code editor.
- ESLint: launched in the
- Prettier: launched in the
- Automatic VSCode formatting and linting: using VSCode extensions recommendations and workspace settings in .
- Yarn version pinning: via Yarn policies, so anyone contributing or any system accessing your library will use the same Yarn version without having to think about it.
- Node.js version pinning: via nvm, so anyone contributing or any system accessing your library will use the same Node.js version without having to think about it.
- Jest: launched in the
testscript, also with the right VSCode settings providing a testing workflow inside VSCode using
- GitHub actions: automatic testing and releasing from GitHub: npm publish and GitHub releases are automatically created. Note that the package.json in your repository is never updated (the version is always
0.0.0-development), only the one in npm is updated. This is surprising at first but as long as you display the published version in your README (like this template does) then you're fine. Find more information about this in the semantic-release documentation.
- semantic-release: allows for automatic releases based on semver.org and conventional commits specification. The defaults are taken from the Angular git commit guidelines.
- Codecov: launched in the
testscript on CI, ensures code coverage does not decrease on pull requests (free for public and private repositories).
Using this template requires a bit of setup, but way less than if you had to start from 0. Here's what you need to do:
Required steps: (needed every time you want to use the template)
- Create a new repository on GitHub based on this template
- Setup renovate for your new repository. If you previously installed the Renovate application to your account then this is just a box to tick when creating the repository
- Clone the new repository
- Change the package name and description in
- Setup Codecov for your new repository. If you previously installed the Codecov application to your account then this is just a box to tick when creating the repository
- Setup semantic releases: run
yarn semantic-release-cli setupin a terminal (This will ask for your npm and GitHub credentials)
- Add the previously generated
NPM_TOKENsecrets to the GitHub secrets of the new repository
- Install dependencies: run
yarnin your terminal
- Develop your library: change code in
- Test your library: you can either see tests results inside VSCode directly or run
yarn jest --watch
- Check formatting of your code: run
yarn check-formattingin your terminal
- Create your first release: open a pull request on your project, wait for tests to pass, merge and
💥your library will be automatically released to npm and a GitHub release will be created
Optional steps: (needed only if you're doing them for the first time)
- If you're not using VSCode, if your editor has no EditorConfig support, then setup EditorConfig EditorConfig support
- Make sure you have npm 2fa auth-only configured. Releases can't be automated if you have 2fa setup for both authentication and publish. See https://semantic-release.gitbook.io/semantic-release/usage/ci-configuration#authentication-for-plugins
- Install nvm
- Install yarn
Status and next steps
- Using different CI environments than GitHub actions
- Authoring browser libraries
README.mdtable of contents automatically
- Better default
README.mdcontent (Install, API, Examples, ...)
.githubPull requests template, issues templates, CONTRIBUTING files
- add or change scripts to allow for auto-formatting
- provide documentation on how to protect branches on GitHub
- provide scripts to easily open a pull request once a branch is created
- provide a way to check for semantic commits in PR
- contributors list
If you'd like to participate, if you have bugs or new ideas, open an issue or a pull request.
yarn link efficiently, do this:
> cd my-library > yarn link > yarn build --watch > cd ../my-other-library > yarn link my-library
Reformating all code