Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Add npm run watch script for file watching (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorchard authored and linuxwolf committed Dec 14, 2018
1 parent d4b5525 commit 37455c5
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 1 deletion.
18 changes: 18 additions & 0 deletions docs/developer/install.md
Expand Up @@ -77,6 +77,24 @@ example data) using Firefox Nightly, you can just run (without adding flags):
npm run run
```

## Running the extension with file watchers

To **run the extension with reloading on file change**:

```sh
npm run watch
```

This command will run the extension in Firefox. Additionally, it will start
watch processes that will do the following on any file change:

* run JS and CSS linting
* rebuild the extension
* reload the extension in the browser

Note that you will need to set `webext_runflags` to specify flags for running
Firefox, as this command does not accept any options.

## Testing the extension

There are two forms of autmomated testing present: unit (test individual classes as much in isolation to everything else -- including the browser internals) and integration.
Expand Down
153 changes: 153 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion package.json
Expand Up @@ -28,9 +28,17 @@
"run": "cross-env-shell web-ext run --source-dir ./dist ${npm_config_webext_runflags}",
"pretest": "npm run autolint && npm run clean:coverage",
"test": "cross-env NODE_ENV=test karma start --single-run",
"test:watch": "cross-env NODE_ENV=test karma start",
"preintegration": "cross-env NODE_ENV=test npm run build",
"integration": "cross-env NODE_ENV=test mocha --require @babel/register --timeout 10000 test/integration/**/*-test.js",
"codecov": "codecov"
"codecov": "codecov",
"prewatch": "npm run build",
"watch": "npm-run-all --parallel :watch:*",
":watch:build": "webpack --watch",
":watch:run": "cross-env-shell web-ext run --source-dir ./dist ${npm_config_webext_runflags}",
":watch:lint": "npm-run-all --parallel :watch:lint:*",
":watch:lint:js": "onchange -v \"src/**/*.js\" -- npm run :autolint:js",
":watch:lint:css": "onchange -v \"{docs,src}/**/*.css\" -- npm run :autolint:css"
},
"author": "Lockbox Team <lockbox-dev@mozilla.com>",
"license": "MPL-2.0",
Expand Down Expand Up @@ -72,6 +80,8 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.5",
"mocha": "^5.2.0",
"npm-run-all": "^4.1.5",
"onchange": "^5.2.0",
"redux-mock-store": "^1.5.3",
"sinon": "^6.3.5",
"sinon-chai": "^3.2.0",
Expand Down

0 comments on commit 37455c5

Please sign in to comment.