From 77f92701318383658276ecfaf87fe86a9449c376 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Sun, 29 Oct 2017 13:58:50 +0100 Subject: [PATCH] Change webpack to only copy the html files to popup/app. Update readme with more instructions for building. (#336) --- README.md | 19 +++++++++++++++---- package.json | 6 +++--- webpack.common.js | 6 +++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 45ba463806..1e4c035cb2 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,10 @@ The bitwarden browser extension is written using the Chrome Web Extension API an By default the extension is targeting the production API. If you are running the [Core](https://github.com/bitwarden/core) API locally, you'll need to switch the extension to target your local instance. Open `src/services/apiService.js` and set `self.baseUrl` and `self.identityBaseUrl` to your local API instance (ex. `http://localhost:5000`). Then run the following commands: - -- `npm install` -- `gulp build` -- `npm run dev:watch` +```bash +npm install +npm run dev:watch +``` You can now load the extension into your browser through the browser's extension tools page: @@ -42,6 +42,17 @@ You can now load the extension into your browser through the browser's extension 1. Type `about:debugging` in your address bar to bring up the add-ons page. 2. Click the `Load Temporary Add-on` button, navigate to the `dist/manifest.json` file, and "Open". +### Release + +To build the the extension for production the following commands should be run: + +```bash +npm run prod +gulp dist:[browser] +``` + +Where `[browser]` is the web browser to target. Currently the following web browsers are supported: `chrome`, `edge`, `firefox` and `opera`. + # Contribute Code contributions are welcome! Please commit any pull requests against the `master` branch. Learn more about how to contribute by reading the [`CONTRIBUTING.md`](CONTRIBUTING.md) file. diff --git a/package.json b/package.json index f220a0fab2..1d982aa645 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,9 @@ "version": "0.0.0", "scripts": { "start:firefox": "web-ext run --source-dir ./dist/", - "dev": "webpack --config webpack.dev.js", - "dev:watch": "webpack --config webpack.dev.js --watch", - "prod": "webpack --config webpack.prod.js" + "dev": "gulp build && webpack --config webpack.dev.js", + "dev:watch": "gulp build && webpack --config webpack.dev.js --watch", + "prod": "gulp build && webpack --config webpack.prod.js" }, "devDependencies": { "angular": "1.6.6", diff --git a/webpack.common.js b/webpack.common.js index d09e3c8533..7229d2c361 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -73,7 +73,11 @@ module.exports = { new CopyWebpackPlugin([ // Temporarily copy the whole app folder, can be removed once // the templates uses template rather than using templateUrl. - { from: './src/popup/app', to: 'popup/app' }, + { + context: 'src/popup/app', + from: '**/*.html', + to: 'popup/app' + }, './src/manifest.json', { from: './src/_locales', to: '_locales' }, { from: './src/edge', to: 'edge' },