-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: provide tools to validate release and prevent missing packages
Signed-off-by: Bozhidar Dryanovski <bozhidar.dryanovski@gmail.com>
- Loading branch information
1 parent
1b696bb
commit d724a90
Showing
2 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const { spawn } = require('child_process'); | ||
|
||
const packageJson = require('../package.json'); | ||
const packages = ['@cds/angular', '@cds/core', '@cds/react', '@clr/eslint-plugin-clarity-adoption']; | ||
|
||
console.log(`\nVerify that all packages are at the latest version and could be installed from NPM Registry.\n`); | ||
|
||
Promise.all( | ||
packages.map(package => { | ||
const pkg = `${package}@${packageJson.version}`; | ||
|
||
return new Promise((resolve, reject) => { | ||
const npm = spawn('npm', ['install', `${pkg}`, '--dry-run']); | ||
|
||
console.log(`\tChecking ${pkg} ...`); | ||
|
||
npm.on('close', code => { | ||
if (code !== 0) { | ||
reject([pkg, 'npm install failed']); | ||
} else { | ||
resolve([pkg, 'npm install succeeded']); | ||
} | ||
}); | ||
}); | ||
}) | ||
) | ||
.then(result => { | ||
console.log(`\n`); | ||
result.forEach(res => { | ||
console.log(`\tOK : ${res[0]}`); | ||
}); | ||
console.log('\n✅ Verification successful.'); | ||
}) | ||
.catch(error => { | ||
if (error && Array.isArray(error)) { | ||
console.log('\n\nOne or more packages failed verification.\n'); | ||
console.log(`\tPackage: ${error[0]} was not found into NPM Registry`); | ||
} | ||
console.log('\n❌ Verification failed.'); | ||
process.exit(1); | ||
}) | ||
.then(() => { | ||
process.exit(0); | ||
}); |