{"_id":"k-build-tools","name":"k-build-tools","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"k-build-tools","version":"0.2.0","engines":{"node":">= 14.0.0"},"main":"null","scripts":{"lint":"prettier --check \"src/**/*.js\" \"tests/*.js\" \"src/e\"","prettier:write":"prettier --write \"src/**/*.js\" \"tests/*.js\" \"src/e\"","test":"nyc --reporter=lcov --reporter=text-summary jest --config=jest.fast.json -i","test:all":"nyc --reporter=lcov --reporter=text-summary jest --config=jest.slow.json -i"},"repository":{"type":"git","url":"git+https://github.com/electron/build-tools.git"},"author":{"name":"wugaosheng"},"license":"MIT","dependencies":{"@octokit/auth-oauth-device":"^3.1.1","@octokit/rest":"^18.5.2","ajv":"^8.11.0","ajv-formats":"^2.1.1","chalk":"^2.4.1","chrome-cookies-secure":"^2.0.0","command-exists":"^1.2.8","commander":"^9.0.0","cross-zip":"^3.0.0","debug":"^4.3.1","got":"^11.8.5","inquirer":"^8.2.4","js-yaml":"^3.13.1","lodash":"^4.17.21","node-gyp":"^6.1.0","open":"^6.4.0","path-key":"^3.1.0","progress":"^2.0.3","readline-sync":"^1.4.10","vscode-uri":"^3.0.7","which":"^2.0.2"},"devDependencies":{"husky":"^4.2.0","jest":"^27.5.1","lint-staged":"^10.0.2","nyc":"^14.1.1","prettier":"^1.19.1","rimraf":"^3.0.0"},"lint-staged":{"*.js":["prettier --write"],"e":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"9e6a192b2ee9313586902cf84d539f0588014627","description":"This repository contains helper/wrapper scripts to make building Electron easier.","bugs":{"url":"https://github.com/electron/build-tools/issues"},"homepage":"https://github.com/electron/build-tools#readme","_id":"k-build-tools@0.2.0","_nodeVersion":"14.18.0","_npmVersion":"6.14.14","dist":{"integrity":"sha512-o0f9PHvIfaNIQkWMAFXn1GICs4xDmi2nRGwfx/YeOtktjCcYAkGlTnCd9hdG6TJX6rno+NM4r6FZ/+emv4+PNQ==","shasum":"05056543bd1823915ff776354bd9da16c822307c","tarball":"https://registry.npmjs.org/k-build-tools/-/k-build-tools-0.2.0.tgz","fileCount":61,"unpackedSize":166826,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjfhkYJ7XLWGpMblkXSqK7Ig3YtvckzLpfZT7hj7K6gQIgJLuJUSR+mGhp5UIih6ORPtuYZU3BTdHEOsTRGDq5rus="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkL774ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTqw//Qeg9+zLNScjpFcptO5PENpgOgRACweCnj1Xbw/Do6o0ZSBm4\r\nOqPe2+e+Iy/WHtY0q8S4/xYUq4koaYgW64P7yOZ9K7eXHx0XsZlDNkqaJsp+\r\nbh3IQX76Q4F7bzCL5L4DdEp7TxqYlgqdNS9QMnSYEzgbVeMt1k8CrfE9+b72\r\nIxBB4qk4PhkTbTNaJ7JOb6dyCSaN9X36e0Vufwl+r600Tbt+8UeI0KvwjrcQ\r\nOnSAEQ1CWl2w41P6D7AYh1JWkKCl7jPyaO7VKNzr0cf8xV8udlUKPBlvAVDK\r\nnt1sTWG/qCuS0hV7ZTbsOKjS5XyxHIQQZ2OPfd/YVhYsKcJIbwu0Cl0t0nSQ\r\nDUuMuH5qpJi15Mm64OicQ7LylLaf83z7YZdoCuWetXgNWQ+u43rgFNR2kxTU\r\nG1glMzOzsxVfYtcs9hUvgTFmdTQ2/rcpz54cYMUpq6LKqZRJLF4krAJl0rCR\r\nZTW4TroAbotCNIgy/x5hSyYSHSmhKu9wFYrdwZxJu1CUqvC6xd6EG0zo9nob\r\nd7m7ARhUpAvClW0c+I5vLVo3vrsdGkH8ss36wRvpvlSkxdgu0RNZmGSB595O\r\nPaau/k3kZ+LuziWLQ/8suxKib40us/NcYPyK6s5Cc3SJ+eY5hAHjOWl+NHjJ\r\nWyNa+3KBzS01TL/VDveXsw5wj96ADYgn64w=\r\n=Dmdw\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"wugaosheng","email":"wugaosheng@kylinos.cn"},"directories":{},"maintainers":[{"name":"wugaosheng","email":"wugaosheng@kylinos.cn"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/k-build-tools_0.2.0_1680850680552_0.8813577855857344"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-07T06:58:00.552Z","0.2.0":"2023-04-07T06:58:00.739Z","modified":"2023-04-07T06:58:00.911Z"},"maintainers":[{"name":"wugaosheng","email":"wugaosheng@kylinos.cn"}],"description":"This repository contains helper/wrapper scripts to make building Electron easier.","homepage":"https://github.com/electron/build-tools#readme","repository":{"type":"git","url":"git+https://github.com/electron/build-tools.git"},"author":{"name":"wugaosheng"},"bugs":{"url":"https://github.com/electron/build-tools/issues"},"license":"MIT","readme":"# Electron Build Tools\n\nThis repository contains helper/wrapper scripts to make building Electron easier.\n\n## Installation\n\nA handful of prerequisites, such as git, python, and npm, are\nrequired for building Electron itself; these can be found in\n[Platform Prerequisites][platform-prerequisites]. `npm` can be used\nwith `build-tools` itself as well, but we've configured it to run\nwith `yarn`, so we also recommend you [install it to your system](https://yarnpkg.com/lang/en/docs/install/).\n\nFrom here, you'll need a command-line prompt. On Mac and Linux, this will\nbe a terminal with a shell, e.g. bash or zsh. You can also use these on\nWindows if you install them, or use built-in tools like Windows'\n[Command Prompt](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands#command-shell-overview).\n\nPlease note that `build-tools` (due to nested dependencies) might not work properly in powershell, please use `cmd` on Windows for optimum results.\n\n```sh\n# Install build-tools package globally:\nnpm i -g @electron/build-tools\n```\n\n## Getting the Code and Building Electron\n\nYou can run a new Electron build with this command:\n\n```sh\n# The 'Hello, World!' of build-tools: get and build `main`\n# Choose the directory where Electron's source and build files will reside.\n# You can specify any path you like; this command defaults to `$PWD/electron`.\n# If you're going to use multiple branches, you may want something like:\n# `--root=~/electron/branch` (e.g. `~/electron-gn/main`)\ne init --root=~/electron --bootstrap testing\n```\n\nThat command's going to run for awhile. While you're waiting, grab a\ncup of hot caffeine and read about what your computer is doing:\n\n### Concepts\n\nElectron's build-tools command is named `e`. Like [nvm][nvm] and git,\nyou'll invoke `e` with commands and subcommands. See `e --help` or `e help <cmd>`\nfor many more details.\n\n`e` also borrows another inspiration from nvm: having multiple configurations\nthat you can switch between so that one is the current, active configuration.\nMany choices go into an Electron build:\n\n* Which [Electron branch](https://github.com/electron/electron/branches)\n  is used (e.g. `main`, `13-x-y`)\n* Which [.gn config file][gn-configs] is imported (e.g.\n  [testing](https://github.com/electron/electron/blob/main/build/args/testing.gn) or\n  [release](https://github.com/electron/electron/blob/main/build/args/release.gn))\n* Any compile-time options (e.g. Clang's [asan or tsan][sanitizers])\n\n`e` holds all these variables together in a build configuration. You can\nhave multiple build configurations and manage them in a way similar to nvm:\n\n| nvm                  | e                  | Description                                    |\n|:---------------------|:-------------------|:-----------------------------------------------|\n| nvm ls               | e show configs     | Show the available configurations              |\n| nvm current          | e show current     | Show which configuration is currently in use   |\n| nvm use &lt;name&gt; | e use &lt;name&gt; | Change which configuration is currently in use |\n\nGetting the source code is a lot more than cloning `electron/electron`.\nElectron is built on top of Chromium (with Electron patches) and Node\n(with more Electron patches). A source tree needs to have all of the\nabove **and** for their versions to be in sync with each other. Electron\nuses Chromium's [Depot Tools][depot-tools] and [GN][gn] for wrangling\nand building the code. `e` wraps these tools:\n\n| Command | Description                                                    |\n|:--------|:---------------------------------------------------------------|\n| e init  | Create a new build config and initialize a GN directory        |\n| e sync  | Get / update / synchronize source code branches                |\n| e build | Build it!                                                      |\n\n### e init\n\n`e init` initializes a new local development environment for Electron.\n\nTo see all potential options for this command, run:\n\n```sh\n$ e init --help\n```\n\nNew build configs are created with `e init`. It has several command-line\noptions to specify the build configuration, e.g. the path to the source\ncode, compile-time options, and so on. See `e init --help` for in-depth\ndetails.\n\nEach build config has a name, chosen by you to use as a mnemonic when\nswitching between build configs with `e use <name>`. This is the name's\nonly purpose, so choose whatever you find easiest to work with &mdash;\nwhether it's `electron`, `6-1-x--testing`, or `chocolate-onion-popsicle`.\n\nEach build also needs a root directory. All the source code and built\nfiles will be stored somewhere beneath it. `e init` uses `$PWD/electron`\nby default, but you can choose your own with `--root=/some/path`. If you\nwant to make multiple build types of the same branch, you can reuse\nan existing root to share it between build configs.\n\nAs an example, let's say you're starting from scratch and want both\ntesting and release builds of the main branch in `electron/electron`.\nYou might do this:\n\n```sh\n# making 'release' and 'testing' builds from main\n\n$ e init main-testing -i testing --root=~/src/electron\nCreating '~/src/electron'\nNew build config 'main-testing' created\nNow using config 'main-testing'\n$ e show current\nmain-testing\n\n$ e init main-release -i release --root=~/src/electron\nINFO Root '~/src/electron' already exists.\nINFO (OK if you are sharing $root between multiple build configs)\nNew build config 'main-release' created\nNow using config 'main-release'\n\n$ e show configs\n* main-release\n  main-testing\n\n$ e show current\nmain-release\n$ e show root\n~/src/electron\n\n$ e use main-testing\nNow using config 'main-testing'\n$ e show current\nmain-testing\n$ e show root\n~/src/electron\n```\n\nAs a convenience, `e init --bootstrap` will run `e sync` and `e build`\nafter creating the build config. Let's see what those do:\n\n### `e sync`\n\nTo see all potential options for this command, run:\n\n```sh\n$ e sync --help\n```\n\n`e sync` is a wrapper around `gclient sync` from [Depot Tools][depot-tools].\nIf you're starting from scratch, this will (slowly) fetch all the source\ncode. It's also useful after switching Electron branches to synchronize\nthe rest of the sources to the versions needed by the new Electron branch.\n\n`e sync` is usually all you need. Any extra args are passed along to gclient itself.\n\n```sh\n$ e show current\nmain-testing\n\n$ e show root\n~/src/electron\n\n$ e sync\nRunning \"gclient sync --with_branch_heads --with_tags\" in '~/src/electron/src'\n[sync output omitted]\n```\n\nTo make your output more verbose, you can add an increasing number of `-v`s. For example,\n\n```sh\n# basic verbosity\n$ e sync -v\nRunning \"gclient sync --with_branch_heads --with_tags -v\" in '~/src/electron/src'\n[sync output omitted]\n\n# significant verbosity\n$ e sync -vvvv\nRunning \"gclient sync --with_branch_heads --with_tags -vvvv\" in '~/src/electron/src'\n[sync output omitted]\n```\n\n### `e build`\n\n`e build` builds an Electron executable.\n\nTo see all potential options for this command, run:\n\n```sh\n$ e build --help\n```\n\nOnce you have the source, the next step is to build it with `e build [target]`.\nThese build targets are supported:\n\n| Target        | Description                                              |\n|:--------------|:---------------------------------------------------------|\n| breakpad      | Builds the breakpad `dump_syms` binary                   |\n| chromedriver  | Builds the `chromedriver` binary                         |\n| electron      | Builds the Electron binary **(Default)**                 |\n| electron:dist | Builds the Electron binary and generates a dist zip file |\n| mksnapshot    | Builds the `mksnapshot` binary                           |\n| node:headers  | Builds the node headers `.tar.gz` file                   |\n\nAs with syncing, `e build [target]` is usually all you need. Any extra\nargs are passed along to [ninja][ninja], so for example `e build -v`\nruns a verbose build.\n\n## Using Electron\n\nAfter you've built Electron, it's time to use it!\n\n| Command | Description                          |\n|:--------|:-------------------------------------|\n| e start | Run the Electron build               |\n| e node  | Run the Electron build as Node       |\n| e debug | Run the Electron build in a debugger |\n| e test  | Run Electron's spec runner           |\n\nAs usual, any extra args are passed along to the executable. For example,\n`e node --version` will print out Electron's node version.\n\n### `e debug`\n\n`e debug` runs your local Electron build inside of [lldb][lldb] or [gdb][gdb].\n\n```sh\n$ uname\nLinux\n$ e debug\nReading symbols from /home/yourname/electron/gn/main/src/out/Testing/electron...\n(gdb)\n```\n\n```sh\n$ uname\nDarwin\n\n$ e debug\ntarget create \"/Users/yourname/electron-gn/src/out/Testing/Electron.app/Contents/MacOS/Electron\"\n(lldb)\n```\n\n### `e test`\n\n`e test` starts the local Electron build's test runner. Any extra args are passed\nalong to the runner.\n\nTo see all potential options for this command, run:\n\n```sh\n$ e test --help\n```\n\nExample:\n```sh\n# run all tests\ne test\n\n# run main process tests\ne test --runners=main\n```\n\nPossible extra arguments to pass:\n* `--node` - Run Node.js' own tests with Electron in `RUN_AS_NODE` mode.\n* `--runners=<main|remote|native>` - The set of tests to run, can be either `main`, `remote`, or `native`.\n\n### `e show`\n\n`e show` shows information about the current build config.\n\nTo see all potential options for this command, run:\n\n```sh\n$ e show --help\n```\n\n| Command           | Description                                                    |\n|:------------------|:---------------------------------------------------------------|\n| e show current    | The name of the active build config                            |\n| e show configs    | Lists all build configs                                        |\n| e show env        | Show environment variables injected by the active build config |\n| e show exe        | The path of the built Electron executable                      |\n| e show root       | The path of the root directory from `e init --root`.           |\n| e show src [name] | The path of the named (default: electron) source dir           |\n| e show stats      | Build statistics                                               |\n\nExample usage:\n\n```sh\n$ uname\nDarwin\n\n$ e show exe\n/Users/username/electron-gn-root/src/out/Testing/Electron.app/Contents/MacOS/Electron\n\n$ uname\nLinux\n\n$ e show exe\n/home/username/electron-gn-root/src/out/Testing/electron\n\n$ e show out\nTesting\n\n$ e show src\n/home/username/electron-gn-root/src/electron\n\n$ cd `e show src base` && pwd\n/home/username/electron-gn-root/src/base\n\n$ ripgrep --t h TakeHeapSnapshot `e show src`\n```\n\n### `e remove <name>`\n\n`e remove|rm <name>` removes a build config from the list.\n\n### `e open <commit | issue | PR>`\n\n`e open` opens the GitHub page for the specified commit, pull request, or issue.\n\nTo see all potential options for this command, run:\n\n```sh\n$ e open --help\n```\n\nFor example, `e open 0920d01` will find the commit with an abbreviated\nsha1 of `0920d01`, see that it's associated with pull request #23450,\nand open https://github.com/electron/electron/pull/23450 in your browser.\nSince you can pass in a pull request or issue number as well,\n`e open 23450` would have the same effect.\n\n### `e patches [patch-dir]`\n\n`e patches` exports patches to the specified patch directory in Electron source tree.\n\nTo see all potential options for this command, run:\n\n```sh\n$ e patches --help\n```\n\nValid patch directories can include:\n\n* `node`\n* `v8`\n* `boringssl`\n* `chromium`\n* `perfetto`\n* `icu`\n\n| Command              | Source Directory                   | Patch Directory                   |\n|:---------------------|:-----------------------------------|:----------------------------------|\n| e patches node       | `src/third_party/electron_node`    | `src/electron/patches/node`       |\n| e patches chromium   | `src`                              | `src/electron/patches/chromium`   |\n| e patches boringssl  | `src/third_party/boringssl/src`    | `src/electron/patches/boringssl`  |\n| e patches v8         | `src/v8`                           | `src/electron/patches/v8`         |\n| e patches perfetto   | `src/third_party/perfetto`         | `src/electron/patches/perfetto`   |\n| e patches icu        | `src/third_party/icu`              | `src/electron/patches/icu`        |\n\n[depot-tools]: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up\n[gdb]: https://web.eecs.umich.edu/~sugih/pointers/summary.html\n[gn-configs]: https://github.com/electron/electron/tree/main/build/args\n[gn]: https://chromium.googlesource.com/chromium/src/tools/gn/+/48062805e19b4697c5fbd926dc649c78b6aaa138/README.md\n[lldb]: https://lldb.llvm.org/use/tutorial.html\n[ninja]: https://ninja-build.org\n[nvm]: https://github.com/nvm-sh/nvm\n[platform-prerequisites]: https://electronjs.org/docs/development/build-instructions-gn#platform-prerequisites\n[sanitizers]: https://github.com/google/sanitizers\n\n### `e sanitize-config <name>`\n\n`e sanitize-config` updates and/or overwrites an existing config to conform to latest `build-tools` updates.\n\nTo see all potential options for this command, run:\n\n```sh\n$ e sanitize-config --help\n```\n\nSometimes `build-tools` will make updates to its config requirements. In these events warnings will be output to console to inform you that `build-tools` has temporarily handled the issues. You can make these warnings go away either by manually updating your config files or by running this command to automatically overwrite the existing configs to update formatting.\n\n## Common Usage\n\n### Building a Specific Electron Version\n\n`e init` checks out the HEAD of the main branch. To build against a specific version of Electron, checkout that version with these commands:\n\n```sh\n# Change working directory to the Electron source directory\ncd `e show src`\n\n# Checkout the desired Electron version (in this case, 11.0.0)\ngit checkout tags/v11.0.0 -b v11.0.0\n\n# Sync dependencies with the current branch\ne sync\n\n# Build Electron\ne build\n```\n\n## Advanced Usage\n\n### Per-Session Active Configs\n\nIf you want your shell sessions to each have different active configs, try this in your `~/.profile` or `~/.zshrc` or `~/.bashrc`:\n\n```sh\nexport EVM_CURRENT_FILE=\"$(mktemp --tmpdir evm-current.XXXXXXXX.txt)\"\n```\n\nThis will create per-shell temporary files in which the active config file can be changed with `e use`.\n\n### Disabling Automatic Updates\n\nWith the default configuration, build-tools will automatically check for updates every 4 hours.\n\nYou can enable and disable these automatic updates with the following commands:\n\n```\ne auto-update enable\ne auto-update disable\n```\n\nRegardless of whether automatic updates are enabled, you can manually call the following command to immediately trigger an update.\n\n```\ne auto-update check\n```\n","readmeFilename":"README.md"}