-
Notifications
You must be signed in to change notification settings - Fork 331
/
ship.config.js
71 lines (65 loc) · 2.01 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const fs = require('fs');
const path = require('path');
module.exports = {
monorepo: {
mainVersionFile: 'lerna.json',
// We rely on Lerna to bump our dependencies.
packagesToBump: [],
packagesToPublish: [
'packages/autocomplete-core',
'packages/autocomplete-js',
'packages/autocomplete-plugin-algolia-insights',
'packages/autocomplete-plugin-query-suggestions',
'packages/autocomplete-plugin-recent-searches',
'packages/autocomplete-plugin-redirect-url',
'packages/autocomplete-plugin-tags',
'packages/autocomplete-preset-algolia',
'packages/autocomplete-shared',
'packages/autocomplete-theme-classic',
],
},
publishCommand({ tag }) {
return `yarn publish --access public --tag ${tag}`;
},
pullRequestTeamReviewers: ['frontend-experiences-web'],
versionUpdated({ exec, dir, 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');
// Update version files
updatePackagesVersionFile({
version,
files: [
path.resolve(
dir,
'packages',
'autocomplete-shared',
'src',
'version.ts'
),
],
});
},
// Skip preparation if it contains only `chore` commits
shouldPrepare({ releaseType, commitNumbersPerType }) {
const { fix = 0 } = commitNumbersPerType;
if (releaseType === 'patch' && fix === 0) {
return false;
}
return true;
},
slack: {
// disable slack notification for `prepared` lifecycle.
// Ship.js will send slack message only for `releaseSuccess`.
prepared: null,
},
};
function updatePackagesVersionFile({ version, files }) {
for (const file of files) {
fs.writeFileSync(file, `export const version = '${version}';\n`);
}
}