Skip to content

Commit ede01ff

Browse files
authored
Merge pull request #237 from jhen0409/patch-7
Deprecated `inject.bundle.js`, use `redux-devtools-extension.js` instead
2 parents a4045b8 + 591b9cc commit ede01ff

File tree

7 files changed

+40
-14
lines changed

7 files changed

+40
-14
lines changed

docs/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Just add `?debug_session=<session_name>` to the url.
4949
#### How to include it in chrome apps and extensions
5050
Unlike web apps, Chrome extension doesn't inject anything in other chrome extensions or apps, so you have to do it by yourself to allow debugging. Just add:
5151
```
52-
<script src="chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/inject.bundle.js"></script>
52+
<script src="chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/redux-devtools-extension.js"></script>
5353
```
5454
To include it in a chrome extension's content script follow [the example](https://github.com/zalmoxisus/browser-redux/commit/df2db9ee11f2d197c4329b2c8a6e197da1edffd4).
5555
#### How to open DevTools programmatically

gulpfile.babel.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,27 @@ gulp.task('copy:dev', () => {
6565
*/
6666

6767
gulp.task('webpack:build:extension', (callback) => {
68-
function webpackProcess(config, next) {
69-
webpack(config, (err, stats) => {
70-
if (err) {
71-
throw new gutil.PluginError('webpack:build', err);
72-
}
73-
gutil.log('[webpack:build]', stats.toString({ colors: true }));
74-
next();
75-
});
68+
function webpackProcess(config) {
69+
return new Promise((resolve, reject) =>
70+
webpack(config, (err, stats) => {
71+
if (err) {
72+
reject(new gutil.PluginError('webpack:build', err));
73+
}
74+
gutil.log('[webpack:build]', stats.toString({ colors: true }));
75+
resolve();
76+
})
77+
);
7678
}
77-
webpackProcess(wrapConfig, () => { webpackProcess(prodConfig, callback); });
79+
webpackProcess(wrapConfig)
80+
.then(() => webpackProcess(prodConfig))
81+
.then(() => {
82+
const dest = './build/extension';
83+
fs.rename(
84+
`${dest}/js/redux-devtools-extension.bundle.js`,
85+
`${dest}/js/redux-devtools-extension.js`,
86+
callback
87+
);
88+
});
7889
});
7990

8091
gulp.task('views:build:extension', () => {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Deprecated warning for inject.bundle.js
2+
const prefix = `chrome-extension://${window.devToolsExtensionID}/js/`;
3+
console.warn(
4+
`Using '${prefix}inject.bundle.js' is deprecated. ` +
5+
`Please use '${prefix}redux-devtools-extension.js' instead.`
6+
);

src/browser/extension/inject/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Include this script in Chrome apps and extensions for remote debugging
2-
// <script src="chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/inject.bundle.js"></script>
2+
// <script src="chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/redux-devtools-extension.js"></script>
33

44
window.devToolsExtensionID = 'lmhkpmbekcpmknklioeibfkpmmfibljd';
55
require('./contentScript');

src/browser/extension/manifest.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@
5252
}
5353
],
5454
"devtools_page": "devtools.html",
55-
"web_accessible_resources": ["js/page.bundle.js", "js/inject.bundle.js"],
55+
"web_accessible_resources": [
56+
"js/page.bundle.js",
57+
"js/inject.bundle.js",
58+
"js/redux-devtools-extension.js"
59+
],
5660
"externally_connectable": {
5761
"ids": ["*"]
5862
},

src/browser/firefox/manifest.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@
6060
"all_frames": true
6161
}
6262
],
63-
"web_accessible_resources": ["js/page.bundle.js", "js/inject.bundle.js"],
63+
"web_accessible_resources": [
64+
"js/page.bundle.js",
65+
"js/inject.bundle.js",
66+
"js/redux-devtools-extension.js"
67+
],
6468
"permissions": ["notifications", "contextMenus", "tabs", "storage", "<all_urls>"],
6569
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'; style-src * 'unsafe-inline'; img-src 'self' data:;"
6670
}

webpack/base.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const baseConfig = (params) => ({
1414
devtools: [ `${extpath}devtools/index` ],
1515
content: [ mock, `${extpath}inject/contentScript` ],
1616
pagewrap: [ `${extpath}inject/pageScriptWrap` ],
17-
inject: [ `${extpath}inject/index` ],
17+
'redux-devtools-extension': [ `${extpath}inject/index` ],
18+
inject: [ `${extpath}inject/index`, `${extpath}inject/deprecatedWarn` ],
1819
...params.inputExtra
1920
},
2021
output: {

0 commit comments

Comments
 (0)