|
|
|
@ -1,6 +1,7 @@ |
|
|
|
// ESM syntax is supported.
|
|
|
|
import execa from 'execa'; |
|
|
|
import fse from 'fs-extra'; |
|
|
|
import program from 'commander'; |
|
|
|
|
|
|
|
(async () => { |
|
|
|
const { projects } = await fse.readJSON('../angular.json'); |
|
|
|
@ -8,13 +9,23 @@ import fse from 'fs-extra'; |
|
|
|
|
|
|
|
const packageJson = await fse.readJSON('../package.json'); |
|
|
|
|
|
|
|
program.option('-c, --noCommit', 'skip commit process', false); |
|
|
|
|
|
|
|
program.parse(process.argv); |
|
|
|
|
|
|
|
let npmPackageNames = []; |
|
|
|
projectNames.forEach(project => { |
|
|
|
// do not convert to async
|
|
|
|
const { name, dependencies = {}, peerDependencies = {} } = fse.readJSONSync(`../packages/${project}/package.json`); |
|
|
|
const { name, dependencies = {}, peerDependencies = {} } = fse.readJSONSync( |
|
|
|
`../packages/${project}/package.json`, |
|
|
|
); |
|
|
|
npmPackageNames.push(name); |
|
|
|
|
|
|
|
packageJson.devDependencies = { ...packageJson.devDependencies, ...dependencies, ...peerDependencies }; |
|
|
|
packageJson.devDependencies = { |
|
|
|
...packageJson.devDependencies, |
|
|
|
...dependencies, |
|
|
|
...peerDependencies, |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
await fse.writeJSON('../package.json', packageJson, { spaces: 2 }); |
|
|
|
@ -30,14 +41,20 @@ import fse from 'fs-extra'; |
|
|
|
|
|
|
|
npmPackageNames.forEach(name => { |
|
|
|
// do not convert to async
|
|
|
|
execa.sync('yarn', ['symlink', 'copy', '--angular', '--packages', name, '--no-watch', '--sync-build'], { |
|
|
|
stdout: 'inherit', |
|
|
|
cwd: '../', |
|
|
|
}); |
|
|
|
execa.sync( |
|
|
|
'yarn', |
|
|
|
['symlink', 'copy', '--angular', '--packages', name, '--no-watch', '--sync-build'], |
|
|
|
{ |
|
|
|
stdout: 'inherit', |
|
|
|
cwd: '../', |
|
|
|
}, |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
await execa('git', ['add', '../dist/*', '../package.json'], { stdout: 'inherit' }); |
|
|
|
await execa('git', ['commit', '-m', 'Build ng packages', '--no-verify'], { stdout: 'inherit' }); |
|
|
|
if (!program.noCommit) { |
|
|
|
await execa('git', ['add', '../dist/*', '../package.json'], { stdout: 'inherit' }); |
|
|
|
await execa('git', ['commit', '-m', 'Build ng packages', '--no-verify'], { stdout: 'inherit' }); |
|
|
|
} |
|
|
|
|
|
|
|
process.exit(0); |
|
|
|
})(); |
|
|
|
|