npm i --save-dev eslint eslint-plugin-import prettier git-list-updated @serverless/eslint-config
Add eslintConfig
to package.json:
For Node.js projects:
{
"eslintConfig": {
"extends": "@serverless/eslint-config/node",
"root": true
}
}
For Browser projects:
{
"eslintConfig": {
"extends": "@serverless/eslint-config/browser",
"root": true
}
}
Add prettier.config.js
file with following content:
'use strict';
module.exports = require('@serverless/eslint-config/prettier.config');
{
"scripts": {
"lint": "eslint --ignore-path .gitignore .",
"lint:updated": "pipe-git-updated --ext=js -- eslint --ignore-path .gitignore",
"prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
"prettier-check:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
"prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
"prettify:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write"
}
}
Run following validation of PR's in CI build.
Note: following should be run only for PR's (as *:updated
) scripts may fail on branch or tag builds due to lack of existing reference to main
)
npm run lint:updated && npm run prettier-check:updated
Commit messages in context of this project should follow Convention Commits Convention
See proposed Commit Message Guidelines
- Commit messages are validated (with commitlint) in context of PR's that are coming from local branches. To not increase difficulty of contribution, we do not enforce that on external contributors. Still in turn PR's coming from forks (if commit messages do not follow CC), are expected to be squash merged with a valid CC commit message.
- In Release PR by running
npm run prepare-release
command developer bumps version inpackage.json
and generates the changelog entry (which can be altered if needed). - Release PR's are automatically detected in CI by fact of
version
inpackage.json
file being changed. In context of that build, existence of new version changelog entry (inCHANGELOG.md
) is validated. - Once release PR is merged,
main
build detects that release PR was merged by fact that it covers change ofversion
field inpackage.json
file. In such case (after tests pass) version tag is created and pushed to the repository - In context fo version tag build, new version is published to npm, and release notes are retrieved from CHANGELOG.md and pushed to GitHub.
- If needed release notes can be updated at any time afterwards. They should be updated in
CHANGELOG.md
and change can be pushed to GitHub release notes by running:npx github-release-from-cc-changelog <version>