Skip to content

Commit

Permalink
refactor: change paths to template after "electron-builder according …
Browse files Browse the repository at this point in the history
…to lerna structure"
  • Loading branch information
develar committed Dec 31, 2016
1 parent ee20136 commit cde9918
Show file tree
Hide file tree
Showing 22 changed files with 122 additions and 56 deletions.
15 changes: 7 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,23 @@ Don't edit wiki directly. Instead, edit files in the `/docs`.

# Debug Tests

Only IntelliJ Platform IDEs (IntelliJ IDEA, WebStorm) support debug. [Forked version of AVA](https://github.com/avajs/ava/pull/874) is used. Please see [AVA debug in the WebStorm](https://www.youtube.com/watch?v=C75UwuZXI98&feature=youtu.be).
Only IntelliJ Platform IDEs ([IntelliJ IDEA](https://confluence.jetbrains.com/display/IDEADEV/IDEA+2017.1+EAP), [WebStorm](https://confluence.jetbrains.com/display/WI/WebStorm+EAP)) support debug. Please prefer to use 2017.1.

Use one of the shared run configurations as a template and:
If you use IntelliJ IDEA or WebStorm 2017.1 — [ij-rc-producer](https://github.com/develar/ij-rc-producer) is used and you can run tests from an editor.

* Ensure that `Before launch` contains `Compile TypeScript` (note – currently do not add, please do`npm run compile` before run).
Or you can create Node.js run configuration manually:
* Ensure that `Before launch` contains `Compile TypeScript`.
* Set `Node interpreter` to NodeJS 7. NodeJS 7 is required to debug.
* Set `Node parameters` to `--inspect`.
* Set `Application Parameters` to `--match="test name" relative-test-file-name` if you want to debug particular test. E.g.
* Set `Application Parameters` to `-t "test name" relative-test-file-name` if you want to debug particular test. E.g.
```
--match="extraResources - one-package" test/out/globTest.js
-t "extraResources - one-package" globTest.js
```
* Set `Environment Variables`:
* `NODE_PATH` to `.`.
* Optionally, `TEST_APP_TMP_DIR` to some directory (e.g. `/tmp/electron-builder-test`) to inspect output if test uses temporary directory (only if `--match` is used). Specified directory will be used instead of random temporary directory and *cleared* on each run.

## Run Test using CLI
```sh
TEST_APP_TMP_DIR=/tmp/electron-builder-test NODE_PATH=. ./node_modules/.bin/jest --env jest-environment-node-debug '/TestFileName\.\w+$'
TEST_APP_TMP_DIR=/tmp/electron-builder-test ./node_modules/.bin/jest --env jest-environment-node-debug -t 'boring' '/TestFileName\.\w+$'
```

where `TEST_APP_TMP_DIR` is specified to easily inspect and use test build, `boring` is the test name and `test/out/nsisTest.js` is the path to test file.
6 changes: 5 additions & 1 deletion MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ To add `wiki` upstream:
git remote add wiki [email protected]:electron-userland/electron-builder.wiki.git
```

To sync: `yarn update-wiki`
To sync: `yarn update-wiki`

# Typings

All typings are added into root `package.json` to avoid duplication errors in the IDE compiler (several `node.d.ts` files).
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
"homepage": "https://github.com/electron-userland/electron-builder",
"devDependencies": {
"@develar/semantic-release": "^6.3.26",
"@types/electron": "^1.4.30",
"@types/ini": "^1.3.29",
"@types/jest": "^16.0.3",
"@types/js-yaml": "^3.5.29",
"@types/source-map-support": "^0.2.28",
"babel-plugin-array-includes": "^2.0.3",
"babel-plugin-transform-async-to-module-method": "^6.16.0",
"babel-plugin-transform-es2015-destructuring": "^6.19.0",
Expand Down
8 changes: 2 additions & 6 deletions packages/electron-auto-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@
],
"dependencies": {
"bluebird-lst-c": "^1.0.5",
"debug": "^2.5.2",
"debug": "^2.6.0",
"fs-extra-p": "^3.0.3",
"js-yaml": "^3.7.0",
"semver": "^5.3.0",
"source-map-support": "^0.4.8",
"electron-builder-http": "1.0.0"
},
"devDependencies": {
"@types/electron": "^1.4.30",
"@types/js-yaml": "^3.5.29"
"electron-builder-http": "0.0.0-semantic-release"
},
"typings": "./out/electron-auto-updater.d.ts"
}
8 changes: 5 additions & 3 deletions packages/electron-auto-updater/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
"../../typings/debug.d.ts",
"../../node_modules/fs-extra-p/index.d.ts",
"../../node_modules/bluebird-lst-c/index.d.ts",
"../electron-builder-http/out/electron-builder-http.d.ts"
"../electron-builder-http/out/electron-builder-http.d.ts",
"../../node_modules/@types/electron/index.d.ts",
"../../node_modules/@types/node/index.d.ts",
"../../node_modules/@types/js-yaml/index.d.ts"
],
"include": [
"src/**/*.ts",
"node_modules/@types/*/*.d.ts"
"src/**/*.ts"
]
}
42 changes: 42 additions & 0 deletions packages/electron-builder-http/.yarnclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# test directories
__tests__
test
tests
powered-test

# asset directories
docs
doc
website
images
assets

# examples
example
examples

# code coverage directories
coverage
.nyc_output

# build scripts
Makefile
Gulpfile.js
Gruntfile.js

# configs
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.*.yml
*.yml

# misc
*.gz
*.md
7 changes: 1 addition & 6 deletions packages/electron-builder-http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-builder-http",
"version": "1.0.0",
"version": "0.0.0-semantic-release",
"main": "out/main.js",
"author": "Vladimir Krivosheev",
"license": "MIT",
Expand All @@ -10,10 +10,5 @@
"files": [
"out"
],
"dependencies": {
},
"devDependencies": {
"@types/node": "^6.0.55"
},
"typings": "./out/electron-builder-http.d.ts"
}
2 changes: 1 addition & 1 deletion packages/electron-builder-http/src/httpExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class HttpExecutorHolder {

get httpExecutor(): HttpExecutor {
if (this._httpExecutor == null) {
this._httpExecutor = new (require((<any>global).__test_app == null ? "./nodeHttpExecutor" : "electron-builder/out/util/nodeHttpExecutor").NodeHttpExecutor)()
this._httpExecutor = new (require("electron-builder/out/util/nodeHttpExecutor").NodeHttpExecutor)()
}
return this._httpExecutor
}
Expand Down
6 changes: 4 additions & 2 deletions packages/electron-builder-http/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"electron-builder-http": "out/electron-builder-http.d.ts"
},
"include": [
"src/**/*.ts",
"node_modules/@types/*/*.d.ts"
"src/**/*.ts"
],
"files": [
"../../node_modules/@types/node/index.d.ts"
]
}
File renamed without changes.
File renamed without changes.
9 changes: 1 addition & 8 deletions packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,7 @@
"update-notifier": "^1.0.3",
"uuid-1345": "^0.99.6",
"yargs": "^6.5.0",
"electron-builder-http": "1.0.0"
},
"devDependencies": {
"@types/node": "^6.0.55",
"@types/ini": "^1.3.29",
"@types/jest": "^16.0.2",
"@types/js-yaml": "^3.5.29",
"@types/source-map-support": "^0.2.28"
"electron-builder-http": "0.0.0-semantic-release"
},
"typings": "./out/electron-builder.d.ts",
"publishConfig": {
Expand Down
6 changes: 4 additions & 2 deletions packages/electron-builder/src/targets/appx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export default class AppXTarget extends Target {
const preAppx = path.join(this.outDir, `pre-appx-${getArchSuffix(arch)}`)
await emptyDir(preAppx)

const vendorPath = await getSignVendorPath()

const templatePath = path.join(__dirname, "..", "..", "templates", "appx")
const safeName = sanitizeFileName(appInfo.name)
const resourceList = await packager.resourceList
Expand All @@ -52,7 +54,7 @@ export default class AppXTarget extends Target {
if (resourceList.includes(`${size}.png`)) {
return copy(path.join(packager.buildResourcesDir, `${size}.png`), target)
}
return copy(path.join(templatePath, "assets", `SampleAppx.${size}.png`), target)
return copy(path.join(vendorPath, "appxAssets", `SampleAppx.${size}.png`), target)
}),
copyDir(appOutDir, path.join(preAppx, "app")),
this.writeManifest(templatePath, preAppx, safeName, arch)
Expand All @@ -63,7 +65,7 @@ export default class AppXTarget extends Target {
use(this.options.makeappxArgs, (it: Array<string>) => args.push(...it))
// wine supports only ia32 binary in any case makeappx crashed on wine
// await execWine(path.join(await getSignVendorPath(), "windows-10", process.platform === "win32" ? process.arch : "ia32", "makeappx.exe"), args)
await spawn(path.join(await getSignVendorPath(), "windows-10", arch === Arch.ia32 ? "ia32" : "x64", "makeappx.exe"), args)
await spawn(path.join(vendorPath, "windows-10", arch === Arch.ia32 ? "ia32" : "x64", "makeappx.exe"), args)

await packager.sign(destination)
packager.dispatchArtifactCreated(destination, packager.generateName("appx", arch, true))
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/targets/squirrelPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function buildInstaller(options: SquirrelOptions, outputDirectory:
embeddedArchive.pipe(embeddedArchiveOut)

embeddedArchive.file(appUpdate, {name: "Update.exe"})
embeddedArchive.file(options.loadingGif ? path.resolve(options.loadingGif) : path.join(__dirname, "..", "..", "templates", "install-spinner.gif"), {name: "background.gif"})
embeddedArchive.file(options.loadingGif ? path.resolve(options.loadingGif) : path.join(options.vendorPath, "install-spinner.gif"), {name: "background.gif"})

const version = convertVersion(options.version)
const packageName = `${options.name}-${version}-full.nupkg`
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-builder/src/targets/squirrelWindows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { buildInstaller, convertVersion, SquirrelOptions } from "./squirrelPack"
import { SquirrelWindowsOptions } from "../options/winOptions"
import { Target } from "./targetFactory"

const SW_VERSION = "1.5.1.3"
const SW_VERSION = "1.5.1.4"
//noinspection SpellCheckingInspection
const SW_SHA2 = "526701c61fffed97f622b110cfd15c4a1197ce082705437e9ef938c0cb8f4172"
const SW_SHA2 = "30caa74802259f956d7b73f4b282917c10c6dd3d29f5ca3e4d996b2896f2aa0d"

export default class SquirrelWindowsTarget extends Target {
private readonly options: SquirrelWindowsOptions = Object.assign({}, this.packager.platformSpecificBuildOptions, this.packager.config.squirrelWindows)
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-builder/src/windowsCodeSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { getBinFromBintray } from "./util/binDownload"
import isCi from "is-ci"
import { WinBuildOptions } from "./options/winOptions"

const TOOLS_VERSION = "1.5.0"
const TOOLS_VERSION = "1.6.0"

export function getSignVendorPath() {
//noinspection SpellCheckingInspection
return getBinFromBintray("winCodeSign", TOOLS_VERSION, "5febefb4494f0f62f0f5c0cd6408f0930caf5943ccfeea2bbf90d2eeb34c571d")
return getBinFromBintray("winCodeSign", TOOLS_VERSION, "5a5e7de5087df96734a9bd96226aa40dbfaa87d44bb95e0fb4eee472e5efa583")
}

export interface SignOptions {
Expand Down
16 changes: 6 additions & 10 deletions packages/electron-builder/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,19 @@
"electron-builder": "out/electron-builder.d.ts"
},
"docs": "../../docs/Options.md",
"paths": {
"fs-extra-p": [
"node_modules/fs-extra-p/index.d.ts"
]
},
"files": [
"node_modules/fs-extra-p/index.d.ts",
"node_modules/bluebird-lst-c/index.d.ts",
"node_modules/7zip-bin/index.d.ts",
"node_modules/electron-macos-sign/index.d.ts",
"../electron-builder-http/out/electron-builder-http.d.ts"
"../electron-builder-http/out/electron-builder-http.d.ts",
"../../node_modules/@types/node/index.d.ts",
"../../node_modules/@types/js-yaml/index.d.ts",
"../../node_modules/@types/ini/index.d.ts",
"../../node_modules/@types/source-map-support/index.d.ts"
],
"include": [
"src/**/*.ts",
"../../typings/*.d.ts",
"node_modules/@types/*/*.d.ts"
],
"exclude": [
"../../typings/*.d.ts"
]
}
2 changes: 1 addition & 1 deletion test/src/helpers/packTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export class CheckingWinPackager extends WinPackager {

async pack(outDir: string, arch: Arch, targets: Array<Target>, postAsyncTasks: Array<Promise<any>>): Promise<any> {
// skip pack
const helperClass: typeof SquirrelWindowsTarget = require("out/targets/squirrelWindows").default
const helperClass: typeof SquirrelWindowsTarget = require("electron-builder/out/targets/squirrelWindows").default
this.effectiveDistOptions = await (new helperClass(this, outDir).computeEffectiveDistOptions())

await this.sign(this.computeAppOutDir(outDir, arch))
Expand Down
2 changes: 1 addition & 1 deletion test/src/helpers/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TEST_DIR, ELECTRON_VERSION } from "./config"
import isCi from "is-ci"

// we set NODE_PATH in this file, so, we cannot use 'out/awaiter' path here
const util = require("../../../out/util/util")
const util = require("../../../packages/electron-builder/out/util/util")
const isEmptyOrSpaces = util.isEmptyOrSpaces

const downloadElectron: (options: any) => Promise<any> = BluebirdPromise.promisify(require("electron-download-tf"))
Expand Down
2 changes: 1 addition & 1 deletion test/src/mac/dmgTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.ifMac("custom background - new way", () => {
platformPackagerFactory: (packager, platform, cleanupTasks) => platformPackager = new CheckingMacPackager(packager)
}, {
projectDirCreated: projectDir => BluebirdPromise.all([
copy(path.join(__dirname, "..", "..", "..", "templates", "dmg", "background.tiff"), path.join(projectDir, customBackground)),
copy(path.join(__dirname, "..", "..", "..", "packages", "electron-builder", "templates", "dmg", "background.tiff"), path.join(projectDir, customBackground)),
modifyPackageJson(projectDir, data => {
data.build.mac = {
icon: "customIcon"
Expand Down
4 changes: 3 additions & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
"noUnusedLocals": true,
"skipLibCheck": true
},
"files": [
"../node_modules/@types/jest/index.d.ts"
],
"include": [
"../typings/*.d.ts",
"typings/*.d.ts",
"src/**/*.ts",
"../packages/electron-builder/node_modules/fs-extra-p/index.d.ts",
"../packages/electron-builder/node_modules/bluebird-lst-c/index.d.ts",
"../packages/electron-builder/node_modules/electron-macos-sign/index.d.ts",
"../packages/electron-builder/node_modules/@types/*/*.d.ts",
"../packages/electron-builder-http/out/electron-builder-http.d.ts",
"../packages/electron-auto-updater/out/electron-auto-updater.d.ts",
"../packages/electron-builder/out/electron-builder.d.ts"
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,34 @@
dependencies:
conventional-changelog "0.0.17"

"@types/electron@^1.4.30":
version "1.4.30"
resolved "https://registry.yarnpkg.com/@types/electron/-/electron-1.4.30.tgz#d79b1bc117b6cfa770220d6aeb5a475659cd7961"
dependencies:
"@types/node" "*"

"@types/ini@^1.3.29":
version "1.3.29"
resolved "https://registry.yarnpkg.com/@types/ini/-/ini-1.3.29.tgz#1325e981e047d40d13ce0359b821475b97741d2f"

"@types/jest@^16.0.3":
version "16.0.3"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-16.0.3.tgz#28a465586cd37d2638043ebcca91010ed89fc284"

"@types/js-yaml@^3.5.29":
version "3.5.29"
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.5.29.tgz#29f4dd9314fbccb080d8bd84b9c23811ec5090c2"

"@types/node@*":
version "6.0.55"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.55.tgz#e5cb679a43561f42afd1bd6d58d3992ec8f31720"

"@types/source-map-support@^0.2.28":
version "0.2.28"
resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.2.28.tgz#ce6497dfa9c9fbd21a753955b4a51d8993d759dd"
dependencies:
"@types/node" "*"

JSONStream@^1.0.4:
version "1.3.0"
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.0.tgz#680ab9ac6572a8a1a207e0b38721db1c77b215e5"
Expand Down

0 comments on commit cde9918

Please sign in to comment.