Skip to content

Commit

Permalink
fix: correctly copy sub node module (not to top-level dir)
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Mar 17, 2018
1 parent 68f31dc commit fe7d56c
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 244 deletions.
2 changes: 1 addition & 1 deletion docker/9/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM electronuserland/builder:base

ENV NODE_VERSION 9.7.1
ENV NODE_VERSION 9.8.0

# this package is used for snapcraft and we should not clear apt list - to avoid apt-get update during snap build
RUN apt-get -qq update && \
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"app-builder-bin": "1.7.2",
"archiver": "^2.1.1",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.207.0",
"aws-sdk": "^2.211.0",
"bluebird-lst": "^1.0.5",
"chalk": "^2.3.2",
"chromium-pickle-js": "^0.2.0",
Expand Down Expand Up @@ -60,7 +60,7 @@
"sanitize-filename": "^1.6.1",
"sax": "^1.2.4",
"semver": "^5.5.0",
"source-map-support": "^0.5.3",
"source-map-support": "^0.5.4",
"stat-mode": "^0.2.2",
"temp-file": "^3.1.1",
"tunnel-agent": "^0.6.0",
Expand Down Expand Up @@ -95,7 +95,7 @@
"gitbook-plugin-github": "^2.0.0",
"gitbook-plugin-github-buttons": "^3.0.0",
"globby": "^8.0.1",
"jest-cli": "^22.4.2",
"jest-cli": "^23.0.0-alpha.0",
"jest-junit": "^3.6.0",
"jsdoc-to-markdown": "^4.0.1",
"path-sort": "^0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/builder-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"chalk": "^2.3.2",
"debug": "^3.1.0",
"builder-util-runtime": "^0.0.0-semantic-release",
"source-map-support": "^0.5.3",
"source-map-support": "^0.5.4",
"7zip-bin": "~3.1.0",
"semver": "^5.5.0",
"lazy-val": "^1.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-lib/src/linuxPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class LinuxPackager extends PlatformPackager<LinuxConfiguration> {
}

get isElectron2(): boolean {
return semver.gte(this.config.electronVersion || "1.8.3", "2.0.0-beta.1")
return semver.gte(this.config.electronVersion || "1.8.3", "1.8.3")
}

get defaultTarget(): Array<string> {
Expand Down
4 changes: 3 additions & 1 deletion packages/electron-builder-lib/src/util/appFileCopier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export function getDestinationPath(file: string, fileSet: ResolvedFileSet) {
}
else {
// hoisted node_modules
const index = file.lastIndexOf(NODE_MODULES_PATTERN)
// not lastIndexOf, to ensure that nested module (top-level module depends on) copied to parent node_modules, not to top-level directory
// project https://github.com/angexis/punchcontrol/commit/cf929aba55c40d0d8901c54df7945e1d001ce022
const index = file.indexOf(NODE_MODULES_PATTERN)
if (index < 0) {
throw new Error(`File "${file}" not under the source directory "${fileSet.src}"`)
}
Expand Down
9 changes: 3 additions & 6 deletions packages/electron-builder-lib/src/util/packageDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,19 @@ const knownAlwaysIgnoredDevDeps = new Set([
"@types",
])

// noinspection JSUnusedGlobalSymbols
export function createLazyProductionDeps(projectDir: string) {
return new Lazy(() => getProductionDependencies(projectDir))
}

/** @internal */
export async function getProductionDependencies(folder: string): Promise<Array<Dependency>> {
const sorted: Array<Dependency> = []
computeSortedPaths(await computeDependencies(folder), sorted, false)
computeSortedPaths(await new Collector().collect(folder), sorted, false)
return sorted
}

function computeDependencies(folder: string): Promise<Dependency> {
return new Collector().collect(folder)
}

const ignoredProperties = new Set(["description", "author", "bugs", "engines", "repository", "build", "main", "license", "homepage", "scripts", "maintainers", "contributors", "keywords", "devDependencies", "files", "typings", "types"])
const ignoredProperties = new Set(["description", "author", "bugs", "engines", "repository", "build", "main", "license", "homepage", "scripts", "maintainers", "contributors", "keywords", "devDependencies", "files", "typings", "types", "xo", "resolutions"])

function readJson(file: string) {
return readFile(file, "utf-8")
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.5.2",
"aws-sdk": "^2.207.0",
"aws-sdk": "^2.211.0",
"mime": "^2.2.0",
"electron-publish": "~0.0.0-semantic-release",
"builder-util": "^0.0.0-semantic-release",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"fs-extra-p": "^4.5.2",
"js-yaml": "^3.11.0",
"semver": "^5.5.0",
"source-map-support": "^0.5.3",
"source-map-support": "^0.5.4",
"builder-util-runtime": "~0.0.0-semantic-release",
"electron-is-dev": "^0.3.0",
"lodash.isequal": "^4.5.0"
Expand Down
Loading

0 comments on commit fe7d56c

Please sign in to comment.