-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add watch & reload to help with extension development #89
Conversation
…r beta releases Neither chrome nor firefox manifests support version numbers containing '-beta' strings. Trim this out and but the beta string into the version_name field. See also: - https://developer.chrome.com/extensions/manifest/version - https://developer.mozilla.org/en-US/docs/Mozilla/Toolkit_version_format
Add npm scripts to enable starting a browser session with auto-reloading enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbrudz Very nice!
I started with a freshly cloned repo, ran npm install
and then npm run start:chrome
. I already had a Chrome instance running, so the first time I ran npm run start:chrome
, it did nothing (as warned per your PR comment and README details). After closing all Chrome instances and trying again, it worked.
I did find it interesting that after I stopped the process, closed all Chrome instances and re-opened a new session, and then ran the command again, it worked - I would have expected it to behave the same as when I initially ran it, but perhaps something gets created/set up the first time it runs and is fine there out.
Approved in any case, as it's warned to restart Chrome and works fine otherwise. Below is the stack trace from the first time I had ran it, if you are interested.
10 silly lifecycle [email protected]~start:chrome: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'concurrently "npm:build:watch" "npm:webext:run -- -t chromium"'
10 silly lifecycle ]
11 silly lifecycle [email protected]~start:chrome: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start:chrome: Failed to exec start:chrome script
13 verbose stack Error: [email protected] start:chrome: `concurrently "npm:build:watch" "npm:webext:run -- -t chromium"`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:196:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:196:13)
13 verbose stack at maybeClose (internal/child_process.js:1000:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great feature! Works for me in Chrome. It opened up a new Chrome window and loaded perfectly.
@steveatdm thanks for saving that stack trace. I wasn't able to reproduce it. If we hit the issue again, let's dig into it more to determine what's going on. |
🎉 This PR is included in version 2.0.0-beta.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 2.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This PR adds a script
npm run start:chrome
to build the extension in watch mode and start a fresh chrome browser session with the extension loaded. Any changes you make to the code will result in the extension being reloaded. You sometimes will need to reload the gmail web page for them to show up, but at least you won't need to runnpm run build
and then go to thechrome://extensions
page to click the reload button.This work is a step along the way to adding Firefox support #68 -- there is a
start:firefox
npm script in the PR that works. There are still some issues that need to be resolved, though, such as getting the JustNotSorry icon to show up in the toolbar. Those changes will come in a separate PR. The development watch mode seemed valuable enough to merge in on its own.