From 3778ac26aab0803110a59e00ad9bdd1dcd3781df Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 1 Jan 2016 22:53:11 -0800 Subject: [PATCH] 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. --- tools/npm/copy-npm-shrinkwrap | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/npm/copy-npm-shrinkwrap b/tools/npm/copy-npm-shrinkwrap index 65d915bb9d..cbc722c199 100755 --- a/tools/npm/copy-npm-shrinkwrap +++ b/tools/npm/copy-npm-shrinkwrap @@ -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.`); +}