Skip to content

Commit

Permalink
docs: update option documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzhao committed Jun 11, 2024
1 parent a93581c commit 138100d
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 27 deletions.
65 changes: 38 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,44 @@ installation/runtime requirements.
Usage: electron-rebuild --version [version] --module-dir [path]
Options:
-h, --help Show help [boolean]
-v, --version The version of Electron to build against
-f, --force Force rebuilding modules, even if we would skip
it otherwise
-a, --arch Override the target architecture to something
other than your system's
-m, --module-dir The path to the app directory to rebuild
-w, --which-module A specific module to build, or comma separated
list of modules. Modules will only be rebuilt if they
also match the types of dependencies being rebuilt
(see --types).
-e, --electron-prebuilt-dir The path to the prebuilt electron module
-d, --dist-url Custom header tarball URL
-t, --types The types of dependencies to rebuild. Comma
separated list of "prod", "dev" and "optional".
Default is "prod,optional"
-p, --parallel Rebuild in parallel, this is enabled by default
on macOS and Linux
-s, --sequential Rebuild modules sequentially, this is enabled by
default on Windows
-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
-v, --version The version of Electron to build against
[string]
-f, --force Force rebuilding modules, even if we would skip
it otherwise [boolean]
-a, --arch Override the target architecture to something
other than your system's [string]
-m, --module-dir The path to the node_modules directory to
rebuild [string]
-w, --which-module A specific module to build, or comma separated
list of modules. Modules will only be rebuilt
if they also match the types of dependencies
being rebuilt (see --types). [string]
-o, --only Only build specified module, or comma separated
list of modules. All others are ignored.
[string]
-e, --electron-prebuilt-dir The path to the prebuilt electron module
[string]
-d, --dist-url Custom header tarball URL [string]
-t, --types The types of dependencies to rebuild. Comma
separated list of "prod", "dev" and "optional".
Default is "prod,optional" [string]
-p, --parallel Rebuild in parallel, this is enabled by default
on macOS and Linux [boolean]
-s, --sequential Rebuild modules sequentially, this is enabled
by default on Windows [boolean]
-b, --debug Build debug version of modules [boolean]
--prebuild-tag-prefix GitHub tag prefix passed to prebuild-install.
Default is "v" [string]
--force-build-from-source Skip prebuild download and rebuild module from
source. Default is false [boolean]
--force-abi Override the ABI version for the version of
Electron you are targeting. Only use when
targeting Nightly releases. [number]
--use-electron-clang Use the clang executable that Electron used
when building its binary. This will guarantee
compiler compatibility [boolean]
--disable-pre-gyp-copy Disables the pre-gyp copy step [boolean]
-h, --help Show help [boolean]
```

### How can I use this with [Electron Forge](https://github.com/electron/forge)?
Expand Down
82 changes: 82 additions & 0 deletions src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,106 @@ import { ModuleRebuilder } from './module-rebuilder';
import { ModuleType, ModuleWalker } from './module-walker';

export interface RebuildOptions {
/**
* The path to the `node_modules` directory to rebuild.
*/
buildPath: string;
/**
* The version of Electron to build against.
*/
electronVersion: string;
/**
* Override the target rebuild architecture to something other than the host system architecture.
*
* @defaultValue The system {@link https://nodejs.org/api/process.html#processarch | `process.arch`} value
*/
arch?: string;
/**
* An array of module names to rebuild in addition to detected modules
* @default []
*/
extraModules?: string[];
/**
* An array of module names to rebuild. **Only** these modules will be rebuilt.
*/
onlyModules?: string[] | null;
/**
* Force a rebuild of modules regardless of their current build state.
*/
force?: boolean;
/**
* URL to download Electron header files from.
* @defaultValue `https://www.electronjs.org/headers`
*/
headerURL?: string;
/**
* Array of types of dependencies to rebuild. Possible values are `prod`, `dev`, and `optional`.
*
* @defaultValue `['prod', 'optional']`
*/
types?: ModuleType[];
/**
* Whether to rebuild modules sequentially or in parallel.
*
* @defaultValue `sequential`
*/
mode?: RebuildMode;
/**
* Rebuilds a Debug build of target modules. If this is `false`, a Release build will be generated instead.
*
* @defaultValue false
*/
debug?: boolean;
/**
* Enables hash-based caching to speed up local rebuilds.
*
* @experimental
* @defaultValue false
*/
useCache?: boolean;
/**
* Whether to use the `clang` executable that Electron uses when building.
* This will guarantee compiler compatibility.
*
* @defaultValue false
*/
useElectronClang?: boolean;
/**
* Sets a custom cache path for the {@link useCache} option.
* @experimental
* @defaultValue a `.electron-rebuild-cache` folder in the `os.homedir()` directory
*/
cachePath?: string;
/**
* GitHub tag prefix passed to {@link https://www.npmjs.com/package/prebuild-install | `prebuild-install`}.
* @defaultValue `v`
*/
prebuildTagPrefix?: string;
/**
* Path to the root of the project if using npm or yarn workspaces.
*/
projectRootPath?: string;
/**
* Override the Application Binary Interface (ABI) version for the version of Electron you are targeting.
* Only use when targeting nightly releases.
*
* @see the {@link https://github.com/electron/node-abi | electron/node-abi} repository for a list of Electron and Node.js ABIs
*/
forceABI?: number;
/**
* Disables the copying of `.node` files if not needed.
* @defaultValue false
*/
disablePreGypCopy?: boolean;
/**
* Skip prebuild download and rebuild module from source.
*
* @defaultValue false
*/
buildFromSource?: boolean;
/**
* Array of module names to ignore during the rebuild process.
*/
ignoreModules?: string[];
}

Expand Down

0 comments on commit 138100d

Please sign in to comment.