From 0278efbd6bb65b1fa222d9eaeb4227dc1e4d6605 Mon Sep 17 00:00:00 2001 From: develar Date: Mon, 27 Mar 2017 09:51:43 +0200 Subject: [PATCH] fix: removing devDependencies from package.json breaks levelup in electron Close #1408 --- .../electron-builder/src/fileTransformer.ts | 8 +- yarn.lock | 84 +++++++++---------- 2 files changed, 45 insertions(+), 47 deletions(-) diff --git a/packages/electron-builder/src/fileTransformer.ts b/packages/electron-builder/src/fileTransformer.ts index 0d4809f1336..e179cb8227e 100644 --- a/packages/electron-builder/src/fileTransformer.ts +++ b/packages/electron-builder/src/fileTransformer.ts @@ -25,7 +25,7 @@ export async function createTransformer(srcDir: string, extraMetadata: any): Pro } else if (file.endsWith("/package.json") && file.includes("/node_modules/")) { return readJson(file) - .then(it => cleanupPackageJson(it)) + .then(it => cleanupPackageJson(it, false)) .catch(e => warn(e)) } else { @@ -45,11 +45,11 @@ export function createElectronCompilerHost(projectDir: string, cacheDir: string) return require(path.join(electronCompilePath, "config-parser")).createCompilerHostFromProjectRoot(projectDir, cacheDir) } -function cleanupPackageJson(data: any): any { +function cleanupPackageJson(data: any, isMain: boolean): any { try { let changed = false for (const prop of Object.getOwnPropertyNames(data)) { - if (prop[0] === "_" || prop === "dist" || prop === "gitHead" || prop === "keywords" || prop === "build" || prop === "devDependencies" || prop === "scripts") { + if (prop[0] === "_" || prop === "dist" || prop === "gitHead" || prop === "keywords" || prop === "build" || (isMain && prop === "devDependencies") || prop === "scripts") { delete data[prop] changed = true } @@ -73,7 +73,7 @@ async function modifyMainPackageJson(file: string, extraMetadata: any) { } // https://github.com/electron-userland/electron-builder/issues/1212 - const serializedDataIfChanged = cleanupPackageJson(mainPackageData) + const serializedDataIfChanged = cleanupPackageJson(mainPackageData, true) if (serializedDataIfChanged != null) { return serializedDataIfChanged } diff --git a/yarn.lock b/yarn.lock index 30837c2c978..58e0a2d8352 100644 --- a/yarn.lock +++ b/yarn.lock @@ -98,8 +98,8 @@ ajv@^4.9.1: json-stable-stringify "^1.0.1" ajv@^5.0.4-beta.0: - version "5.0.4-beta.1" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.0.4-beta.1.tgz#a4bcf1c8654005fa97ec18bf794784224ca4c72a" + version "5.0.4-beta.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.0.4-beta.2.tgz#2b1dbc09cbd69ee0797489894ab38d12c914e121" dependencies: co "^4.6.0" json-stable-stringify "^1.0.1" @@ -253,13 +253,13 @@ assert-plus@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" -async@^1.4.0, async@^1.4.2: +async@^1.4.0: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" async@^2.0.0, async@^2.1.4: - version "2.1.5" - resolved "https://registry.yarnpkg.com/async/-/async-2.1.5.tgz#e587c68580994ac67fc56ff86d3ac56bdbe810bc" + version "2.2.0" + resolved "https://registry.yarnpkg.com/async/-/async-2.2.0.tgz#c324eba010a237e4fbd55a12dee86367d5c0ef32" dependencies: lodash "^4.14.0" @@ -1641,66 +1641,64 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" istanbul-api@^1.1.0-alpha.1: - version "1.1.6" - resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.1.6.tgz#23aa5b5b9b1b3bdbb786f039160e91acbe495433" + version "1.1.7" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.1.7.tgz#f6f37f09f8002b130f891c646b70ee4a8e7345ae" dependencies: async "^2.1.4" fileset "^2.0.2" - istanbul-lib-coverage "^1.0.0" - istanbul-lib-hook "^1.0.4" - istanbul-lib-instrument "^1.6.2" - istanbul-lib-report "^1.0.0-alpha.3" - istanbul-lib-source-maps "^1.1.0" - istanbul-reports "^1.0.0" + istanbul-lib-coverage "^1.0.2" + istanbul-lib-hook "^1.0.5" + istanbul-lib-instrument "^1.7.0" + istanbul-lib-report "^1.0.0" + istanbul-lib-source-maps "^1.1.1" + istanbul-reports "^1.0.2" js-yaml "^3.7.0" mkdirp "^0.5.1" once "^1.4.0" -istanbul-lib-coverage@^1.0.0, istanbul-lib-coverage@^1.0.0-alpha, istanbul-lib-coverage@^1.0.0-alpha.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.1.tgz#f263efb519c051c5f1f3343034fc40e7b43ff212" +istanbul-lib-coverage@^1.0.0, istanbul-lib-coverage@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz#87a0c015b6910651cb3b184814dfb339337e25e1" -istanbul-lib-hook@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.4.tgz#1919debbc195807880041971caf9c7e2be2144d6" +istanbul-lib-hook@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.5.tgz#6ca3d16d60c5f4082da39f7c5cd38ea8a772b88e" dependencies: append-transform "^0.4.0" -istanbul-lib-instrument@^1.1.1, istanbul-lib-instrument@^1.6.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.6.2.tgz#dac644f358f51efd6113536d7070959a0111f73b" +istanbul-lib-instrument@^1.1.1, istanbul-lib-instrument@^1.6.2, istanbul-lib-instrument@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.0.tgz#b8e0dc25709bb44e17336ab47b7bb5c97c23f659" dependencies: babel-generator "^6.18.0" babel-template "^6.16.0" babel-traverse "^6.18.0" babel-types "^6.18.0" babylon "^6.13.0" - istanbul-lib-coverage "^1.0.0" + istanbul-lib-coverage "^1.0.2" semver "^5.3.0" -istanbul-lib-report@^1.0.0-alpha.3: - version "1.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.0.0-alpha.3.tgz#32d5f6ec7f33ca3a602209e278b2e6ff143498af" +istanbul-lib-report@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.0.0.tgz#d83dac7f26566b521585569367fe84ccfc7aaecb" dependencies: - async "^1.4.2" - istanbul-lib-coverage "^1.0.0-alpha" + istanbul-lib-coverage "^1.0.2" mkdirp "^0.5.1" path-parse "^1.0.5" - rimraf "^2.4.3" supports-color "^3.1.2" -istanbul-lib-source-maps@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.1.0.tgz#9d429218f35b823560ea300a96ff0c3bbdab785f" +istanbul-lib-source-maps@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.1.1.tgz#f8c8c2e8f2160d1d91526d97e5bd63b2079af71c" dependencies: - istanbul-lib-coverage "^1.0.0-alpha.0" + istanbul-lib-coverage "^1.0.2" mkdirp "^0.5.1" rimraf "^2.4.4" source-map "^0.5.3" -istanbul-reports@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.0.1.tgz#9a17176bc4a6cbebdae52b2f15961d52fa623fbc" +istanbul-reports@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.0.2.tgz#4e8366abe6fa746cc1cd6633f108de12cc6ac6fa" dependencies: handlebars "^4.0.3" @@ -2079,10 +2077,10 @@ klaw@~1.3.0: graceful-fs "^4.1.9" latest-version@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.0.0.tgz#3104f008c0c391084107f85a344bc61e38970649" + version "3.1.0" + resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" dependencies: - package-json "^3.0.0" + package-json "^4.0.0" lazy-cache@^1.0.3: version "1.0.4" @@ -2436,9 +2434,9 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" -package-json@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/package-json/-/package-json-3.1.0.tgz#ce281900fe8052150cc6709c6c006c18fdb2f379" +package-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.0.tgz#f3c9dc8738f5b59304d54d2cfb3f91d08fdd7998" dependencies: got "^6.7.1" registry-auth-token "^3.0.1" @@ -2789,7 +2787,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@^2.4.3, rimraf@^2.4.4: +rimraf@^2.4.4: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: