-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract electron-builder-squirrel-windows
BREAKING CHANGE: To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.
- Loading branch information
Showing
34 changed files
with
245 additions
and
279 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "electron-builder-core", | ||
"version": "0.0.0-semantic-release", | ||
"main": "out/core.js", | ||
"author": "Vladimir Krivosheev", | ||
"license": "MIT", | ||
"repository": "electron-userland/electron-builder", | ||
"bugs": "https://github.com/electron-userland/electron-builder/issues", | ||
"homepage": "https://github.com/electron-userland/electron-builder", | ||
"files": [ | ||
"out" | ||
], | ||
"typings": "./out/electron-builder-core.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
export enum Arch { | ||
ia32, x64, armv7l | ||
} | ||
|
||
export function getArchSuffix(arch: Arch): string { | ||
return arch === Arch.x64 ? "" : `-${Arch[arch]}` | ||
} | ||
|
||
export function archFromString(name: string): Arch { | ||
if (name === "x64") { | ||
return Arch.x64 | ||
} | ||
if (name === "ia32") { | ||
return Arch.ia32 | ||
} | ||
if (name === "armv7l") { | ||
return Arch.armv7l | ||
} | ||
|
||
throw new Error(`Unsupported arch ${name}`) | ||
} | ||
|
||
export class Platform { | ||
static MAC = new Platform("mac", "mac", "darwin") | ||
static LINUX = new Platform("linux", "linux", "linux") | ||
static WINDOWS = new Platform("windows", "win", "win32") | ||
|
||
// deprecated | ||
//noinspection JSUnusedGlobalSymbols | ||
static OSX = Platform.MAC | ||
|
||
constructor(public name: string, public buildConfigurationKey: string, public nodeName: string) { | ||
} | ||
|
||
toString() { | ||
return this.name | ||
} | ||
|
||
createTarget(type?: string | Array<string> | null, ...archs: Array<Arch>): Map<Platform, Map<Arch, Array<string>>> { | ||
const archToType = new Map() | ||
if (this === Platform.MAC) { | ||
archs = [Arch.x64] | ||
} | ||
|
||
for (const arch of (archs == null || archs.length === 0 ? [archFromString(process.arch)] : archs)) { | ||
archToType.set(arch, type == null ? [] : (Array.isArray(type) ? type : [type])) | ||
} | ||
return new Map([[this, archToType]]) | ||
} | ||
|
||
static current(): Platform { | ||
return Platform.fromString(process.platform) | ||
} | ||
|
||
static fromString(name: string): Platform { | ||
name = name.toLowerCase() | ||
switch (name) { | ||
case Platform.MAC.nodeName: | ||
case Platform.MAC.name: | ||
return Platform.MAC | ||
|
||
case Platform.WINDOWS.nodeName: | ||
case Platform.WINDOWS.name: | ||
case Platform.WINDOWS.buildConfigurationKey: | ||
return Platform.WINDOWS | ||
|
||
case Platform.LINUX.nodeName: | ||
return Platform.LINUX | ||
|
||
default: | ||
throw new Error(`Unknown platform: ${name}`) | ||
} | ||
} | ||
} | ||
|
||
|
||
export abstract class Target { | ||
constructor(public readonly name: string, public readonly isAsyncSupported: boolean = true) { | ||
} | ||
|
||
abstract build(appOutDir: string, arch: Arch): Promise<any> | ||
|
||
finishBuild(): Promise<any> { | ||
return Promise.resolve() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "../tsconfig-base.json", | ||
"compilerOptions": { | ||
"outDir": "out" | ||
}, | ||
"declaration": { | ||
"electron-builder-core": "out/electron-builder-core.d.ts" | ||
}, | ||
"include": [ | ||
"src/**/*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "electron-builder-squirrel-windows", | ||
"version": "0.0.0-semantic-release", | ||
"main": "out/squirrelWindows.js", | ||
"author": "Vladimir Krivosheev", | ||
"license": "MIT", | ||
"repository": "electron-userland/electron-builder", | ||
"bugs": "https://github.com/electron-userland/electron-builder/issues", | ||
"homepage": "https://github.com/electron-userland/electron-builder", | ||
"files": [ | ||
"out" | ||
], | ||
"dependencies": { | ||
"electron-builder-util": "0.0.0-semantic-release", | ||
"electron-builder-core": "0.0.0-semantic-release", | ||
"bluebird-lst-c": "^1.0.5", | ||
"fs-extra-p": "^3.0.3", | ||
"archiver": "^1.3.0" | ||
}, | ||
"typings": "./out/electron-builder-squirrel-windows.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.