mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
5 years ago
|
import execa from 'execa';
|
||
|
import fse from 'fs-extra';
|
||
|
|
||
5 years ago
|
const updateAndInstall = async () => {
|
||
5 years ago
|
const { projects } = await fse.readJSON('../angular.json');
|
||
|
const projectNames = Object.keys(projects).filter(project => project !== 'dev-app');
|
||
|
|
||
|
const packageJson = await fse.readJSON('../package.json');
|
||
|
|
||
|
projectNames.forEach(project => {
|
||
|
// do not convert to async
|
||
5 years ago
|
const { dependencies = {}, peerDependencies = {}, name, version } = fse.readJSONSync(
|
||
5 years ago
|
`../packages/${project}/package.json`,
|
||
|
);
|
||
|
|
||
|
packageJson.devDependencies = {
|
||
|
...packageJson.devDependencies,
|
||
|
...dependencies,
|
||
|
...peerDependencies,
|
||
5 years ago
|
...{ [name]: `^${version}` },
|
||
5 years ago
|
};
|
||
5 years ago
|
|
||
|
packageJson.devDependencies = Object.keys(packageJson.devDependencies)
|
||
|
.sort()
|
||
|
.reduce((acc, key) => ({ ...acc, [key]: packageJson.devDependencies[key] }), {});
|
||
5 years ago
|
});
|
||
|
|
||
|
await fse.writeJSON('../package.json', packageJson, { spaces: 2 });
|
||
|
|
||
|
try {
|
||
|
await execa('yarn', ['install', '--ignore-scripts'], {
|
||
|
stdout: 'inherit',
|
||
|
cwd: '../',
|
||
|
});
|
||
|
} catch (error) {
|
||
|
console.error(error.stderr);
|
||
|
process.exit(1);
|
||
|
}
|
||
|
|
||
|
process.exit(0);
|
||
5 years ago
|
};
|
||
|
|
||
|
updateAndInstall();
|
||
|
|
||
|
export default updateAndInstall;
|