Skip to content

Commit

Permalink
fix: do not strip "bugs" field from main package.json
Browse files Browse the repository at this point in the history
Close #2606
  • Loading branch information
develar committed Feb 20, 2018
1 parent ba2957e commit 58933e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/electron-builder-lib/src/fileTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function createElectronCompilerHost(projectDir: string, cacheDir: string)
return require(path.join(electronCompilePath, "config-parser")).createCompilerHostFromProjectRoot(projectDir, cacheDir)
}

const ignoredPackageMetadataProperties = new Set(["dist", "gitHead", "keywords", "build", "jspm", "ava", "xo", "nyc", "eslintConfig", "contributors", "bundleDependencies", "bugs", "tags"])
const ignoredPackageMetadataProperties = new Set(["dist", "gitHead", "keywords", "build", "jspm", "ava", "xo", "nyc", "eslintConfig", "contributors", "bundleDependencies", "tags"])

interface CleanupPackageFileOptions {
readonly isRemovePackageScripts: boolean
Expand All @@ -74,7 +74,9 @@ function cleanupPackageJson(data: any, options: CleanupPackageFileOptions): any
if (prop[0] === "_" ||
ignoredPackageMetadataProperties.has(prop) ||
(options.isRemovePackageScripts && prop === "scripts") ||
(options.isMain && prop === "devDependencies") || (isRemoveBabel && prop === "babel")) {
(options.isMain && prop === "devDependencies") ||
(!options.isMain && prop === "bugs") ||
(isRemoveBabel && prop === "babel")) {
delete data[prop]
changed = true
}
Expand Down
8 changes: 8 additions & 0 deletions test/out/windows/__snapshots__/webInstallerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ Object {
"packages": Object {
"ia32": Object {
"blockMapSize": "@blockMapSize",
"file": "TestApp-1.1.0-ia32.nsis.7z",
"path": "TestApp-1.1.0-ia32.nsis.7z",
"sha512": "@sha512",
"size": "@size",
},
"x64": Object {
"blockMapSize": "@blockMapSize",
"file": "TestApp-1.1.0-x64.nsis.7z",
"path": "TestApp-1.1.0-x64.nsis.7z",
"sha512": "@sha512",
"size": "@size",
Expand All @@ -40,12 +42,14 @@ Object {
"packages": Object {
"ia32": Object {
"blockMapSize": "@blockMapSize",
"file": "TestApp-1.1.0-ia32.nsis.7z",
"path": "TestApp-1.1.0-ia32.nsis.7z",
"sha512": "@sha512",
"size": "@size",
},
"x64": Object {
"blockMapSize": "@blockMapSize",
"file": "TestApp-1.1.0-x64.nsis.7z",
"path": "TestApp-1.1.0-x64.nsis.7z",
"sha512": "@sha512",
"size": "@size",
Expand Down Expand Up @@ -80,6 +84,7 @@ Object {
"packages": Object {
"x64": Object {
"blockMapSize": "@blockMapSize",
"file": "TestApp-1.1.0-x64.nsis.7z",
"path": "TestApp-1.1.0-x64.nsis.7z",
"sha512": "@sha512",
"size": "@size",
Expand All @@ -100,6 +105,7 @@ Object {
"packages": Object {
"x64": Object {
"blockMapSize": "@blockMapSize",
"file": "TestApp-1.1.0-x64.nsis.7z",
"path": "TestApp-1.1.0-x64.nsis.7z",
"sha512": "@sha512",
"size": "@size",
Expand Down Expand Up @@ -130,6 +136,7 @@ Object {
"packages": Object {
"x64": Object {
"blockMapSize": "@blockMapSize",
"file": "TestApp-1.1.0-x64.nsis.7z",
"path": "TestApp-1.1.0-x64.nsis.7z",
"sha512": "@sha512",
"size": "@size",
Expand All @@ -154,6 +161,7 @@ Object {
"packages": Object {
"x64": Object {
"blockMapSize": "@blockMapSize",
"file": "TestApp-1.1.0-x64.nsis.7z",
"path": "TestApp-1.1.0-x64.nsis.7z",
"sha512": "@sha512",
"size": "@size",
Expand Down

0 comments on commit 58933e0

Please sign in to comment.