Skip to content
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

Merged
merged 5 commits into from
May 15, 2020
Merged

Conversation

sbrudz
Copy link
Contributor

@sbrudz sbrudz commented May 13, 2020

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 run npm run build and then go to the chrome://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.

Copy link
Contributor

@steveatdm steveatdm left a 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)

Copy link
Contributor

@yutingcxiang yutingcxiang left a 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.

@sbrudz sbrudz merged commit f58bd19 into beta May 15, 2020
@sbrudz
Copy link
Contributor Author

sbrudz commented May 15, 2020

@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.

@github-actions
Copy link

github-actions bot commented Aug 5, 2020

🎉 This PR is included in version 2.0.0-beta.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Aug 5, 2020

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants