-
Notifications
You must be signed in to change notification settings - Fork 7
/
ship.config.js
42 lines (37 loc) · 1.13 KB
/
ship.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const shell = require('shelljs');
const packages = JSON.parse(
shell.exec('yarn run --silent lerna list --toposort --json', {
silent: true,
})
);
const cwd = process.cwd();
module.exports = {
monorepo: {
mainVersionFile: 'lerna.json',
// We rely on Lerna to bump our dependencies.
packagesToBump: [],
packagesToPublish: packages.map(({ location }) =>
location.replace(cwd + '/', '')
),
},
publishCommand({ tag }) {
return `yarn publish --access public --tag ${tag}`;
},
versionUpdated({ exec, version }) {
// Update package dependencies
exec(
`yarn lerna version ${version} --exact --no-git-tag-version --no-push --yes`
);
// Ship.js reads JSON and writes with `fs.writeFileSync(JSON.stringify(json, null, 2))`
// which causes a lint error in the `lerna.json` file.
exec('yarn eslint lerna.json --fix');
},
// Skip preparation if it contains only `chore` commits
shouldPrepare({ releaseType, commitNumbersPerType }) {
const { fix = 0 } = commitNumbersPerType;
if (releaseType === 'patch' && fix === 0) {
return false;
}
return true;
},
};