mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-12 11:29:01 -05:00
Merge pull request #868 from arv/webpack-tagshow
JS: Use webpack for tagshow
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
"babel-cli": "^6.3.15",
|
||||
"babel-core": "^6.3.15",
|
||||
"babel-eslint": "^4.1.5",
|
||||
"babel-generator": "^6.4.2",
|
||||
"babel-loader": "^6.2.1",
|
||||
"babel-plugin-syntax-async-functions": "^6.3.13",
|
||||
"babel-plugin-syntax-flow": "^6.3.13",
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
SRC="node_modules/babel-regenerator-runtime/runtime.js main.js"
|
||||
SRC="babel-regenerator-runtime src/main.js"
|
||||
OUT="tagshow.js"
|
||||
|
||||
export NODE_ENV=production
|
||||
export BABEL_ENV=production
|
||||
export NODE_ENV=$1
|
||||
export BABEL_ENV=$1
|
||||
|
||||
node_modules/.bin/browserify \
|
||||
-p bundle-collapser/plugin \
|
||||
$SRC \
|
||||
| node_modules/.bin/uglifyjs -c -m > $OUT
|
||||
node_modules/.bin/webpack --progress $SRC $OUT
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"babel-cli": "^6.3.15",
|
||||
"babel-core": "^6.3.15",
|
||||
"babel-eslint": "^4.1.5",
|
||||
"babel-generator": "^6.4.2",
|
||||
"babel-loader": "^6.2.1",
|
||||
"babel-plugin-syntax-async-functions": "^6.3.13",
|
||||
"babel-plugin-syntax-flow": "^6.3.13",
|
||||
"babel-plugin-transform-async-to-generator": "^6.3.13",
|
||||
@@ -20,28 +20,17 @@
|
||||
"babel-polyfill": "^6.3.14",
|
||||
"babel-preset-es2015": "^6.3.13",
|
||||
"babel-preset-react": "^6.3.13",
|
||||
"babelify": "^7.2.0",
|
||||
"browserify": "^12.0.1",
|
||||
"bundle-collapser": "^1.2.1",
|
||||
"chai": "^3.2.0",
|
||||
"envify": "^3.4.0",
|
||||
"eslint": "^1.9.0",
|
||||
"eslint-plugin-react": "^3.8.0",
|
||||
"flow-bin": "^0.19.1",
|
||||
"mocha": "^2.3.0",
|
||||
"uglify-js": "^2.6.1",
|
||||
"watchify": "^3.6"
|
||||
"webpack": "^1.12.11"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "watchify -o tagshow.js -t babelify -v -d node_modules/babel-regenerator-runtime/runtime.js main.js",
|
||||
"build": "./.npm_build_helper.sh",
|
||||
"pretest": "rm -f tagshow.js && eslint *.js && flow",
|
||||
"test": "mocha --ui tdd --reporter dot --compilers js:babel-core/register ./*_test.js"
|
||||
},
|
||||
"browserify": {
|
||||
"transform": [
|
||||
"babelify",
|
||||
"envify"
|
||||
]
|
||||
"start": "./.npm_build_helper.sh development",
|
||||
"build": "./.npm_build_helper.sh production",
|
||||
"pretest": "eslint src/ && flow src/",
|
||||
"test": "mocha --ui tdd --reporter dot --compilers js:babel-core/register src/*_test.js"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const devMode = process.env.NODE_ENV !== 'production';
|
||||
|
||||
// Replaces all process.env.foo with the value of the enviroment variable.
|
||||
function replaceEnv() {
|
||||
const replacements = {};
|
||||
for (const key in process.env) {
|
||||
replacements[`process.env.${key}`] = JSON.stringify(process.env[key]);
|
||||
}
|
||||
return new webpack.DefinePlugin(replacements);
|
||||
}
|
||||
|
||||
const plugins = [replaceEnv()];
|
||||
|
||||
if (!devMode) {
|
||||
plugins.push(new webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
plugins,
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
// Make sure all of these instances are using the same copy.
|
||||
'react': path.resolve('./node_modules/react')
|
||||
}
|
||||
},
|
||||
|
||||
devtool: devMode ? '#inline-source-map' : '',
|
||||
watch: devMode
|
||||
};
|
||||
Reference in New Issue
Block a user