Skip to content

Commit

Permalink
build: Support debug builds; build refactoring (#279)
Browse files Browse the repository at this point in the history
As mentioned in #271, this adds support for making debug builds.

* Use yargs to improve options-handling in the build script.
* Simplify the npm scripts back to building/cleaning the extension for all browsers.
* Remove the "build:all:quick" script in favour of just calling the build script directly on the CLI.
* Remove the npm clean scripts; most of this is now done in the build script, which now has a clean mode.
* Support debug builds (in which console.timeStamp() calls are made).
* Update the README accordingly.
  • Loading branch information
matatk authored Mar 19, 2019
1 parent ef55e8a commit 48e5aeb
Show file tree
Hide file tree
Showing 8 changed files with 1,070 additions and 1,184 deletions.
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,9 @@ You can build and run the current code locally as follows.

2. Ensure you have all the required build tools with `npm install` (you will need [Node.js](https://nodejs.org/)).

3. Run the build script to build one or all of the extensions:
3. Run the tests and build script to create versions of the extension for all browsers with `npm run build:all`.

- `npm run build:firefox`
- `npm run build:chrome`
- `npm run build:opera`
- `npm run build:all`

The built versions of the extension are placed in the `build/<browser>/` directories and ZIP files for each will be created in the root of the checked-out repository.
The built versions of the extension are placed in `build/<browser>/` directories and ZIP files for each will be created in the root of the checked-out repository.

4. To load and use the extension locally in your browser...
- **Firefox:** either:
Expand All @@ -132,13 +127,13 @@ Some further info on the test/build process:

- Automated tests are run as a pre-requisite part of the build process; you can also run them with `npm test`.

- You can remove the `build/<browser>/` directories and ZIP files with `npm run clean:<browser>` and `npm run clean:all`, as with the build scripts above.
- You can remove the `build/<browser>/` directories and ZIP files for all browsers with `npm run clean:builds`.

- Because the process of rasterising the SVG to variously-sized PNGs is slow, the PNGs are cached so they only need to be re-generated when the SVG changes. You can clean out the cache with `npm run clean:cache`.
- Because the process of rasterising the SVG to variously-sized PNGs is slow, the PNGs are cached so they only need to be re-generated when the SVG changes. They are cached in the `build/png-cache/` directory.

- The `pre-commit` hook is used to ensure only code that passes tests is committed (it does this by running a build, which, in turn, runs the tests). [Husky](https://github.com/typicode/husky) manages this so that a build is run before you are asked for a commit message.

- The `build:chrome:test` script is provided for making an alpha/beta/test build for Chrome, which is the same as a normal build, but the extension is retitled to "Landmarks (test version)". A separate extension listing is required for publishing test versions in the Chrome Web Store. For Firefox Add-ons, a version number such as "2.1.0beta1" can be used and the built package can be uploaded to the extension's beta channel.
- For advanced use, you can run the build script directly (which bypasses the tests, beware) with `node scripts/build.js --help`.

### Test pages

Expand Down
Loading

0 comments on commit 48e5aeb

Please sign in to comment.