strapi/scripts/removeSymlinkDependencies.js
Alberto Maturano 154fc28a57 Normalize to standar file permissions
As a result of taking a look on PR #1967 I realized there is 819
executable files in this repository. It is obvious this is an error.
2018-09-24 12:33:09 -05:00

30 lines
1.2 KiB
JavaScript

const fs = require('fs');
const path = require('path');
let currentPackage;
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 => {
currentPackage = 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(currentPackage, error);
}