2020-04-20 20:58:02 +03:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
|
2020-04-17 02:23:44 +03:00
|
|
|
module.exports = {
|
|
|
|
disallowedChangeTypes: ['major'],
|
|
|
|
hooks: {
|
2020-04-20 20:58:02 +03:00
|
|
|
prepublish: packagePath => {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|