Add npm-shrinkwrap.json file to control dependency updates

Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
This commit is contained in:
Paulo Castro 2019-06-26 14:32:47 +01:00
parent d5586e12d4
commit 7c6bae491f
4 changed files with 17828 additions and 15 deletions

1
.gitignore vendored
View File

@ -24,7 +24,6 @@ build/Release
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules node_modules
npm-shrinkwrap.json
package-lock.json package-lock.json
.resinconf .resinconf
.balenaconf .balenaconf

1
.npmrc
View File

@ -1 +0,0 @@
package-lock=false

17822
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ index a9d4276..75c2f8b 100644
exports.default = PackWin; exports.default = PackWin;
const scripts = { const scripts = {
diff --git a/node_modules/@oclif/dev-cli/lib/tarballs/build.js b/node_modules/@oclif/dev-cli/lib/tarballs/build.js diff --git a/node_modules/@oclif/dev-cli/lib/tarballs/build.js b/node_modules/@oclif/dev-cli/lib/tarballs/build.js
index 3e613e0..621d52b 100644 index 3e613e0..dd53603 100644
--- a/node_modules/@oclif/dev-cli/lib/tarballs/build.js --- a/node_modules/@oclif/dev-cli/lib/tarballs/build.js
+++ b/node_modules/@oclif/dev-cli/lib/tarballs/build.js +++ b/node_modules/@oclif/dev-cli/lib/tarballs/build.js
@@ -19,6 +19,9 @@ const pack = async (from, to) => { @@ -19,6 +19,9 @@ const pack = async (from, to) => {
@ -49,7 +49,7 @@ index 3e613e0..621d52b 100644
const packCLI = async () => { const packCLI = async () => {
const stdout = await qq.x.stdout('npm', ['pack', '--unsafe-perm'], { cwd: c.root }); const stdout = await qq.x.stdout('npm', ['pack', '--unsafe-perm'], { cwd: c.root });
return path.join(c.root, stdout.split('\n').pop()); return path.join(c.root, stdout.split('\n').pop());
@@ -34,6 +37,30 @@ async function build(c, options = {}) { @@ -34,6 +37,23 @@ async function build(c, options = {}) {
await qq.mv(f, '.'); await qq.mv(f, '.');
await qq.rm('package', tarball, 'bin/run.cmd'); await qq.rm('package', tarball, 'bin/run.cmd');
}; };
@ -59,19 +59,12 @@ index 3e613e0..621d52b 100644
+ qq.cd(ws); + qq.cd(ws);
+ const sources = [ + const sources = [
+ 'bin', 'build', 'patches', 'typings', 'CHANGELOG.md', 'INSTALL.md', + 'bin', 'build', 'patches', 'typings', 'CHANGELOG.md', 'INSTALL.md',
+ 'LICENSE', 'package.json', 'package-lock.json', 'README.md', + 'LICENSE', 'package.json', 'npm-shrinkwrap.json', 'README.md',
+ 'TROUBLESHOOTING.md', + 'TROUBLESHOOTING.md',
+ ]; + ];
+ for (const source of sources) { + for (const source of sources) {
+ console.log(`cp "${source}" -> "${ws}"`); + console.log(`cp "${source}" -> "${ws}"`);
+ try { + await qq.cp(path.join(c.root, source), ws);
+ await qq.cp(path.join(c.root, source), ws);
+ } catch (err) {
+ // OK if package-lock.json doesn't exist
+ if (source !== 'package-lock.json') {
+ throw err;
+ }
+ }
+ } + }
+ // rename the original balena-cli ./bin/balena entry point for oclif compatibility + // rename the original balena-cli ./bin/balena entry point for oclif compatibility
+ await qq.mv('bin/balena', 'bin/run'); + await qq.mv('bin/balena', 'bin/run');
@ -80,7 +73,7 @@ index 3e613e0..621d52b 100644
const updatePJSON = async () => { const updatePJSON = async () => {
qq.cd(c.workspace()); qq.cd(c.workspace());
const pjson = await qq.readJSON('package.json'); const pjson = await qq.readJSON('package.json');
@@ -55,7 +82,11 @@ async function build(c, options = {}) { @@ -55,7 +75,11 @@ async function build(c, options = {}) {
if (!await qq.exists(lockpath)) { if (!await qq.exists(lockpath)) {
lockpath = qq.join(c.root, 'npm-shrinkwrap.json'); lockpath = qq.join(c.root, 'npm-shrinkwrap.json');
} }
@ -93,7 +86,7 @@ index 3e613e0..621d52b 100644
await qq.x('npm install --production'); await qq.x('npm install --production');
} }
}; };
@@ -124,7 +155,8 @@ async function build(c, options = {}) { @@ -124,7 +148,8 @@ async function build(c, options = {}) {
await qq.writeJSON(c.dist(config.s3Key('manifest')), manifest); await qq.writeJSON(c.dist(config.s3Key('manifest')), manifest);
}; };
log_1.log(`gathering workspace for ${config.bin} to ${c.workspace()}`); log_1.log(`gathering workspace for ${config.bin} to ${c.workspace()}`);