Fixed deploy script

This commit is contained in:
Brian Vaughn 2019-05-03 08:55:31 -07:00
parent 07281993d1
commit 435e22ad1b
6 changed files with 39 additions and 17 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/shells/browser/firefox/*.xpi
/shells/browser/firefox/*.pem
/shells/browser/shared/build
/shells/dev/dist
build
node_modules
npm-debug.log

View File

@ -30,6 +30,7 @@
]
},
"scripts": {
"build:demo": "cd ./shells/dev && cross-env NODE_ENV=development cross-env TARGET=remote webpack --config webpack.config.js",
"build:extension": "cross-env NODE_ENV=production yarn run build:extension:chrome && yarn run build:extension:firefox",
"build:extension:dev": "cross-env NODE_ENV=development yarn run build:extension:chrome && yarn run build:extension:firefox",
"build:extension:chrome": "cross-env NODE_ENV=production node ./shells/browser/chrome/build",
@ -38,7 +39,7 @@
"build:extension:firefox:dev": "cross-env NODE_ENV=development node ./shells/browser/firefox/build",
"build:standalone": "cd packages/react-devtools-core && yarn run build",
"deploy": "yarn run deploy:demo && yarn run deploy:chrome && yarn run deploy:firefox",
"deploy:demo": "cd shells/dev/ && now deploy && now alias react-devtools-experimental",
"deploy:demo": "yarn run build:demo && cd shells/dev/ && now deploy && now alias react-devtools-experimental",
"deploy:chrome": "node ./shells/browser/chrome/deploy",
"deploy:firefox": "node ./shells/browser/firefox/deploy",
"linc": "lint-staged",
@ -47,8 +48,8 @@
"precommit": "lint-staged",
"prettier": "prettier --write '**/*.{js,json,css}'",
"prettier:ci": "prettier --check '**/*.{js,json,css}'",
"start": "cd ./shells/dev && cross-env NODE_ENV=development webpack-dev-server --open",
"start:prod": "cd ./shells/dev && cross-env NODE_ENV=production webpack-dev-server --open",
"start": "cd ./shells/dev && cross-env NODE_ENV=development cross-env TARGET=local webpack-dev-server --open",
"start:prod": "cd ./shells/dev && cross-env NODE_ENV=production cross-env TARGET=local webpack-dev-server --open",
"test": "jest",
"test-debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"test:chrome": "node ./shells/browser/chrome/test",

View File

@ -61,7 +61,8 @@
<div id="devtools"></div>
<!-- This script installs the hook, injects the backend, and renders the DevTools UI -->
<!-- It's served by webpack dev server and doesn't exist on disk -->
<script src="devtools.js"></script>
<!-- In DEV mode, this file is served by the Webpack dev server -->
<!-- For production builds, it's built by Webpack and uploaded from the local file system -->
<script src="dist/devtools.js"></script>
</body>
</html>

View File

@ -1,5 +1,5 @@
{
"name": "react-devtools-experimental",
"alias": ["react-devtools-experimental"],
"files": ["index.html", "build"]
"files": ["index.html", "dist"]
}

View File

@ -38,7 +38,7 @@ mountButton.addEventListener('click', function() {
}
});
inject('./app.js', () => {
inject('dist/app.js', () => {
initDevTools({
connect(cb) {
const bridge = new Bridge({
@ -78,9 +78,11 @@ inject('./app.js', () => {
// Initialize the backend only once the DevTools frontend Store has been initialized.
// Otherwise the Store may miss important initial tree op codes.
inject('./backend.js', () => {
// Clear noisy webpack "WDS: ..." output.
console.clear();
inject('dist/backend.js', () => {
if (__DEV__) {
// Clear noisy webpack "WDS: ..." output.
console.clear();
}
});
});
},

View File

@ -8,20 +8,20 @@ if (!NODE_ENV) {
process.exit(1);
}
const TARGET = process.env.TARGET;
if (!TARGET) {
console.error('TARGET not set');
process.exit(1);
}
const __DEV__ = NODE_ENV === 'development';
const GITHUB_URL = getGitHubURL();
const DEVTOOLS_VERSION = getVersionString();
module.exports = {
const config = {
mode: __DEV__ ? 'development' : 'production',
devtool: false,
devServer: {
hot: true,
port: 8080,
clientLogLevel: 'warning',
stats: 'errors-only',
},
entry: {
app: './app/index.js',
backend: './src/backend.js',
@ -67,3 +67,20 @@ module.exports = {
],
},
};
if (TARGET === 'local') {
config.devServer = {
hot: true,
port: 8080,
clientLogLevel: 'warning',
publicPath: '/dist/',
stats: 'errors-only',
};
} else {
config.output = {
path: resolve(__dirname, 'dist'),
filename: '[name].js',
};
}
module.exports = config;