Skip to content

Commit 5fc9742

Browse files
author
Brian Vaughn
authored
Remove dependency on local git checkout from build process (facebook#17475)
* Remove dependency on local git checkout from build process * Updated Webpack dependencies to account for recent changes to deps for Flight
1 parent 6470e0f commit 5fc9742

File tree

11 files changed

+33
-73
lines changed

11 files changed

+33
-73
lines changed

packages/react-devtools-core/webpack.backend.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const {resolve} = require('path');
22
const {DefinePlugin} = require('webpack');
33
const {
4-
getGitHubURL,
4+
GITHUB_URL,
55
getVersionString,
66
} = require('react-devtools-extensions/utils');
77

@@ -15,7 +15,6 @@ const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');
1515

1616
const __DEV__ = NODE_ENV === 'development';
1717

18-
const GITHUB_URL = getGitHubURL();
1918
const DEVTOOLS_VERSION = getVersionString();
2019

2120
module.exports = {

packages/react-devtools-core/webpack.standalone.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const {resolve} = require('path');
22
const {DefinePlugin} = require('webpack');
33
const {
4-
getGitHubURL,
4+
GITHUB_URL,
55
getVersionString,
66
} = require('react-devtools-extensions/utils');
77

@@ -15,7 +15,6 @@ const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');
1515

1616
const __DEV__ = NODE_ENV === 'development';
1717

18-
const GITHUB_URL = getGitHubURL();
1918
const DEVTOOLS_VERSION = getVersionString();
2019

2120
module.exports = {

packages/react-devtools-extensions/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
32
"name": "react-devtools-extensions",
43
"version": "0.0.0",
54
"private": true,
@@ -26,18 +25,18 @@
2625
"babel-core": "^7.0.0-bridge",
2726
"babel-eslint": "^9.0.0",
2827
"babel-loader": "^8.0.4",
29-
"chrome-launch": "^1.1.4",
3028
"child-process-promise": "^2.2.1",
31-
"css-loader": "^1.0.1",
29+
"chrome-launch": "^1.1.4",
3230
"crx": "^5.0.0",
31+
"css-loader": "^1.0.1",
3332
"firefox-profile": "^1.0.2",
3433
"node-libs-browser": "0.5.3",
3534
"nullthrows": "^1.0.0",
3635
"raw-loader": "^3.1.0",
3736
"style-loader": "^0.23.1",
3837
"web-ext": "^3.0.0",
39-
"webpack": "^4.26.0",
40-
"webpack-cli": "^3.1.2",
38+
"webpack": "^4.41.2",
39+
"webpack-cli": "^3.3.10",
4140
"webpack-dev-server": "^3.3.1"
4241
}
4342
}

packages/react-devtools-extensions/utils.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,17 @@ const {execSync} = require('child_process');
22
const {readFileSync} = require('fs');
33
const {resolve} = require('path');
44

5-
function getGitCommit() {
6-
return execSync('git show -s --format=%h')
7-
.toString()
8-
.trim();
9-
}
5+
const GITHUB_URL = 'https://github.com/facebook/react';
106

11-
function getGitHubURL() {
12-
// TODO potentially replace this with an fb.me URL (assuming it can forward the query params)
13-
const url = execSync('git remote get-url origin')
14-
.toString()
15-
.trim();
16-
17-
if (url.startsWith('https://')) {
18-
return url.replace('.git', '');
19-
} else {
20-
return url
21-
.replace(':', '/')
22-
.replace('git@', 'https://')
23-
.replace('.git', '');
7+
function getGitCommit() {
8+
try {
9+
return execSync('git show -s --format=%h')
10+
.toString()
11+
.trim();
12+
} catch (error) {
13+
// Mozilla runs this command from a git archive.
14+
// In that context, there is no Git revision.
15+
return null;
2416
}
2517
}
2618

@@ -36,4 +28,8 @@ function getVersionString() {
3628
return `${packageVersion}-${commit}`;
3729
}
3830

39-
module.exports = {getGitCommit, getGitHubURL, getVersionString};
31+
module.exports = {
32+
GITHUB_URL,
33+
getGitCommit,
34+
getVersionString,
35+
};

packages/react-devtools-extensions/webpack.backend.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const {resolve} = require('path');
44
const {DefinePlugin} = require('webpack');
5-
const {getGitHubURL, getVersionString} = require('./utils');
5+
const {GITHUB_URL, getVersionString} = require('./utils');
66

77
const NODE_ENV = process.env.NODE_ENV;
88
if (!NODE_ENV) {
@@ -14,7 +14,6 @@ const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');
1414

1515
const __DEV__ = NODE_ENV === 'development';
1616

17-
const GITHUB_URL = getGitHubURL();
1817
const DEVTOOLS_VERSION = getVersionString();
1918

2019
module.exports = {

packages/react-devtools-extensions/webpack.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const {resolve} = require('path');
44
const {DefinePlugin} = require('webpack');
5-
const {getGitHubURL, getVersionString} = require('./utils');
5+
const {GITHUB_URL, getVersionString} = require('./utils');
66

77
const NODE_ENV = process.env.NODE_ENV;
88
if (!NODE_ENV) {
@@ -14,7 +14,6 @@ const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');
1414

1515
const __DEV__ = NODE_ENV === 'development';
1616

17-
const GITHUB_URL = getGitHubURL();
1817
const DEVTOOLS_VERSION = getVersionString();
1918

2019
module.exports = {

packages/react-devtools-inline/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"css-loader": "^1.0.1",
3939
"raw-loader": "^3.1.0",
4040
"style-loader": "^0.23.1",
41-
"webpack": "^4.26.0",
42-
"webpack-cli": "^3.1.2",
41+
"webpack": "^4.41.2",
42+
"webpack-cli": "^3.3.10",
4343
"webpack-dev-server": "^3.3.1"
4444
}
4545
}

packages/react-devtools-inline/webpack.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const {resolve} = require('path');
22
const {DefinePlugin} = require('webpack');
33
const {
4-
getGitHubURL,
4+
GITHUB_URL,
55
getVersionString,
66
} = require('react-devtools-extensions/utils');
77

@@ -13,7 +13,6 @@ if (!NODE_ENV) {
1313

1414
const __DEV__ = true; // NODE_ENV === 'development';
1515

16-
const GITHUB_URL = getGitHubURL();
1716
const DEVTOOLS_VERSION = getVersionString();
1817

1918
module.exports = {

packages/react-devtools-shell/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"css-loader": "^1.0.1",
2727
"raw-loader": "^3.1.0",
2828
"style-loader": "^0.23.1",
29-
"webpack": "^4.26.0",
30-
"webpack-cli": "^3.1.2",
29+
"webpack": "^4.41.2",
30+
"webpack-cli": "^3.3.10",
3131
"webpack-dev-server": "^3.3.1"
3232
}
3333
}

packages/react-devtools-shell/webpack.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const {resolve} = require('path');
22
const {DefinePlugin} = require('webpack');
33
const {
4-
getGitHubURL,
4+
GITHUB_URL,
55
getVersionString,
66
} = require('react-devtools-extensions/utils');
77

@@ -21,7 +21,6 @@ const builtModulesDir = resolve(__dirname, '..', '..', 'build', 'node_modules');
2121

2222
const __DEV__ = NODE_ENV === 'development';
2323

24-
const GITHUB_URL = getGitHubURL();
2524
const DEVTOOLS_VERSION = getVersionString();
2625

2726
const config = {

0 commit comments

Comments
 (0)