1
0
Fork 0
docsearch/ship.config.js
renovate[bot] 10c5b2ea14
chore(deps): update lint dependency (#1120)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
2021-11-02 12:06:22 +01:00

46 lines
1.3 KiB
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs');
const path = require('path');
const packages = [
'packages/docsearch-css',
'packages/docsearch-react',
'packages/docsearch-js',
];
module.exports = {
monorepo: {
mainVersionFile: 'lerna.json',
// We rely on Lerna to bump our dependencies.
packagesToBump: [],
packagesToPublish: packages,
},
publishCommand({ tag }) {
return `yarn publish --access public --tag ${tag}`;
},
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');
fs.writeFileSync(
path.resolve(dir, 'packages', 'docsearch-react', 'src', 'version.ts'),
`export const version = '${version}';\n`
);
},
// Skip preparation if it contains only `chore` commits
shouldPrepare: ({ releaseType, commitNumbersPerType }) => {
const { fix = 0 } = commitNumbersPerType;
if (releaseType === 'patch' && fix === 0) {
return false;
}
return true;
},
};