Last active
August 5, 2016 17:03
-
-
Save choonkeat/bb1da3cdb219b63897874d3e1e4dcf19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo '{ | |
"scripts": { | |
"watch": "nodemon -w src -w jasmine -e html,js,jsx --exec npm run build", | |
"prebuild": "npm run test", | |
"build": "webpack -d", | |
"prestart": "npm run build", | |
"start": "webpack-dev-server --inline --hot --content-base dist", | |
"production": "NODE_ENV=production webpack -p", | |
"test": "babel-node jasmine/run.js" | |
} | |
}' > package.json | |
npm install --save react react-dom | |
npm install --save-dev babel-cli babel-core babel-loader babel-plugin-transform-object-rest-spread \ | |
babel-polyfill babel-preset-es2015 babel-preset-react html-webpack-plugin \ | |
jasmine webpack webpack-dev-server | |
echo 'var webpack = require("webpack") | |
var HtmlWebpackPlugin = require("html-webpack-plugin") | |
module.exports = { | |
entry: { | |
app: "./src/app.jsx" | |
}, | |
output: { | |
path: "./dist", | |
filename: "[name]" + (process.env.NODE_ENV == "production" ? ".[hash]" : "") + ".js" | |
}, | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
template: "src/index.html" | |
}) | |
], | |
module: { | |
loaders: [ | |
{ | |
test: /.jsx?$/, | |
loader: "babel-loader", | |
exclude: /node_modules/, | |
query: { | |
presets: ["es2015", "react"] | |
} | |
} | |
] | |
} | |
} | |
' > webpack.config.js | |
echo '{ | |
"plugins": ["transform-object-rest-spread"], | |
"presets": ["es2015", "react"] | |
} | |
' > .babelrc | |
mkdir -p jasmine | |
echo 'import Jasmine from "jasmine" | |
var jasmine = new Jasmine() | |
jasmine.loadConfigFile("jasmine/support/jasmine.json") | |
jasmine.execute() | |
' > jasmine/run.js | |
mkdir -p jasmine/support | |
echo '{ | |
"spec_dir": "jasmine", | |
"spec_files": [ | |
"**/*[sS]pec.js" | |
], | |
"helpers": [ | |
"helpers/**/*.js" | |
], | |
"stopSpecOnExpectationFailure": false, | |
"random": true | |
} | |
' > jasmine/support/jasmine.json | |
echo 'dist/*' >> .gitignore | |
mkdir -p dist && touch dist/.gitkeep | |
mkdir -p src && touch src/.gitkeep | |
touch src/app.jsx | |
touch src/index.html | |
npm start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment