Skip to content

Commit 4c78d4a

Browse files
josephfrazierstefanbuck
authored andcommitted
package.json: Add chrome-open script (#247)
Like the `firefox-open` script, this builds and loads the extension into an isolated instance of Chrome, using [chrome-launch]. This has a couple of benefits: 1. New developers can get up-and-running faster 2. It's easier to test Chrome without any other user settings One caveat so far is that Chrome opens in the background rather than the foreground, but this is alleviated by printing a message out informing the developer. [chrome-launch]: https://github.com/hughsk/chrome-launch
1 parent 78c5877 commit 4c78d4a

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ To build and run the extension follow these steps.
1818
* [Python]
1919
* [project.json]
2020
0. Build and load the extension:
21-
* Chrome:
21+
* Firefox (Quickstart):
22+
0. `npm run firefox-open`
23+
* Chrome (Quickstart):
24+
0. `npm run chrome-open`
25+
* Chrome (Long Version):
2226
0. To build the extension once run `npm run chrome-build` or `npm run chrome-watch` during development.
2327
0. Load extension https://developer.chrome.com/extensions/getstarted#unpacked.
24-
* Firefox:
25-
0. `npm run firefox-open`
2628

2729
[Docker]: https://github.com/OctoLinker/browser-extension/commit/33a2e60
2830
[vimrc]: https://github.com/OctoLinker/browser-extension/commit/7e21743

npm-shrinkwrap.json

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"chrome-dist": "npm run chrome-build -- -p",
2020
"chrome-watch": "npm run chrome-manifest && webpack --watch",
2121
"chrome-pack": "npm run chrome-dist && mkdirp out && zip -rj out/chrome-octolinker-$npm_package_version.zip dist",
22+
"chrome-open": "npm run chrome-build && ./scripts/chrome-launch.js",
2223
"firefox-manifest": "mkdirp dist && cp assets/manifest.json dist/manifest.json",
2324
"firefox-build": "npm run firefox-manifest && webpack",
2425
"firefox-dist": "npm run firefox-build -- -p",
@@ -48,6 +49,7 @@
4849
"babel-loader": "6.2.10",
4950
"babel-plugin-transform-object-rest-spread": "6.20.2",
5051
"babel-preset-es2015": "6.18.0",
52+
"chrome-launch": "1.1.4",
5153
"chrome-webstore-upload-cli": "1.1.0",
5254
"copy-webpack-plugin": "4.0.1",
5355
"eslint": "3.12.2",

scripts/chrome-launch.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env node
2+
3+
const chromeLaunch = require('chrome-launch'); // eslint-disable-line import/no-extraneous-dependencies
4+
5+
const url = 'https://github.com/OctoLinker/browser-extension/blob/master/package.json';
6+
const args = ['--load-extension=./dist'];
7+
8+
chromeLaunch(url, { args });
9+
console.log('A new instance of Chrome should now be open in the background.'); // eslint-disable-line no-console

0 commit comments

Comments
 (0)