Fixed deploy script
Brian Vaughn committed
May 3, 2019 at 08:55 UTC
435e22ad1be514ce2ef844217aafb1ae57dd7eeb
6 files changed
+39
-17
.gitignore
+1
@@ -3,6 +3,7 @@
3
/shells/browser/firefox/*.xpi
4
/shells/browser/firefox/*.pem
5
/shells/browser/shared/build
6
+/shells/dev/dist
7
build
8
node_modules
9
npm-debug.log
package.json
+4
-3
@@ -30,6 +30,7 @@
30
]
31
},
32
"scripts": {
33
+ "build:demo": "cd ./shells/dev && cross-env NODE_ENV=development cross-env TARGET=remote webpack --config webpack.config.js",
34
"build:extension": "cross-env NODE_ENV=production yarn run build:extension:chrome && yarn run build:extension:firefox",
35
"build:extension:dev": "cross-env NODE_ENV=development yarn run build:extension:chrome && yarn run build:extension:firefox",
36
"build:extension:chrome": "cross-env NODE_ENV=production node ./shells/browser/chrome/build",
@@ -38,7 +39,7 @@
39
"build:extension:firefox:dev": "cross-env NODE_ENV=development node ./shells/browser/firefox/build",
40
"build:standalone": "cd packages/react-devtools-core && yarn run build",
41
"deploy": "yarn run deploy:demo && yarn run deploy:chrome && yarn run deploy:firefox",
41
- "deploy:demo": "cd shells/dev/ && now deploy && now alias react-devtools-experimental",
42
+ "deploy:demo": "yarn run build:demo && cd shells/dev/ && now deploy && now alias react-devtools-experimental",
43
"deploy:chrome": "node ./shells/browser/chrome/deploy",
44
"deploy:firefox": "node ./shells/browser/firefox/deploy",
45
"linc": "lint-staged",
@@ -47,8 +48,8 @@
48
"precommit": "lint-staged",
49
"prettier": "prettier --write '**/*.{js,json,css}'",
50
"prettier:ci": "prettier --check '**/*.{js,json,css}'",
50
- "start": "cd ./shells/dev && cross-env NODE_ENV=development webpack-dev-server --open",
51
- "start:prod": "cd ./shells/dev && cross-env NODE_ENV=production webpack-dev-server --open",
51
+ "start": "cd ./shells/dev && cross-env NODE_ENV=development cross-env TARGET=local webpack-dev-server --open",
52
+ "start:prod": "cd ./shells/dev && cross-env NODE_ENV=production cross-env TARGET=local webpack-dev-server --open",
53
"test": "jest",
54
"test-debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
55
"test:chrome": "node ./shells/browser/chrome/test",
shells/dev/index.html
+3
-2
@@ -61,7 +61,8 @@
61
<div id="devtools"></div>
62
63
<!-- This script installs the hook, injects the backend, and renders the DevTools UI -->
64
- <!-- It's served by webpack dev server and doesn't exist on disk -->
65
- <script src="devtools.js"></script>
64
+ <!-- In DEV mode, this file is served by the Webpack dev server -->
65
+ <!-- For production builds, it's built by Webpack and uploaded from the local file system -->
66
+ <script src="dist/devtools.js"></script>
67
</body>
68
</html>
\ No newline at end of file
shells/dev/now.json
+1
-1
@@ -1,5 +1,5 @@
1
{
2
"name": "react-devtools-experimental",
3
"alias": ["react-devtools-experimental"],
4
- "files": ["index.html", "build"]
4
+ "files": ["index.html", "dist"]
5
}
shells/dev/src/devtools.js
+6
-4
@@ -38,7 +38,7 @@ mountButton.addEventListener('click', function() {
38
}
39
});
40
41
-inject('./app.js', () => {
41
+inject('dist/app.js', () => {
42
initDevTools({
43
connect(cb) {
44
const bridge = new Bridge({
@@ -78,9 +78,11 @@ inject('./app.js', () => {
78
79
// Initialize the backend only once the DevTools frontend Store has been initialized.
80
// Otherwise the Store may miss important initial tree op codes.
81
- inject('./backend.js', () => {
82
- // Clear noisy webpack "WDS: ..." output.
83
- console.clear();
81
+ inject('dist/backend.js', () => {
82
+ if (__DEV__) {
83
+ // Clear noisy webpack "WDS: ..." output.
84
+ console.clear();
85
+ }
86
});
87
});
88
},
shells/dev/webpack.config.js
+24
-7
@@ -8,20 +8,20 @@ if (!NODE_ENV) {
8
process.exit(1);
9
}
10
11
+const TARGET = process.env.TARGET;
12
+if (!TARGET) {
13
+ console.error('TARGET not set');
14
+ process.exit(1);
15
+}
16
+
17
const __DEV__ = NODE_ENV === 'development';
18
19
const GITHUB_URL = getGitHubURL();
20
const DEVTOOLS_VERSION = getVersionString();
21
16
-module.exports = {
22
+const config = {
23
mode: __DEV__ ? 'development' : 'production',
24
devtool: false,
19
- devServer: {
20
- hot: true,
21
- port: 8080,
22
- clientLogLevel: 'warning',
23
- stats: 'errors-only',
24
- },
25
entry: {
26
app: './app/index.js',
27
backend: './src/backend.js',
@@ -67,3 +67,20 @@ module.exports = {
67
],
68
},
69
};
70
+
71
+if (TARGET === 'local') {
72
+ config.devServer = {
73
+ hot: true,
74
+ port: 8080,
75
+ clientLogLevel: 'warning',
76
+ publicPath: '/dist/',
77
+ stats: 'errors-only',
78
+ };
79
+} else {
80
+ config.output = {
81
+ path: resolve(__dirname, 'dist'),
82
+ filename: '[name].js',
83
+ };
84
+}
85
+
86
+module.exports = config;