Browse Source

refactor: add 'npm run bootstrap', 'npm run build' (#14034)

* docs: update package.json and build docs

* fix build release

* address feedback from review

* whoops forgot one

* fix build script

* address feedback from review
Shelley Vohr 6 years ago
parent
commit
c0959bd534

+ 18 - 5
docs/development/build-instructions-linux.md

@@ -12,7 +12,7 @@ Follow the guidelines below for building Electron on Linux.
   For a quick test, run the following script:
 
   ```sh
-  $ python ./script/tls.py
+  $ npm run check-tls
   ```
 
   If the script returns that your configuration is using an outdated security
@@ -71,9 +71,18 @@ the build project files. You must have Python 2.7.x for the script to succeed.
 Downloading certain files can take a long time. Notice that we are using
 `ninja` to build Electron so there is no `Makefile` generated.
 
+To bootstrap for a static, non-developer build, run:
+
 ```sh
 $ cd electron
-$ ./script/bootstrap.py --verbose
+$ npm run bootstrap
+```
+
+Or to bootstrap for a development session that builds faster by not statically linking:
+
+```sh
+$ cd electron
+$ npm run bootstrap:dev
 ```
 
 If you are using editor supports [JSON compilation database](http://clang.llvm.org/docs/JSONCompilationDatabase.html) based
@@ -112,7 +121,7 @@ $ ./script/bootstrap.py -v --target_arch=arm
 If you would like to build both `Release` and `Debug` targets:
 
 ```sh
-$ ./script/build.py
+$ npm run build
 ```
 
 This script will cause a very large Electron executable to be placed in
@@ -128,10 +137,14 @@ This will put a working distribution with much smaller file sizes in
 the `dist` directory. After running the `create-dist.py` script, you
 may want to remove the 1.3+ gigabyte binary which is still in `out/R`.
 
-You can also build the `Debug` target only:
+You can also build either the `Debug` or `Release` target on its own:
+
+```sh
+$ npm run build:dev
+```
 
 ```sh
-$ ./script/build.py -c D
+$ npm run build:release
 ```
 
 After building is done, you can find the `electron` debug binary under `out/D`.

+ 19 - 6
docs/development/build-instructions-osx.md

@@ -15,7 +15,7 @@ Please also ensure that your system and Python version support at least TLS 1.2.
 This depends on both your version of macOS and Python. For a quick test, run:
 
 ```sh
-$ python ./script/tls.py
+$ npm run check-tls
 ```
 
 If the script returns that your configuration is using an outdated security
@@ -69,9 +69,18 @@ The bootstrap script will download all necessary build dependencies and create
 the build project files. Notice that we're using [ninja](https://ninja-build.org/)
 to build Electron so there is no Xcode project generated.
 
+To bootstrap for a static, non-developer build, run:
+
 ```sh
 $ cd electron
-$ ./script/bootstrap.py -v
+$ npm run bootstrap
+```
+
+Or to bootstrap for a development session that builds faster by not statically linking:
+
+```sh
+$ cd electron
+$ npm run bootstrap:dev
 ```
 
 If you are using editor supports [JSON compilation database](http://clang.llvm.org/docs/JSONCompilationDatabase.html) based
@@ -83,16 +92,20 @@ $ ./script/build.py --compdb
 
 ## Building
 
-Build both `Release` and `Debug` targets:
+To build both `Release` and `Debug` targets:
 
 ```sh
-$ ./script/build.py
+$ npm run build
 ```
 
-You can also only build the `Debug` target:
+You can also build either the `Debug` or `Release` target on its own:
+
+```sh
+$ npm run build:dev
+```
 
 ```sh
-$ ./script/build.py -c D
+$ npm run build:release
 ```
 
 After building is done, you can find `Electron.app` under `out/D`.

+ 18 - 5
docs/development/build-instructions-windows.md

@@ -37,23 +37,36 @@ The bootstrap script will download all necessary build dependencies and create
 the build project files. Notice that we're using `ninja` to build Electron so
 there is no Visual Studio project generated.
 
+To bootstrap for a static, non-developer build, run:
+
 ```powershell
 $ cd electron
-$ python script\bootstrap.py -v
+$ npm run bootstrap
+```
+
+Or to bootstrap for a development session that builds faster by not statically linking:
+
+```powershell
+$ cd electron
+$ npm run bootstrap:dev
 ```
 
 ## Building
 
-Build both Release and Debug targets:
+Build both `Release` and `Debug` targets:
 
 ```powershell
-$ python script\build.py
+$ npm run build
 ```
 
-You can also only build the Debug target:
+You can also build either the `Debug` or `Release` target on its own:
+
+```powershell
+$ npm run build:dev
+```
 
 ```powershell
-$ python script\build.py -c D
+$ npm run build:release
 ```
 
 After building is done, you can find `electron.exe` under `out\D` (debug

+ 6 - 2
package.json

@@ -45,11 +45,15 @@
   "private": true,
   "scripts": {
     "asar": "asar",
-    "bootstrap": "python ./script/bootstrap.py",
+    "bootstrap:dev": "python ./script/bootstrap.py -d -v",
+    "bootstrap": "python ./script/bootstrap.py -v",
     "browserify": "browserify",
     "bump-version": "./script/bump-version.py",
-    "build": "python ./script/build.py -c D",
+    "build": "python ./script/build.py",
+    "build:dev": "python ./script/build.py -c D",
+    "build:release": "python ./script/build.py -c R",
     "rebuild-test-modules": "python ./script/rebuild-test-modules.py",
+    "check-tls": "python ./script/tls.py",
     "clean": "python ./script/clean.py",
     "clean-build": "python ./script/clean.py --build",
     "clang-format": "find atom/ brightray/ chromium_src/ -iname *.h -o -iname *.cc -o -iname *.mm | xargs clang-format -i",