Semantic Release setup for Wavevision apps to maintain conventional commits and releases using gitmoji. The package contains bootstrap and configs for:
semantic-releasesemantic-release-gitmoji@semantic-release/git@semantic-release/github@semantic-release/gitlab@semantic-release/npmcommitizencommitlintgitflow-avhhusky
yarn add --dev @wavevision/semantic-releaseFirst, use setup scripts that come with this package.
yarn setup-commitizenβ setupcommitizenconfigyarn setup-gitflowβ setupgitflow-avhbranchesyarn setup-huskyβ setuphuskyhooks for linting your commit messages
Then, create necessary configs in your project root.
This is the main config for semantic-release. Require makeConfig function from @wavevision/semantic-release/config to bootstrap your project config. The function accepts single options parameter which is an object with following shape:
type Options = { config: 'gitlab' | 'github'; // needed to setup correct release plugin branches: string[]; // list of branches on which releases should happen rules?: { // map gitmoji to specific release types major?: string[] | { exclude?: string[]; include?: string[] }; minor?: string[] | { exclude?: string[]; include?: string[] }; patch?: string[] | { exclude?: string[]; include?: string[] }; }; templates?: { notes?: string; // release notes .hbs template content commit?: string; // commit .hbs template content }; git?: { enabled: boolean; // enable @semantic-release/git plugin assets?: string[]; // relative paths to assets to be commited with a release }; npm?: { enabled: boolean; // enable @semantic-release/npm plugin }; };const makeConfig = require('@wavevision/semantic-release/config'); const { CONFIG_GITHUB, } = require('@wavevision/semantic-release/config/constants'); module.exports = makeConfig({ config: CONFIG_GITHUB, branches: ['master'], git: { enabled: true, assets: ['package.json'] }, npm: { enabled: true }, });This will bootstrap semantic-release for GitHub repository in which releases will happen on master branch. Each new release will change version property inside package.json which will be then committed to the repository. Also, if your package.json does not set private: true, an npm package will be published.
Note: See this FAQ to learn about setting
npmpublished package access.
The gitmoji release rules are by default:
major=[:boom:]minor=[:sparkles:]patch=[:bug:, :ambulance:, :lock:]
The package contains a helper to stringify .hbs templates content from a folder you define. Use it as follows.
const { makeTemplate } = require('@wavevision/semantic-release/config/utils'); const template = makeTemplate('path', 'to', 'templates'); template('notes'); // will return content from path/to/templates/notes.hbsAs shown in the example @wavevision/semantic-release/config/constants exports set of useful constants to be used with the configuration. See all of them in that module.
Simply use the config from this package.
module.exports = require('@wavevision/semantic-release/commitlint');The package also contains bootstrapped commitizen CLI which will help you assemble valid gitmoji commit messages through a simple prompt. Simply run yarn commit and follow the steps.
Note: Longer description, breaking change commit body and list of issues closed are not required.
