@interaktiv/dia-scripts
Version:
CLI toolbox with common scripts for most sort of projects at DIA
51 lines (47 loc) • 2.11 kB
JavaScript
;
const {
ifBitbucketRepo,
isSfdxProject,
isMobileProject,
isCommerceProject,
isOptedOut,
pkg
} = require('../utils');
const shouldPublishToNpm = () => {
return pkg.private !== true && isSfdxProject() === false && isMobileProject() === false && isCommerceProject() === false;
};
/**
* When used with the `@semantic-release/changelog` or `@semantic-release/npm`
* plugins:
*
* The `@semantic-release/changelog` plugin must be called first in order to
* update the changelog file so the `@semantic-release/git` and
* `@semantic-release/npm` plugins can include it in the release.
*
* The `@semantic-release/npm` plugin must be called second in order to update
* the `package.json` file so the `@semantic-release/git` plugin can include it
* in the release commit.
*/
module.exports = {
branch: 'master',
plugins: [['@semantic-release/commit-analyzer', {
config: '@interaktiv/conventional-changelog-dia'
}], ['@semantic-release/release-notes-generator', {
config: '@interaktiv/conventional-changelog-dia',
writerOpts: {
compareUrlFormat: ifBitbucketRepo('{{host}}/{{owner}}/{{repository}}/compare/{{currentTag}}%0D{{previousTag}}#diff'),
pullRequestUrlFormat: ifBitbucketRepo('{{host}}/{{owner}}/{{repository}}/pull-requests/{{id}}'),
jiraUrlFormat: ifBitbucketRepo('https://interaktiv.jira.com/browse/{{id}}')
}
}], isOptedOut('changelog', null, ['@interaktiv/semantic-release-changelog', {
changelogTitle: '# Changelog\n\nAll notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.\n'
}]), isOptedOut('changelog', null, ['@semantic-release/exec', {
prepareCmd: 'npm run format -- CHANGELOG.md'
}]), ['@semantic-release/npm', {
npmPublish: shouldPublishToNpm()
}], ['@semantic-release/git', {
assets: ['CHANGELOG.md', 'package-lock.json', 'npm-shrinkwrap.json'],
// eslint-disable-next-line no-template-curly-in-string
message: 'chore(release): ${nextRelease.version} [skip ci]'
}]].filter(Boolean)
};