Automatically run flow on build
This commit is contained in:
parent
a65e937623
commit
d1dd22eb5d
4 changed files with 32 additions and 8 deletions
|
|
@ -4,7 +4,8 @@
|
|||
"author": "uwap <me@uwap.name>",
|
||||
"description": "react",
|
||||
"scripts": {
|
||||
"build": "webpack --bail"
|
||||
"build": "webpack --bail",
|
||||
"watch": "webpack --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-preset-env": "^1.6.0",
|
||||
|
|
@ -25,7 +26,8 @@
|
|||
"babel-preset-react": "^6.24.1",
|
||||
"flow": "^0.2.3",
|
||||
"flow-bin": "^0.50.0",
|
||||
"webpack": "^3.1.0"
|
||||
"webpack": "^3.1.0",
|
||||
"webpack-shell-plugin": "^0.5.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
|
|||
9
shell.nix
Normal file
9
shell.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
with (import <nixpkgs> {});
|
||||
stdenv.mkDerivation rec {
|
||||
name = "env";
|
||||
env = buildEnv { name = name; paths = buildInputs; };
|
||||
buildInputs = with pkgs.nodePackages; [
|
||||
yarn flow nodejs
|
||||
];
|
||||
FLOW_PATH = "${pkgs.flow}/bin/flow";
|
||||
}
|
||||
|
|
@ -1,25 +1,34 @@
|
|||
// webpack.config.js:
|
||||
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const WebpackShellPlugin = require('webpack-shell-plugin');
|
||||
|
||||
const preBuildScripts = process.env.NO_FLOW == undefined ?
|
||||
process.env.FLOW_PATH != undefined ? [process.env.FLOW_PATH] : ['flow']
|
||||
: [];
|
||||
|
||||
module.exports = {
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx']
|
||||
},
|
||||
entry: [
|
||||
path.resolve(__dirname, 'src/index.jsx')
|
||||
path.resolve(__dirname, 'src/index.js')
|
||||
],
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'public/dist'),
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'main.js',
|
||||
publicPath: 'dist/'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: "style!css" },
|
||||
{ test: /\.(woff2?|eot|ttf|svg)$/, loader: "file-loader" },
|
||||
{ test: /\.css$/, loader: "style-loader!css-loader" },
|
||||
{ test: /\.js(x)?$/, exclude: /node_modules/, loader: "babel-loader" }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new WebpackShellPlugin({onBuildStart:preBuildScripts})
|
||||
],
|
||||
devtool: 'source-map'
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3248,6 +3248,10 @@ watchpack@^1.4.0:
|
|||
chokidar "^1.7.0"
|
||||
graceful-fs "^4.1.2"
|
||||
|
||||
webpack-shell-plugin@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack-shell-plugin/-/webpack-shell-plugin-0.5.0.tgz#29b8a1d80ddeae0ddb10e729667f728653c2c742"
|
||||
|
||||
webpack-sources@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue