Skip to content

Commit

Permalink
fix: ignore files in the node_modules during read_installed
Browse files Browse the repository at this point in the history
Close #1424
  • Loading branch information
develar committed Apr 1, 2017
1 parent 9b60518 commit 37f84b9
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 201 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
osx_image: xcode8.3

matrix:
include:
- os: osx
Expand Down
45 changes: 25 additions & 20 deletions docs/Developer API.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ AppX Options
| --- | --- |
| **packager**| <code>[PlatformPackager](Developer-API#PlatformPackager)&lt;any&gt;</code> |
| target| <code>[Target](Developer-API#Target)</code> \| <code>null</code> |
| arch| <code>[Arch](Developer-API#Arch)</code> \| <code>null</code> |
| file| <code>string</code> |
| data| <code>Buffer</code> |
| safeArtifactName| <code>string</code> |
Expand Down Expand Up @@ -260,7 +261,7 @@ Configuration Options
| nodeGypRebuild| <code>boolean</code> | <a name="Config-nodeGypRebuild"></a>Whether to execute `node-gyp rebuild` before starting to package the app. |
| electronDist| <code>string</code> | <a name="Config-electronDist"></a>The path to custom Electron build (e.g. `~/electron/out/R`). Only macOS supported, file issue if need for Linux or Windows. |
| electronDownload| <code>any</code> | <a name="Config-electronDownload"></a>The [electron-download](https://github.com/electron-userland/electron-download#usage) options. |
| publish| <code>null</code> \| <code>string</code> \| <code>[GithubOptions](Publishing-Artifacts#GithubOptions)</code> \| <code>[S3Options](Publishing-Artifacts#S3Options)</code> \| <code>[GenericServerOptions](Publishing-Artifacts#GenericServerOptions)</code> \| <code>[BintrayOptions](Publishing-Artifacts#BintrayOptions)</code> \| <code>Array</code> | <a name="Config-publish"></a>Array of option objects. Order is important — first item will be used as a default auto-update server on Windows (NSIS). See: [Publish options](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#publish-options). |
| publish| <code>null</code> \| <code>string</code> \| <code>[GithubOptions](Publishing-Artifacts#GithubOptions)</code> \| <code>[S3Options](Publishing-Artifacts#S3Options)</code> \| <code>[GenericServerOptions](Publishing-Artifacts#GenericServerOptions)</code> \| <code>[BintrayOptions](Publishing-Artifacts#BintrayOptions)</code> \| <code>Array</code> | <a name="Config-publish"></a>Array of option objects. Order is important — first item will be used as a default auto-update server. See: [Publish options](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#publish-options). |
| forceCodeSigning| <code>boolean</code> | <a name="Config-forceCodeSigning"></a>Whether to fail if application will be not signed (to prevent unsigned app if code signing configuration is not correct). |
| directories| <code>[MetadataDirectories](Developer-API#MetadataDirectories)</code> \| <code>null</code> | <a name="Config-directories"></a> |
| electronVersion| <code>string</code> \| <code>null</code> | <a name="Config-electronVersion"></a>The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency. |
Expand Down Expand Up @@ -302,6 +303,7 @@ Debian Package Specific Options
| synopsis| <code>string</code> \| <code>null</code> | <a name="DebOptions-synopsis"></a>The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). |
| compression = <code>xz</code>| <code>"gz"</code> \| <code>"bzip2"</code> \| <code>"xz"</code> \| <code>null</code> | <a name="DebOptions-compression"></a>The compression type. |
| priority| <code>string</code> \| <code>null</code> | <a name="DebOptions-priority"></a>The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute. |
| depends| <code>Array&lt;string&gt;</code> \| <code>null</code> | <a name="DebOptions-depends"></a>Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]`. |

<a name="DmgContent"></a>

Expand Down Expand Up @@ -390,7 +392,7 @@ Linux Options
| desktop| <code>Object&lt;string, any&gt;</code> \| <code>null</code> | <a name="LinuxBuildOptions-desktop"></a>The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value). |
| afterInstall| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-afterInstall"></a> |
| afterRemove| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-afterRemove"></a> |
| depends| <code>Array&lt;string&gt;</code> \| <code>null</code> | <a name="LinuxBuildOptions-depends"></a>Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]` for `deb`. |
| depends| <code>Array&lt;string&gt;</code> \| <code>null</code> | <a name="LinuxBuildOptions-depends"></a>Package dependencies. Consider to specify in the target options (e.g. in the `deb` or `rpm`). |
| executableName| <code>string</code> \| <code>null</code> | <a name="LinuxBuildOptions-executableName"></a>The executable name. Defaults to `productName`. Cannot be specified per target, allowed only in the `linux`. |
| icon| <code>string</code> | <a name="LinuxBuildOptions-icon"></a>The path to icon set directory, relative to the the [build resources](https://github.com/electron-userland/electron-builder/wiki/Options#MetadataDirectories-buildResources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon. By default will be generated automatically based on the macOS icns file. |

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ajv": "^5.0.4-beta.2",
"ajv-keywords": "^2.0.1-beta.2",
"archiver": "^1.3.0",
"aws-sdk": "^2.34.0",
"aws-sdk": "^2.36.0",
"bluebird-lst": "^1.0.2",
"chalk": "^1.1.3",
"chromium-pickle-js": "^0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"isbinaryfile": "^3.0.2",
"js-yaml": "^3.8.2",
"minimatch": "^3.0.3",
"node-forge": "^0.7.0",
"node-forge": "^0.7.1",
"normalize-package-data": "^2.3.6",
"parse-color": "^1.0.0",
"plist": "^2.0.1",
Expand Down
7 changes: 6 additions & 1 deletion packages/electron-builder/src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
readonly afterRemove?: string | null

/**
* Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]` for `deb`.
* Package dependencies. Consider to specify in the target options (e.g. in the `deb` or `rpm`).
*/
readonly depends?: string[] | null

Expand Down Expand Up @@ -90,6 +90,11 @@ export interface DebOptions extends LinuxBuildOptions {
* The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.
*/
readonly priority?: string | null

/**
* Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]`.
*/
readonly depends?: string[] | null
}

/**
Expand Down
18 changes: 16 additions & 2 deletions packages/electron-builder/src/readInstalled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,24 @@ async function _readInstalled(folder: string, parent: any | null, name: string |
return obj
}

const deps = await BluebirdPromise.map(await readScopedDir(path.join(folder, "node_modules")), pkg => _readInstalled(path.join(folder, "node_modules", pkg), obj, pkg, depth + 1, opts, realpathSeen, findUnmetSeen), {concurrency: 8})
const deps = await BluebirdPromise.map(await readScopedDir(path.join(folder, "node_modules")), async pkg => {
try {
return await _readInstalled(path.join(folder, "node_modules", pkg), obj, pkg, depth + 1, opts, realpathSeen, findUnmetSeen)
}
catch (e) {
// https://github.com/electron-userland/electron-builder/issues/1424
if (e.code === "ENOENT" || e.code === "ENOTDIR") {
return null
}

throw e
}
}, {concurrency: 8})
if (obj.dependencies != null) {
for (const dep of deps) {
obj.dependencies[dep.realName] = dep
if (dep != null) {
obj.dependencies[dep.realName] = dep
}
}

// any strings in the obj.dependencies are unmet deps. However, if it's optional, then that's fine, so just delete it.
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.1.0",
"aws-sdk": "^2.32.0",
"aws-sdk": "^2.36.0",
"mime": "^1.3.4",
"electron-publish": "~0.0.0-semantic-release",
"electron-builder-util": "~0.0.0-semantic-release"
Expand Down
53 changes: 2 additions & 51 deletions test/out/__snapshots__/ExtraBuildTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -63,63 +63,14 @@ exports[`scheme validation 1`] = `
},
\\"Invalid option object\\"
]
}
Raw validation errors: [
{
\\"keyword\\": \\"additionalProperties\\",
\\"dataPath\\": \\"\\",
\\"schemaPath\\": \\"#/additionalProperties\\",
\\"params\\": {
\\"additionalProperty\\": \\"foo\\"
},
\\"message\\": \\"should NOT have additional properties\\"
},
{
\\"keyword\\": \\"additionalProperties\\",
\\"dataPath\\": \\".mac\\",
\\"schemaPath\\": \\"#/additionalProperties\\",
\\"params\\": {
\\"additionalProperty\\": \\"foo\\"
},
\\"message\\": \\"should NOT have additional properties\\"
},
{
\\"keyword\\": \\"type\\",
\\"dataPath\\": \\".mac\\",
\\"schemaPath\\": \\"#/properties/mac/anyOf/1/type\\",
\\"params\\": {
\\"type\\": \\"null\\"
},
\\"message\\": \\"should be null\\"
},
{
\\"keyword\\": \\"anyOf\\",
\\"dataPath\\": \\".mac\\",
\\"schemaPath\\": \\"#/properties/mac/anyOf\\",
\\"params\\": {},
\\"message\\": \\"should match some schema in anyOf\\"
}
]"
}"
`;

exports[`scheme validation 2 1`] = `
"Config is invalid:
{
\\"appId\\": \\"Should be null,string\\"
}
Raw validation errors: [
{
\\"keyword\\": \\"type\\",
\\"dataPath\\": \\".appId\\",
\\"schemaPath\\": \\"#/properties/appId/type\\",
\\"params\\": {
\\"type\\": \\"null,string\\"
},
\\"message\\": \\"should be null,string\\"
}
]"
}"
`;

exports[`scheme validation extraFiles 1`] = `
Expand Down
113 changes: 1 addition & 112 deletions test/out/mac/__snapshots__/macArchiveTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,118 +19,7 @@ exports[`invalid target 1`] = `
},
\\"Invalid option object\\"
]
}
Raw validation errors: [
{
\\"keyword\\": \\"type\\",
\\"dataPath\\": \\".mac.target\\",
\\"schemaPath\\": \\"#/definitions/TargetConfig/type\\",
\\"params\\": {
\\"type\\": \\"object\\"
},
\\"message\\": \\"should be object\\"
},
{
\\"keyword\\": \\"type\\",
\\"dataPath\\": \\".mac.target[0]\\",
\\"schemaPath\\": \\"#/definitions/TargetConfig/type\\",
\\"params\\": {
\\"type\\": \\"object\\"
},
\\"message\\": \\"should be object\\"
},
{
\\"keyword\\": \\"enum\\",
\\"dataPath\\": \\".mac.target[0]\\",
\\"schemaPath\\": \\"#/properties/target/anyOf/1/items/anyOf/1/enum\\",
\\"params\\": {
\\"allowedValues\\": [
\\"7z\\",
\\"default\\",
\\"dir\\",
\\"dmg\\",
\\"mas\\",
\\"pkg\\",
\\"tar.bz2\\",
\\"tar.gz\\",
\\"tar.lz\\",
\\"tar.xz\\",
\\"zip\\"
]
},
\\"message\\": \\"should be equal to one of the allowed values\\"
},
{
\\"keyword\\": \\"anyOf\\",
\\"dataPath\\": \\".mac.target[0]\\",
\\"schemaPath\\": \\"#/properties/target/anyOf/1/items/anyOf\\",
\\"params\\": {},
\\"message\\": \\"should match some schema in anyOf\\"
},
{
\\"keyword\\": \\"enum\\",
\\"dataPath\\": \\".mac.target\\",
\\"schemaPath\\": \\"#/properties/target/anyOf/2/enum\\",
\\"params\\": {
\\"allowedValues\\": [
\\"7z\\",
\\"default\\",
\\"dir\\",
\\"dmg\\",
\\"mas\\",
\\"pkg\\",
\\"tar.bz2\\",
\\"tar.gz\\",
\\"tar.lz\\",
\\"tar.xz\\",
\\"zip\\"
]
},
\\"message\\": \\"should be equal to one of the allowed values\\"
},
{
\\"keyword\\": \\"type\\",
\\"dataPath\\": \\".mac.target\\",
\\"schemaPath\\": \\"#/properties/target/anyOf/2/type\\",
\\"params\\": {
\\"type\\": \\"string\\"
},
\\"message\\": \\"should be string\\"
},
{
\\"keyword\\": \\"type\\",
\\"dataPath\\": \\".mac.target\\",
\\"schemaPath\\": \\"#/properties/target/anyOf/3/type\\",
\\"params\\": {
\\"type\\": \\"null\\"
},
\\"message\\": \\"should be null\\"
},
{
\\"keyword\\": \\"anyOf\\",
\\"dataPath\\": \\".mac.target\\",
\\"schemaPath\\": \\"#/properties/target/anyOf\\",
\\"params\\": {},
\\"message\\": \\"should match some schema in anyOf\\"
},
{
\\"keyword\\": \\"type\\",
\\"dataPath\\": \\".mac\\",
\\"schemaPath\\": \\"#/properties/mac/anyOf/1/type\\",
\\"params\\": {
\\"type\\": \\"null\\"
},
\\"message\\": \\"should be null\\"
},
{
\\"keyword\\": \\"anyOf\\",
\\"dataPath\\": \\".mac\\",
\\"schemaPath\\": \\"#/properties/mac/anyOf\\",
\\"params\\": {},
\\"message\\": \\"should match some schema in anyOf\\"
}
]"
}"
`;

exports[`only zip 1`] = `
Expand Down
24 changes: 14 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"

aws-sdk@^2.34.0:
version "2.34.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.34.0.tgz#bf96fb617aa0e1d8728760ca7f00d46d0d9c685c"
aws-sdk@^2.36.0:
version "2.36.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.36.0.tgz#e13b7abbfef3b4476fe1c646fa7587fd6b4808de"
dependencies:
buffer "4.9.1"
crypto-browserify "1.0.9"
Expand Down Expand Up @@ -678,8 +678,8 @@ camelcase@^3.0.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a"

camelcase@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.0.0.tgz#8b0f90d44be5e281b903b9887349b92595ef07f2"
version "4.1.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"

capture-stack-trace@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -1448,8 +1448,8 @@ home-or-tmp@^2.0.0:
os-tmpdir "^1.0.1"

home-path@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/home-path/-/home-path-1.0.3.tgz#9ece59fec3f032e6d10b5434fee264df4c2de32f"
version "1.0.5"
resolved "https://registry.yarnpkg.com/home-path/-/home-path-1.0.5.tgz#788b29815b12d53bacf575648476e6f9041d133f"

hosted-git-info@^2.1.4, hosted-git-info@^2.4.1:
version "2.4.1"
Expand Down Expand Up @@ -2253,14 +2253,18 @@ mime@^1.3.4:
dependencies:
brace-expansion "^1.0.0"

[email protected], minimist@~0.0.1:
[email protected]:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"

minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

minimist@~0.0.1:
version "0.0.10"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"

mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
Expand Down Expand Up @@ -3235,8 +3239,8 @@ typical@^2.4.2, typical@^2.6.0:
resolved "https://registry.yarnpkg.com/typical/-/typical-2.6.0.tgz#89d51554ab139848a65bcc2c8772f8fb450c40ed"

uglify-js@^2.6:
version "2.8.18"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.18.tgz#925d14bae48ab62d1883b41afe6e2261662adb8e"
version "2.8.20"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.20.tgz#be87100fbc18de3876ed606e9d24b4568311cecf"
dependencies:
source-map "~0.5.1"
yargs "~3.10.0"
Expand Down

0 comments on commit 37f84b9

Please sign in to comment.