build(tools): npm/copy-npm-shrinkwrap should gracefully handle situation when shrinkwrap file is missing

This situation occurs during mas update of all dependencies, so we should not throw errors when this happens.
This commit is contained in:
Igor Minar 2016-01-01 22:53:11 -08:00 committed by Igor Minar
parent 6cfc6f5bb2
commit 3778ac26aa
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env node
var fs = require('fs');
var fse = require('fs-extra');
var path = require('path');
@ -9,4 +10,8 @@ var PROJECT_ROOT = path.join(__dirname, '../../');
process.chdir(PROJECT_ROOT);
fse.copySync(NPM_SHRINKWRAP_FILE, NPM_SHRINKWRAP_CACHED_FILE);
if (fs.existsSync(NPM_SHRINKWRAP_FILE)) {
fse.copySync(NPM_SHRINKWRAP_FILE, NPM_SHRINKWRAP_CACHED_FILE);
} else {
console.warn(`${NPM_SHRINKWRAP_FILE} not found. Copy operation will be skipped.`);
}