Updated Chrome installation
1. Removed auto-updates XML (since the feature doens't work for self hosted extensions) 2. Replaced CRX with packed ZIP (since people are having trouble with the CRX, and auto-udpates doesn't work anyway)
Brian Vaughn committed
May 28, 2019 at 08:52 UTC
92c2d8366b77e94125010a626c1a56e4b4f94864
11 files changed
+21
-120
package.json
+1
-3
@@ -90,7 +90,6 @@
90
"cli-spinners": "^1.0.0",
91
"clipboard-js": "^0.3.6",
92
"cross-env": "^5.2.0",
93
- "crx": "git+https://github.com/oncletom/crx#ef150e8",
93
"css-loader": "^1.0.1",
94
"error-stack-parser": "^2.0.2",
95
"es6-symbol": "3.0.2",
@@ -147,7 +146,6 @@
146
"web-ext": "^3.0.0",
147
"webpack": "^4.26.0",
148
"webpack-cli": "^3.1.2",
150
- "webpack-dev-server": "^3.3.1",
151
- "xml-js": "^1.6.11"
149
+ "webpack-dev-server": "^3.3.1"
150
}
151
}
shells/browser/chrome/build.js
+1
-27
@@ -1,36 +1,10 @@
1
#!/usr/bin/env node
2
3
const chalk = require('chalk');
4
-const { execSync } = require('child_process');
5
-const { join } = require('path');
6
-const rp = require('request-promise');
7
-const convert = require('xml-js');
4
const build = require('../shared/build');
9
-const rimraf = require('rimraf');
5
6
const main = async () => {
12
- const manifestVersion = await rp(
13
- 'https://react-devtools-experimental-chrome.now.sh/updates.xml'
14
- )
15
- .then(xmlString => {
16
- const parsedXML = convert.xml2js(xmlString);
17
- const version =
18
- parsedXML.elements[0].elements[0].elements[0].attributes.version;
19
- const match = /(\d)\.(\d)\.(\d)\.*(\d)*/.exec(version);
20
- if (match !== null) {
21
- const prerelease = parseInt(match[4], 10) || 0;
22
- return `${match[1]}.${match[2]}.${match[3]}.${prerelease + 1}`;
23
- }
24
- })
25
- .catch(error => null);
26
-
27
- await build('chrome', manifestVersion);
28
-
29
- const cwd = join(__dirname, 'build');
30
- execSync('crx pack ./unpacked -o ReactDevTools.crx -p ../../../../key.pem', {
31
- cwd,
32
- });
33
- rimraf.sync(join(cwd, 'packed.zip'));
7
+ await build('chrome');
8
9
console.log(chalk.green('\nThe Chrome extension has been built!'));
10
console.log(chalk.green('You can test this build by running:'));
shells/browser/chrome/manifest.json
-2
@@ -4,8 +4,6 @@
4
"description": "Adds React debugging tools to the Chrome Developer Tools.",
5
"version": "4.0.0",
6
7
- "update_url": "https://react-devtools-experimental-chrome.now.sh/updates.xml",
8
-
7
"minimum_chrome_version": "49",
8
9
"icons": {
shells/browser/chrome/now.json
+1
-1
@@ -1,5 +1,5 @@
1
{
2
"name": "react-devtools-experimental-chrome",
3
"alias": ["react-devtools-experimental-chrome"],
4
- "files": ["index.html", "updates.xml", "ReactDevTools.crx"]
4
+ "files": ["index.html", "ReactDevTools.zip"]
5
}
shells/browser/chrome/updates.xml
deleted
-6
@@ -1,6 +0,0 @@
1
-<?xml version='1.0' encoding='UTF-8'?>
2
-<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
3
- <app appid='akkpaehpnolchhkkfbedcdcikfdnjobk'>
4
- <updatecheck codebase='https://react-devtools-experimental-chrome.now.sh/ReactDevTools.crx' version='4.0.0' />
5
- </app>
6
-</gupdate>
\ No newline at end of file
shells/browser/firefox/now.json
+1
-1
@@ -1,5 +1,5 @@
1
{
2
"name": "react-devtools-experimental-firefox",
3
"alias": ["react-devtools-experimental-firefox"],
4
- "files": ["index.html", "packed.zip"]
4
+ "files": ["index.html", "ReactDevTools.zip"]
5
}
shells/browser/shared/build.js
+8
-11
@@ -17,7 +17,7 @@ const preProcess = async (destinationPath, tempPath) => {
17
await ensureDir(tempPath); // Create temp dir for this new build
18
};
19
20
-const build = async (tempPath, manifestPath, manifestVersion) => {
20
+const build = async (tempPath, manifestPath) => {
21
const binPath = join(tempPath, 'bin');
22
const zipPath = join(tempPath, 'zip');
23
@@ -62,16 +62,13 @@ const build = async (tempPath, manifestPath, manifestVersion) => {
62
const commit = getGitCommit();
63
64
const manifest = JSON.parse(readFileSync(copiedManifestPath).toString());
65
- manifest.description += `\n\nCreated from revision ${commit}`;
66
- if (manifestVersion) {
67
- manifest.version = manifestVersion;
68
- manifest.version_name = `${manifestVersion} ${commit}`;
69
- }
65
+ manifest.description += `\n\nCreated from revision ${commit} (${new Date().toLocaleDateString()})`;
66
+ manifest.version_name = `${commit} (${new Date().toLocaleDateString()})`;
67
writeFileSync(copiedManifestPath, JSON.stringify(manifest, null, 2));
68
69
// Pack the extension
70
const archive = archiver('zip', { zlib: { level: 9 } });
74
- const zipStream = createWriteStream(join(tempPath, 'packed.zip'));
71
+ const zipStream = createWriteStream(join(tempPath, 'ReactDevTools.zip'));
72
await new Promise((resolve, reject) => {
73
archive
74
.directory(zipPath, false)
@@ -84,8 +81,8 @@ const build = async (tempPath, manifestPath, manifestVersion) => {
81
82
const postProcess = async (tempPath, destinationPath) => {
83
const unpackedSourcePath = join(tempPath, 'zip');
87
- const packedSourcePath = join(tempPath, 'packed.zip');
88
- const packedDestPath = join(destinationPath, 'packed.zip');
84
+ const packedSourcePath = join(tempPath, 'ReactDevTools.zip');
85
+ const packedDestPath = join(destinationPath, 'ReactDevTools.zip');
86
const unpackedDestPath = join(destinationPath, 'unpacked');
87
88
await move(unpackedSourcePath, unpackedDestPath); // Copy built files to destination
@@ -93,7 +90,7 @@ const postProcess = async (tempPath, destinationPath) => {
90
await remove(tempPath); // Clean up temp directory and files
91
};
92
96
-const main = async (buildId, manifestVersion) => {
93
+const main = async buildId => {
94
const root = join(__dirname, '..', buildId);
95
const manifestPath = join(root, 'manifest.json');
96
const destinationPath = join(root, 'build');
@@ -101,7 +98,7 @@ const main = async (buildId, manifestVersion) => {
98
try {
99
const tempPath = join(__dirname, 'build', buildId);
100
await preProcess(destinationPath, tempPath);
104
- await build(tempPath, manifestPath, manifestVersion);
101
+ await build(tempPath, manifestPath);
102
103
const builtUnpackedPath = join(destinationPath, 'unpacked');
104
await postProcess(tempPath, destinationPath);
shells/browser/shared/deploy.chrome.html
+5
-4
@@ -1,7 +1,8 @@
1
<ol>
2
- <li><a href="ReactDevTools.crx">download extension</a></li>
3
- <li>Navigate to <a href="chrome://extensions/">chrome://extensions/</a></li>
2
+ <li><a href="ReactDevTools.zip">download extension</a></li>
3
+ <li>Double-click to extract</li>
4
+ <li>Navigate to <code>chrome://extensions/</code></li>
5
<li>Enable "Developer mode"</li>
5
- <li>Drag <code>ReactDevTools.crx</code> into Chrome</li>
6
- <li>Choose "Add Extension" when prompted</li>
6
+ <li>Click "LOAD UNPACKED"</li>
7
+ <li>Select extracted extension folder (<code>ReactDevTools</code>)</li>
8
</ol>
\ No newline at end of file
shells/browser/shared/deploy.firefox.html
+2
-2
@@ -1,7 +1,7 @@
1
<ol>
2
- <li><a href="packed.zip">download extension</a></li>
2
+ <li><a href="ReactDevTools.zip">download extension</a></li>
3
<li>Extract/unzip</li>
4
<li>Visit <code>about:debugging</code></li>
5
<li>Click "Load Temporary Add-on"</li>
6
- <li>Select the <code>manifest.json</code></li>
6
+ <li>Select the <code>manifest.json</code> file inside of the extracted extension folder (<code>ReactDevTools</code>)</li>
7
</ol>
\ No newline at end of file
shells/browser/shared/deploy.js
-13
@@ -3,7 +3,6 @@
3
const { exec, execSync } = require('child_process');
4
const { readFileSync, writeFileSync } = require('fs');
5
const { join } = require('path');
6
-const convert = require('xml-js');
6
7
const main = async buildId => {
8
const root = join(__dirname, '..', buildId);
@@ -22,18 +21,6 @@ const main = async buildId => {
21
cwd: root,
22
});
23
25
- if (buildId === 'chrome') {
26
- const file = readFileSync(join(buildPath, 'unpacked', 'manifest.json'));
27
- const json = JSON.parse(file);
28
- const { version } = json;
29
-
30
- const xmlString = readFileSync(join(root, 'updates.xml'), 'utf8');
31
- const parsedXML = convert.xml2js(xmlString);
32
- parsedXML.elements[0].elements[0].elements[0].attributes.version = version;
33
-
34
- writeFileSync(join(buildPath, 'updates.xml'), convert.js2xml(parsedXML));
35
- }
36
-
24
const file = readFileSync(join(root, 'now.json'));
25
const json = JSON.parse(file);
26
const alias = json.alias[0];
yarn.lock
+2
-50
@@ -1834,7 +1834,7 @@ asn1.js@^4.0.0:
1834
inherits "^2.0.1"
1835
minimalistic-assert "^1.0.0"
1836
1837
-asn1@^0.2.4, asn1@~0.2.3:
1837
+asn1@~0.2.3:
1838
version "0.2.4"
1839
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"
1840
integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==
@@ -3202,7 +3202,7 @@ commander@^2.11.0, commander@^2.14.1, commander@^2.9.0:
3202
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
3203
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
3204
3205
-commander@^2.19.0, commander@^2.3.0, commander@^2.6.0:
3205
+commander@^2.3.0, commander@^2.6.0:
3206
version "2.20.0"
3207
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
3208
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
@@ -3691,15 +3691,6 @@ crx-parser@0.1.2:
3691
resolved "https://registry.yarnpkg.com/crx-parser/-/crx-parser-0.1.2.tgz#7eeeed9eddc95e22c189382e34624044a89a5a6d"
3692
integrity sha1-fu7tnt3JXiLBiTguNGJARKiaWm0=
3693
3694
-"crx@git+https://github.com/oncletom/crx#ef150e8":
3695
- version "4.0.1"
3696
- resolved "git+https://github.com/oncletom/crx#ef150e8abf1b2e093ce746584680876927c0fc21"
3697
- dependencies:
3698
- archiver "^3.0.0"
3699
- commander "^2.19.0"
3700
- node-rsa "^1.0.3"
3701
- pbf "^3.1.0"
3702
-
3694
cryptiles@3.x.x:
3695
version "3.1.2"
3696
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe"
@@ -6242,11 +6233,6 @@ icss-utils@^2.1.0:
6233
dependencies:
6234
postcss "^6.0.1"
6235
6245
-ieee754@^1.1.12:
6246
- version "1.1.13"
6247
- resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
6248
- integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==
6249
-
6236
ieee754@^1.1.4:
6237
version "1.1.12"
6238
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.12.tgz#50bf24e5b9c8bb98af4964c941cdb0918da7b60b"
@@ -8669,13 +8655,6 @@ node-releases@^1.1.8:
8655
dependencies:
8656
semver "^5.3.0"
8657
8672
-node-rsa@^1.0.3:
8673
- version "1.0.5"
8674
- resolved "https://registry.yarnpkg.com/node-rsa/-/node-rsa-1.0.5.tgz#854dc1b275729d69bc25883f83ca80705db9262e"
8675
- integrity sha512-9o51yfV167CtQANnuAf+5owNs7aIMsAKVLhNaKuRxihsUUnfoBMN5OTVOK/2mHSOWaWq9zZBiRM3bHORbTZqrg==
8676
- dependencies:
8677
- asn1 "^0.2.4"
8678
-
8658
node-version@^1.0.0:
8659
version "1.0.0"
8660
resolved "https://registry.yarnpkg.com/node-version/-/node-version-1.0.0.tgz#1b9b9584a9a7f7a6123f215cd14a652bf21ab19e"
@@ -9254,14 +9233,6 @@ path-type@^3.0.0:
9233
dependencies:
9234
pify "^3.0.0"
9235
9257
-pbf@^3.1.0:
9258
- version "3.2.0"
9259
- resolved "https://registry.yarnpkg.com/pbf/-/pbf-3.2.0.tgz#e76f9f5114e395c25077ad6fe463b3507d6877fc"
9260
- integrity sha512-98Eh7rsJNJF/Im6XYMLaOW3cLnNyedlOd6hu3iWMD5I7FZGgpw8yN3vQBrmLbLodu7G784Irb9Qsv2yFrxSAGw==
9261
- dependencies:
9262
- ieee754 "^1.1.12"
9263
- resolve-protobuf-schema "^2.1.0"
9264
-
9236
pbkdf2-compat@2.0.1:
9237
version "2.0.1"
9238
resolved "https://registry.yarnpkg.com/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz#b6e0c8fa99494d94e0511575802a59a5c142f288"
@@ -9562,11 +9533,6 @@ prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2:
9533
object-assign "^4.1.1"
9534
react-is "^16.8.1"
9535
9565
-protocol-buffers-schema@^3.3.1:
9566
- version "3.3.2"
9567
- resolved "https://registry.yarnpkg.com/protocol-buffers-schema/-/protocol-buffers-schema-3.3.2.tgz#00434f608b4e8df54c59e070efeefc37fb4bb859"
9568
- integrity sha512-Xdayp8sB/mU+sUV4G7ws8xtYMGdQnxbeIfLjyO9TZZRJdztBGhlmbI5x1qcY4TG5hBkIKGnc28i7nXxaugu88w==
9569
-
9536
proxy-addr@~2.0.4:
9537
version "2.0.5"
9538
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34"
@@ -10283,13 +10249,6 @@ resolve-from@^4.0.0:
10249
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
10250
integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==
10251
10286
-resolve-protobuf-schema@^2.1.0:
10287
- version "2.1.0"
10288
- resolved "https://registry.yarnpkg.com/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz#9ca9a9e69cf192bbdaf1006ec1973948aa4a3758"
10289
- integrity sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==
10290
- dependencies:
10291
- protocol-buffers-schema "^3.3.1"
10292
-
10252
resolve-url@^0.2.1:
10253
version "0.2.1"
10254
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
@@ -12325,13 +12284,6 @@ xdg-basedir@^3.0.0:
12284
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"
12285
integrity sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=
12286
12328
-xml-js@^1.6.11:
12329
- version "1.6.11"
12330
- resolved "https://registry.yarnpkg.com/xml-js/-/xml-js-1.6.11.tgz#927d2f6947f7f1c19a316dd8eea3614e8b18f8e9"
12331
- integrity sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==
12332
- dependencies:
12333
- sax "^1.2.4"
12334
-
12287
xml-name-validator@^3.0.0:
12288
version "3.0.0"
12289
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"