Skip to content

Commit adff9dd

Browse files
authored
Refactor extension builds (#1265)
* Update for Edge build * Refactor builds * Update permissions * Update tests
1 parent 27f13c0 commit adff9dd

22 files changed

+381
-227
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,21 @@ jobs:
3838
env:
3939
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4040
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
42+
- name: Archive Chrome Extension
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: Chrome extension
46+
path: extension/chrome/dist/chrome.zip
47+
48+
- name: Archive Edge Extension
49+
uses: actions/upload-artifact@v3
50+
with:
51+
name: Edge extension
52+
path: extension/edge/dist/edge.zip
53+
54+
- name: Archive Firefox Extension
55+
uses: actions/upload-artifact@v3
56+
with:
57+
name: Edge extension
58+
path: extension/firefox/dist/firefox.zip

extension/.eslintignore

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
node_modules
2-
build
3-
dev
4-
webpack/replace
5-
examples
6-
npm-package
7-
_book
1+
node_modules
2+
dist
3+
examples

extension/.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
11
node_modules
2-
npm-debug.log
3-
.DS_Store
4-
.idea/
5-
dist/
6-
build/
7-
dev/
8-
tmp/
9-
_book
2+
dist

extension/chrome/manifest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"version": "3.0.11",
33
"name": "Redux DevTools",
4-
"short_name": "Redux DevTools",
54
"description": "Redux DevTools for debugging application's state changes.",
65
"homepage_url": "https://github.com/reduxjs/redux-devtools",
76
"manifest_version": 2,

extension/edge/manifest.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"version": "3.0.11",
3+
"name": "Redux DevTools",
4+
"description": "Redux DevTools for debugging application's state changes.",
5+
"homepage_url": "https://github.com/reduxjs/redux-devtools",
6+
"manifest_version": 2,
7+
"page_action": {
8+
"default_icon": "img/logo/gray.png",
9+
"default_title": "Redux DevTools",
10+
"default_popup": "window.html#popup"
11+
},
12+
"commands": {
13+
"devtools-left": {
14+
"description": "DevTools window to left"
15+
},
16+
"devtools-right": {
17+
"description": "DevTools window to right"
18+
},
19+
"devtools-bottom": {
20+
"description": "DevTools window to bottom"
21+
},
22+
"devtools-remote": {
23+
"description": "Remote DevTools"
24+
},
25+
"_execute_page_action": {
26+
"suggested_key": {
27+
"default": "Ctrl+Shift+E"
28+
}
29+
}
30+
},
31+
"icons": {
32+
"16": "img/logo/16x16.png",
33+
"48": "img/logo/48x48.png",
34+
"128": "img/logo/128x128.png"
35+
},
36+
"options_ui": {
37+
"page": "options.html",
38+
"chrome_style": true
39+
},
40+
"background": {
41+
"scripts": ["background.bundle.js"],
42+
"persistent": false
43+
},
44+
"content_scripts": [
45+
{
46+
"matches": ["<all_urls>"],
47+
"exclude_globs": ["https://www.google*"],
48+
"js": ["content.bundle.js", "pagewrap.bundle.js"],
49+
"run_at": "document_start",
50+
"all_frames": true
51+
}
52+
],
53+
"devtools_page": "devtools.html",
54+
"web_accessible_resources": ["page.bundle.js"],
55+
"externally_connectable": {
56+
"ids": ["*"]
57+
},
58+
"permissions": [
59+
"notifications",
60+
"contextMenus",
61+
"storage",
62+
"file:///*",
63+
"http://*/*",
64+
"https://*/*"
65+
],
66+
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'; style-src * 'unsafe-inline'; img-src 'self' data:;"
67+
}

extension/package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111
"url": "https://github.com/reduxjs/redux-devtools.git"
1212
},
1313
"scripts": {
14-
"start": "webpack --config webpack/dev.config.babel.js",
15-
"build": "pnpm run build:extension && pnpm run build:firefox",
16-
"build:extension": "rimraf build/extension && webpack --config webpack/wrap.config.babel.js && webpack --config webpack/prod.config.babel.js",
17-
"build:firefox": "webpack --config webpack/prod.firefox.config.babel.js",
14+
"start": "webpack --env development --watch",
15+
"build": "pnpm run build:extension && pnpm run build:chrome && pnpm run build:edge && pnpm run build:firefox",
16+
"build:extension": "webpack --env production && webpack --config wrap.webpack.config.js",
17+
"build:chrome": "cpy dist/** chrome/dist/unpacked && cpy manifest.json dist/unpacked --cwd chrome && bestzip chrome/dist/chrome.zip chrome/dist/unpacked",
18+
"build:edge": "cpy dist/** edge/dist/unpacked && cpy manifest.json dist/unpacked --cwd edge && bestzip edge/dist/edge.zip edge/dist/unpacked",
19+
"build:firefox": "cpy dist/** firefox/dist/unpacked && cpy manifest.json dist/unpacked --cwd firefox && bestzip firefox/dist/firefox.zip firefox/dist/unpacked",
1820
"build:examples": "babel-node examples/buildAll.js",
19-
"precompress:extension": "pnpm run lint && pnpm run test:app && pnpm run build:extension && pnpm run test:chrome && pnpm run test:electron",
20-
"precompress:firefox": "pnpm run lint && pnpm run build:firefox && pnpm run test:app",
21-
"compress:extension": "bestzip build/extension.zip build/extension",
22-
"compress:firefox": "bestzip build/extension.zip build/extension",
23-
"clean": "rimraf build && rimraf dev",
21+
"clean": "rimraf dist && rimraf chrome/dist && rimraf edge/dist && rimraf firefox/dist",
2422
"test:app": "cross-env BABEL_ENV=test jest test/app",
2523
"test:chrome": "jest test/chrome",
2624
"test:electron": "pnpm run build:test:electron:fixture && jest test/electron",
@@ -68,6 +66,7 @@
6866
"bestzip": "^2.2.1",
6967
"chromedriver": "^106.0.1",
7068
"copy-webpack-plugin": "^11.0.0",
69+
"cpy-cli": "^4.2.0",
7170
"cross-env": "^7.0.3",
7271
"css-loader": "^6.7.1",
7372
"electron": "^21.1.1",
@@ -82,7 +81,6 @@
8281
"immutable": "^4.1.0",
8382
"jest": "^29.2.2",
8483
"jest-environment-jsdom": "^29.2.2",
85-
"path-browserify": "^1.0.1",
8684
"pug-html-loader": "^1.1.5",
8785
"raw-loader": "^4.0.2",
8886
"react-transform-catch-errors": "^1.0.2",

extension/src/options/EditorGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default ({ options, saveOption }: OptionsProps) => {
2323
<label className="option__label" htmlFor="editor-browser">
2424
{navigator.userAgent.indexOf('Firefox') !== -1
2525
? "Don't open in external editor"
26-
: "Use browser's debugger (from Chrome devpanel only)"}
26+
: "Use browser's debugger (from browser devpanel only)"}
2727
</label>
2828
</div>
2929

extension/src/options/MiscellaneousGroup.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import React from 'react';
22
import { OptionsProps } from './Options';
33

44
export default ({ options, saveOption }: OptionsProps) => {
5-
const browserName = navigator.userAgent.includes('Firefox')
6-
? 'Firefox'
7-
: 'Chrome';
8-
95
return (
106
<fieldset className="option-group">
117
<legend className="option-group__title">Miscellaneous</legend>
@@ -46,7 +42,7 @@ export default ({ options, saveOption }: OptionsProps) => {
4642
Show errors
4743
</label>
4844
<div className="option__hint">
49-
Show the {browserName} notifications when errors occur in the app
45+
Show the browser notifications when errors occur in the app
5046
</div>
5147
</div>
5248
</fieldset>

extension/src/pageScriptWrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ let s = document.createElement('script');
22
s.type = 'text/javascript';
33

44
if (process.env.NODE_ENV === 'production') {
5-
const { default: script } = require('raw-loader!tmp/page.bundle.js');
5+
const { default: script } = require('raw-loader!../dist/page.bundle.js');
66
s.appendChild(document.createTextNode(script));
77
(document.head || document.documentElement).appendChild(s);
88
s.parentNode!.removeChild(s);

extension/test/chrome/extension.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import chromedriver from 'chromedriver';
55
import { switchMonitorTests, delay } from '../utils/e2e';
66

77
const port = 9515;
8-
const path = resolve(__dirname, '..', '..', 'build', 'extension');
8+
const path = resolve(__dirname, '..', '..', 'dist');
99
const extensionId = 'lmhkpmbekcpmknklioeibfkpmmfibljd';
1010
const actionsPattern =
1111
/^@@INIT(.|\n)+@@reduxReactRouter\/routerDidChange(.|\n)+@@reduxReactRouter\/initRoutes(.|\n)+$/;

0 commit comments

Comments
 (0)