Skip to content

Commit

Permalink
feat: add --prebuild-tag-prefix option for prebuild-install (#266)
Browse files Browse the repository at this point in the history
Passes through the `--tag-prefix` option to `prebuild-install` call to get
scoped modules from GitHub.

Co-authored-by: Mark Lee <[email protected]>
  • Loading branch information
HipsterBrown and malept committed Jan 22, 2020
1 parent f39329f commit 8ca31ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Options:
-o, --only Only build specified module, or comma separated
list of modules. All others are ignored.
-b, --debug Build debug version of modules
--prebuild-tag-prefix GitHub tag prefix passed to prebuild-install.
Default is "v"
Copyright 2016
```
Expand Down
4 changes: 3 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const yargs = argParser
.alias('s', 'sequential')
.describe('b', 'Build debug version of modules')
.alias('b','debug')
.describe('prebuild-tag-prefix', 'GitHub tag prefix passed to prebuild-install. Default is "v"')
.epilog('Copyright 2016');

const argv = yargs.argv;
Expand Down Expand Up @@ -125,7 +126,8 @@ process.on('unhandledRejection', handler);
headerURL: argv.d as string,
types: argv.t ? (argv.t as string).split(',') as ModuleType[] : ['prod', 'optional'],
mode: argv.p ? 'parallel' : (argv.s ? 'sequential' : undefined),
debug: argv.b as boolean
debug: argv.b as boolean,
prebuildTagPrefix: (argv.prebuildTagPrefix as string) || 'v',
});

const lifecycle = rebuilder.lifecycle;
Expand Down
6 changes: 5 additions & 1 deletion src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface RebuildOptions {
debug?: boolean;
useCache?: boolean;
cachePath?: string;
prebuildTagPrefix?: string;
}

export type HashTree = { [path: string]: string | HashTree };
Expand Down Expand Up @@ -82,6 +83,7 @@ class Rebuilder {
public debug: boolean;
public useCache: boolean;
public cachePath: string;
public prebuildTagPrefix: string;

constructor(options: RebuilderOptions) {
this.lifecycle = options.lifecycle;
Expand All @@ -97,6 +99,7 @@ class Rebuilder {
this.debug = options.debug || false;
this.useCache = options.useCache || false;
this.cachePath = options.cachePath || path.resolve(os.homedir(), '.electron-rebuild-cache');
this.prebuildTagPrefix = options.prebuildTagPrefix || 'v';

if (this.useCache && this.force) {
console.warn('[WARNING]: Electron Rebuild has force enabled and cache enabled, force take precedence and the cache will not be used.');
Expand Down Expand Up @@ -288,7 +291,8 @@ class Rebuilder {
`--arch=${this.arch}`,
`--platform=${process.platform}`,
'--runtime=electron',
`--target=${this.electronVersion}`
`--target=${this.electronVersion}`,
`--tag-prefix=${this.prebuildTagPrefix}`
],
{
cwd: modulePath,
Expand Down

0 comments on commit 8ca31ab

Please sign in to comment.