Skip to content

Commit e7b9a9e

Browse files
committed
feat(snap): use template snap app if no custom stage/build packages
1 parent 8bc0a27 commit e7b9a9e

File tree

19 files changed

+256
-179
lines changed

19 files changed

+256
-179
lines changed

.idea/dictionaries/develar.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker/9/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
FROM electronuserland/builder:base
22

3-
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash - && apt-get install -y nodejs && \
3+
ENV NODE_VERSION 9.4.0
4+
5+
# this package is used for snapcraft and we should not clear apt list - to avoid apt-get update during snap build
6+
RUN apt-get -qq update && \
7+
curl -L https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz | tar xz -C /usr/local --strip-components=1 && \
8+
unlink /usr/local/CHANGELOG.md && unlink /usr/local/LICENSE && unlink /usr/local/README.md && \
49
# https://github.com/npm/npm/issues/4531
5-
npm config set unsafe-perm true && \
6-
# clean
7-
apt-get clean && rm -rf /var/lib/apt/lists/*
10+
npm config set unsafe-perm true

docker/base/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM buildpack-deps:xenial-curl
33
ENV DEBIAN_FRONTEND noninteractive
44

55
RUN curl -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn && ln -s /yarn/bin/yarn /usr/bin/yarn && \
6-
apt-get update -y && \
6+
apt-get -qq update && apt-get -qq dist-upgrade && \
77
# add repo for git-lfs
88
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
99
# git ssh for using as docker image on CircleCI

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"///": "All dependencies for all packages (hoisted)",
2929
"////": "All typings are added into root `package.json` to avoid duplication errors in the IDE compiler (several `node.d.ts` files).",
3030
"dependencies": {
31-
"7zip-bin": "^2.4.1",
31+
"7zip-bin": "~3.0.0",
3232
"archiver": "^2.1.1",
3333
"async-exit-hook": "^2.0.1",
3434
"aws-sdk": "^2.188.0",
@@ -45,7 +45,6 @@
4545
"hosted-git-info": "^2.5.0",
4646
"iconv-lite": "^0.4.19",
4747
"ini": "^1.3.5",
48-
"int64-buffer": "^0.1.10",
4948
"is-ci": "^1.1.0",
5049
"isbinaryfile": "^3.0.2",
5150
"js-yaml": "^3.10.0",
@@ -102,7 +101,7 @@
102101
"ts-babel": "^4.1.8",
103102
"ts-jsdoc": "^2.0.6",
104103
"tslint": "^5.9.1",
105-
"typescript": "^2.7.0-rc",
104+
"typescript": "2.7.0-rc",
106105
"v8-compile-cache": "^1.1.2",
107106
"whitespace": "^2.1.0",
108107
"worker-farm": "^1.5.2"

packages/builder-util/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"debug": "^3.1.0",
2121
"builder-util-runtime": "^0.0.0-semantic-release",
2222
"source-map-support": "^0.5.3",
23-
"7zip-bin": "^2.4.1",
23+
"7zip-bin": "~3.0.0",
2424
"ini": "^1.3.5",
2525
"tunnel-agent": "^0.6.0",
2626
"semver": "^5.5.0",

packages/builder-util/src/fs.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import isCi from "is-ci"
44
import * as path from "path"
55
import Mode from "stat-mode"
66
import { log } from "./log"
7+
import { exec } from "./util"
78
import { orNullIfFileNotExist } from "./promise"
89

910
export const MAX_FILE_REQUESTS = 8
@@ -290,6 +291,23 @@ export function copyDir(src: string, destination: string, options: CopyDirOption
290291
.then(() => BluebirdPromise.map(links, it => symlink(it.link, it.file), CONCURRENCY))
291292
}
292293

294+
// https://unix.stackexchange.com/questions/202430/how-to-copy-a-directory-recursively-using-hardlinks-for-each-file
295+
export function copyDirUsingHardLinks(source: string, destination: string) {
296+
if (process.platform !== "darwin") {
297+
const args = ["-d", "--recursive", "--preserve=mode"]
298+
args.push("--link")
299+
args.push(source + "/", destination + "/")
300+
return ensureDir(path.dirname(destination)).then(() => exec("cp", args))
301+
}
302+
303+
// pax requires created dir
304+
const promise = ensureDir(destination)
305+
return promise
306+
.then(() => exec("pax", ["-rwl", "-p", "amp" /* Do not preserve file access times, Do not preserve file modification times, Preserve the file mode bits */, ".", destination], {
307+
cwd: source,
308+
}))
309+
}
310+
293311
export const DO_NOT_USE_HARD_LINKS = (file: string) => false
294312
export const USE_HARD_LINKS = (file: string) => true
295313

packages/builder-util/src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ export function addValue<K, T>(map: Map<K, Array<T>>, key: K, value: T) {
310310
}
311311

312312
export function replaceDefault(inList: Array<string> | null | undefined, defaultList: Array<string>): Array<string> {
313-
if (inList == null) {
313+
if (inList == null || (inList.length === 1 && inList[0] === "default")) {
314314
return defaultList
315315
}
316316

packages/electron-builder-lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bugs": "https://github.com/electron-userland/electron-builder/issues",
4242
"homepage": "https://github.com/electron-userland/electron-builder",
4343
"dependencies": {
44-
"7zip-bin": "^2.4.1",
44+
"7zip-bin": "~3.0.0",
4545
"async-exit-hook": "^2.0.1",
4646
"bluebird-lst": "^1.0.5",
4747
"chromium-pickle-js": "^0.2.0",

packages/electron-builder-lib/src/options/SnapOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {
2828
/**
2929
* The list of features that must be supported by the core in order for this snap to install.
3030
*/
31-
readonly assumes?: Array<string> | null
31+
readonly assumes?: Array<string> | string | null
3232

3333
/**
3434
* The list of debian packages needs to be installed for building this snap.

packages/electron-builder-lib/src/platformPackager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computeData } from "asar-integrity"
1+
import { computeData, AsarIntegrity } from "asar-integrity"
22
import BluebirdPromise from "bluebird-lst"
33
import { Arch, asArray, AsyncTaskManager, debug, DebugLogger, exec, getArchSuffix, InvalidConfigurationError, isEmptyOrSpaces, log } from "builder-util"
44
import { PackageBuilder } from "builder-util/out/api"
@@ -9,7 +9,6 @@ import { Lazy } from "lazy-val"
99
import { Minimatch } from "minimatch"
1010
import * as path from "path"
1111
import { deepAssign } from "read-config-file/out/deepAssign"
12-
import { AsarIntegrity } from "asar-integrity"
1312
import { AppInfo } from "./appInfo"
1413
import { checkFileInArchive } from "./asar/asarFileChecker"
1514
import { AsarPackager } from "./asar/asarUtil"

0 commit comments

Comments
 (0)