mirror of
https://github.com/appium/appium.git
synced 2026-05-21 19:38:52 -05:00
Check that pruned shrinkwrap has same dependencies as unpruned shrinkwrap (#13053)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
const _ = require('lodash');
|
||||
const { asyncify } = require('asyncbox');
|
||||
const { fs, logger } = require('appium-support');
|
||||
const path = require('path');
|
||||
|
||||
const log = new logger.getLogger('ShrinkwrapValidator');
|
||||
|
||||
async function main () {
|
||||
const backupShrinkwrap = JSON.parse(await fs.readFile(path.resolve('npm-shrinkwrap-backup.json')));
|
||||
const shrinkwrap = JSON.parse(await fs.readFile(path.resolve('npm-shrinkwrap.json')));
|
||||
log.info('Checking that pruned shrinkwrap is a subset of primary shrinkwrap');
|
||||
if (!_.isMatch(backupShrinkwrap, shrinkwrap)) {
|
||||
log.errorAndThrow('Pruned shrinkwrap (shrinkwrap with dev dependencies removed) is not a subset of the original npm-shrinkwrap.json');
|
||||
}
|
||||
log.info('Shrinkwrap check passed');
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
asyncify(main);
|
||||
}
|
||||
+4
-2
@@ -77,8 +77,10 @@
|
||||
"prepare": "gulp prepublish",
|
||||
"prepublishOnly": "npm run prune-shrinkwrap && gulp fixShrinkwrap",
|
||||
"postpublish": "npm run restore-shrinkwrap",
|
||||
"prune-shrinkwrap": "!(test -e npm-shrinkwrap.json) || (npm ci --production --ignore-scripts && npm shrinkwrap && npm install --only=dev --no-shrinkwrap)",
|
||||
"restore-shrinkwrap": "git checkout HEAD -- npm-shrinkwrap.json",
|
||||
"prune-shrinkwrap": "!(test -e npm-shrinkwrap.json) || (npm ci --production --ignore-scripts && npm run backup-shrinkwrap && npm shrinkwrap && npm install --only=dev --no-shrinkwrap) && npm run check-pruned-shrinkwrap",
|
||||
"restore-shrinkwrap": "mv npm-shrinkwrap-backup.json npm-shrinkwrap.json",
|
||||
"backup-shrinkwrap": "mv npm-shrinkwrap.json npm-shrinkwrap-backup.json",
|
||||
"check-pruned-shrinkwrap": "node check-pruned-shrinkwrap.js",
|
||||
"test": "gulp once",
|
||||
"e2e-test": "gulp e2e-test",
|
||||
"watch": "gulp watch",
|
||||
|
||||
Reference in New Issue
Block a user