2020-04-20 20:58:02 +03:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
2022-10-25 18:08:11 +03:00
|
|
|
const execSync = require('child_process').execSync;
|
2020-04-20 20:58:02 +03:00
|
|
|
|
2020-04-17 02:23:44 +03:00
|
|
|
module.exports = {
|
|
|
|
disallowedChangeTypes: ['major'],
|
|
|
|
hooks: {
|
2021-10-16 00:04:06 +03:00
|
|
|
prepublish: (packagePath) => {
|
2020-04-20 20:58:02 +03:00
|
|
|
const packageJsonPath = path.join(packagePath, 'package.json');
|
|
|
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
|
|
if (packageJson.onPublish) {
|
|
|
|
Object.assign(packageJson, packageJson.onPublish);
|
|
|
|
delete packageJson.onPublish;
|
|
|
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
|
2020-04-17 02:23:44 +03:00
|
|
|
}
|
2021-10-16 00:04:06 +03:00
|
|
|
},
|
2022-10-24 19:47:10 +03:00
|
|
|
postbump: (packagePath, name) => {
|
|
|
|
if (name === '@fluentui-react-native/dependency-profiles') {
|
|
|
|
console.log(`Updating ${name} to use latest published versions`);
|
|
|
|
execSync(`yarn update-profile`, { cwd: packagePath });
|
2023-08-15 00:45:27 +03:00
|
|
|
// This logic is run after all bumps have happened,
|
|
|
|
// so it's ok that it's only run once
|
|
|
|
console.log('Updating lockfile');
|
|
|
|
execSync(`yarn install --mode update-lockfile`);
|
2022-10-24 19:47:10 +03:00
|
|
|
}
|
|
|
|
},
|
2021-10-16 00:04:06 +03:00
|
|
|
},
|
|
|
|
changelog: {
|
|
|
|
groups: [
|
|
|
|
{
|
|
|
|
masterPackageName: '@fluentui/react-native',
|
|
|
|
include: getPackagesToInclude(),
|
|
|
|
changelogPath: path.resolve('packages/libraries/core/'),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-04-17 02:23:44 +03:00
|
|
|
};
|
2021-10-16 00:04:06 +03:00
|
|
|
|
|
|
|
function getPackagesToInclude() {
|
|
|
|
const content = fs.readFileSync(path.resolve('packages/libraries/core/src/index.ts'), 'utf8');
|
|
|
|
const matches = Array.from(content.matchAll(new RegExp("'(@.*)'", 'g')), (m) => m[1]);
|
|
|
|
return matches;
|
|
|
|
}
|