This repository has been archived by the owner on Dec 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 386
/
Copy pathship.config.js
111 lines (107 loc) · 2.83 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
const fs = require('fs');
const path = require('path');
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}/`, '')
),
},
versionUpdated: ({ version, exec, dir }) => {
// Update version in `react-instantsearch-core`
fs.writeFileSync(
path.resolve(
dir,
'packages',
'react-instantsearch-core',
'src',
'core',
'version.js'
),
`export default '${version}';\n`
);
// Update version in `react-instantsearch-hooks`
fs.writeFileSync(
path.resolve(
dir,
'packages',
'react-instantsearch-hooks',
'src',
'version.ts'
),
`export default '${version}';\n`
);
// Update version in packages and dependencies
exec(
`yarn lerna version ${version} --exact --no-git-tag-version --no-push --yes`
);
// Update peerDependency in `react-instantsearch-dom-maps`
const file = path.resolve(
dir,
'packages',
'react-instantsearch-dom-maps',
'package.json'
);
const package = require(file);
package.peerDependencies['react-instantsearch-dom'] = `${version}`;
fs.writeFileSync(file, JSON.stringify(package, null, 2));
},
shouldPrepare: ({ releaseType, commitNumbersPerType }) => {
const { fix = 0 } = commitNumbersPerType;
if (releaseType === 'patch' && fix === 0) {
return false;
}
return true;
},
pullRequestTeamReviewers: ['frontend-experiences-web'],
buildCommand: ({ version }) =>
`NODE_ENV=production VERSION=${version} yarn build`,
slack: {
// disable slack notification for `prepared` lifecycle.
// Ship.js will send slack message only for `releaseSuccess`.
prepared: null,
releaseSuccess: ({
version,
tagName,
latestCommitHash,
latestCommitUrl,
repoURL,
}) => ({
pretext: [
`:tada: Successfully released *React InstantSearch v${version}*`,
'',
`Make sure to run \`yarn run release-templates\` in \`create-instantsearch-app\`.`,
].join('\n'),
fields: [
{
title: 'Branch',
value: 'master',
short: true,
},
{
title: 'Commit',
value: `*<${latestCommitUrl}|${latestCommitHash}>*`,
short: true,
},
{
title: 'Version',
value: version,
short: true,
},
{
title: 'Release',
value: `${repoURL}/releases/tag/${tagName}`,
},
],
}),
},
};