mirror of
https://github.com/strapi/strapi.git
synced 2025-07-04 07:27:23 +00:00
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
try {
|
|
const pkgJSON = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), 'package.json'), 'utf8'));
|
|
const packages = fs.readdirSync(path.resolve(process.cwd(),'packages'), 'utf8');
|
|
|
|
packages.filter(pkg => pkg.indexOf('strapi') !== -1).forEach(pkg => {
|
|
const packageJSON = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), 'packages', pkg, 'package.json'), 'utf8'));
|
|
|
|
packageJSON.version = pkgJSON.version;
|
|
|
|
Object.keys(packageJSON.dependencies).filter(dependency => dependency.indexOf('strapi-') !== -1).forEach(dependency => {
|
|
packageJSON.dependencies[dependency] = pkgJSON.version;
|
|
});
|
|
|
|
if (packageJSON.devDependencies) {
|
|
Object.keys(packageJSON.devDependencies).filter(devDependency => devDependency.indexOf('strapi-') !== -1).forEach(devDependency => {
|
|
packageJSON.devDependencies[devDependency] = pkgJSON.version;
|
|
});
|
|
}
|
|
|
|
fs.writeFileSync(path.resolve(process.cwd(), 'packages', pkg, 'package.json'), JSON.stringify(packageJSON, null, 2), 'utf8');
|
|
});
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|