cookiecutter-webpack
Advanced tools
Comparing version 0.3.0 to 0.3.2
import expect, { createSpy, spyOn, isSpy } from 'expect'; | ||
import deepFreeze from 'deep-freeze'; | ||
@@ -30,4 +29,4 @@ | ||
}; | ||
deepFreeze(stateBefore); | ||
deepFreeze(action); | ||
Object.freeze(stateBefore); | ||
Object.freeze(action); | ||
@@ -49,4 +48,4 @@ expect( | ||
}; | ||
deepFreeze(stateBefore); | ||
deepFreeze(action); | ||
Object.freeze(stateBefore); | ||
Object.freeze(action); | ||
@@ -53,0 +52,0 @@ expect( |
@@ -14,3 +14,2 @@ import React, {PropTypes, Component} from 'react'; | ||
<main> | ||
<h1>NODE_ENV: {process.env.NODE_ENV}</h1> | ||
{this.props.children} | ||
@@ -17,0 +16,0 @@ </main> |
@@ -0,3 +1,7 @@ | ||
{% if cookiecutter.css_extension == 'less' -%} | ||
import './Counter.less'; | ||
{% elif cookiecutter.css_extension == 'sass' -%} | ||
import './Counter.scss'; | ||
{% endif -%} | ||
import React, {PropTypes, Component} from 'react'; | ||
@@ -15,7 +19,10 @@ | ||
render() { | ||
const {value, incrementCounter, decrementCounter} = this.props; | ||
return ( | ||
<div className="counter"> | ||
<h1>Counter: {this.props.value}</h1> | ||
<button onClick={this.props.incrementCounter}>+</button> | ||
<button onClick={this.props.decrementCounter}>-</button> | ||
<h1>Counter: {value}</h1> | ||
<button onClick={incrementCounter}>+</button> | ||
<button onClick={decrementCounter}>-</button> | ||
<hr /> | ||
</div> | ||
@@ -22,0 +29,0 @@ ); |
@@ -23,2 +23,3 @@ import React, {Component, PropTypes} from 'react'; | ||
/> | ||
<ProcessEnv {...process.env} /> | ||
</div> | ||
@@ -43,1 +44,21 @@ ); | ||
)(CounterApp); | ||
// Dev tools controls and process.env info | ||
function ProcessEnv({ | ||
NODE_ENV, | ||
}) { | ||
return ( | ||
<ul> | ||
<li><strong>{'process.env:'}</strong></li> | ||
<li>{`NODE_ENV: ${NODE_ENV}`}</li> | ||
<li><strong>Redux: Dev Tools:</strong></li> | ||
<li>ctrl+h - show/hide</li> | ||
<li>ctrl+q - change position</li> | ||
<li>ctrl+m - toggle monitor</li> | ||
</ul> | ||
); | ||
} | ||
ProcessEnv.propTypes = { | ||
NODE_ENV: PropTypes.string.isRequired, | ||
}; |
@@ -12,2 +12,4 @@ import React from 'react'; | ||
const REDUX_DEV_TOOLS_VISIBLE = true; | ||
// createDevTools takes a monitor and produces a DevTools component | ||
@@ -18,3 +20,4 @@ export default createDevTools( | ||
changeMonitorKey="ctrl-m" | ||
defaultPosition="right"> | ||
defaultPosition="right" | ||
defaultIsVisible={REDUX_DEV_TOOLS_VISIBLE}> | ||
<MultipleMonitors> | ||
@@ -21,0 +24,0 @@ <LogMonitor theme="nicinabox" /> |
@@ -1,5 +0,5 @@ | ||
const | ||
path = require('path'), | ||
webpack = require('webpack'), | ||
HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
import path from 'path'; | ||
import webpack from 'webpack'; | ||
{% if cookiecutter.use_ejs == 'y' -%} | ||
import HtmlWebpackPlugin from 'html-webpack-plugin'; | ||
@@ -15,32 +15,57 @@ | ||
}; | ||
{%- endif %} | ||
module.exports = (opts) => { | ||
const {PROJECT_ROOT, NODE_ENV} = opts; | ||
let plugins = [ | ||
// add all common plugins here | ||
{% if cookiecutter.use_ejs == 'y' -%} | ||
new HtmlWebpackPlugin(HTML_WEBPACK_OPTIONS.main), | ||
{% endif -%} | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
NODE_ENV: JSON.stringify(NODE_ENV), | ||
}, | ||
}), | ||
// Promise and fetch polyfills | ||
new webpack.ProvidePlugin({ | ||
Promise: 'imports?this=>global!exports?global.Promise!es6-promise', | ||
fetch: 'imports?this=>global!exports?global.fetch!whatwg-fetch', | ||
}), | ||
]; | ||
if (NODE_ENV !== 'test') { | ||
// karma webpack can't use these | ||
plugins = [ | ||
...plugins, | ||
// vendor chuncks | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
minChunks: Infinity, | ||
filename: 'vendor-[hash].js', | ||
}), | ||
// shared stuff between chuncks | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'common', | ||
filename: 'common-[hash].js', | ||
chunks: [], // add common modules here | ||
}), | ||
]; | ||
} | ||
return { | ||
context: opts.projectRoot, | ||
context: PROJECT_ROOT, | ||
entry: { | ||
main: path.resolve(opts.projectRoot, '{{ cookiecutter.static_root }}/index'), | ||
main: path.resolve(PROJECT_ROOT, '{{ cookiecutter.static_root }}/index'), | ||
vendor: ['react', 'redux', 'react-router', 'react-redux', 'react-dom'], | ||
}, | ||
output: { | ||
path: path.resolve(opts.projectRoot, '{{ cookiecutter.local_output_path }}'), | ||
path: path.resolve(PROJECT_ROOT, '{{ cookiecutter.static_root }}/bundles'), | ||
filename: '[name]-[hash].js', | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin(HTML_WEBPACK_OPTIONS.main), | ||
// shared stuff between chuncks | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
minChunks: Infinity, | ||
filename: 'vendor-[hash].js', | ||
}), | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
NODE_ENV: opts.nodeEnv, | ||
PUBLIC_PATH: opts.publicPath, | ||
}, | ||
}), | ||
], // add all common plugins here | ||
plugins, | ||
@@ -54,2 +79,3 @@ module: { | ||
}, | ||
{% if cookiecutter.use_ejs == 'y' -%} | ||
{ | ||
@@ -60,7 +86,13 @@ test: /\.ejs$/, | ||
includePaths: [ | ||
path.resolve(opts.projectRoot, '{{ cookiecutter.static_root }}/templates/'), | ||
path.resolve(PROJECT_ROOT, '{{ cookiecutter.static_root }}/templates/'), | ||
], | ||
}, | ||
}, | ||
{% endif -%} | ||
{% if cookiecutter.css_extension == 'less' -%} | ||
{test: /\.less$/, loader: 'style-loader!css-loader!less-loader'}, | ||
{% endif -%} | ||
{% if cookiecutter.css_extension == 'sass' -%} | ||
{test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, | ||
{% endif -%} | ||
{test: /\.css$/, loader: 'style-loader!css-loader'}, | ||
@@ -75,3 +107,3 @@ {test: /\.(png|jpg|gif)$/, loader: 'url-loader', query: {limit: 8192}}, // inline base64 URLs <=8k | ||
modules: [ | ||
path.resolve(opts.projectRoot, '{{ cookiecutter.static_root }}'), | ||
path.resolve(PROJECT_ROOT, '{{ cookiecutter.static_root }}'), | ||
'node_modules', | ||
@@ -78,0 +110,0 @@ ], |
@@ -1,29 +0,32 @@ | ||
const | ||
webpack = require('webpack'), | ||
ForceCaseSensitivityPlugin = require('force-case-sensitivity-webpack-plugin'),{% if cookiecutter.existing_project == 'y' %} | ||
BundleTracker = require('webpack-bundle-tracker'),{% endif %} | ||
import webpack from 'webpack'; | ||
import ForceCaseSensitivityPlugin from 'force-case-sensitivity-webpack-plugin'; | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
import BundleTracker from 'webpack-bundle-tracker'; | ||
{% endif -%} | ||
baseConfig = require('./webpack.base.config.js'); | ||
import baseConfig from './webpack.base.config.js'; | ||
module.exports = (opts) => { | ||
const config = baseConfig(opts); | ||
{% if cookiecutter.existing_project == 'y' %} | ||
config.output.publicPath = 'http://localhost:8080/bundles/'; | ||
{% endif %} | ||
// local plugins | ||
config.plugins = config.plugins.concat([ | ||
new ForceCaseSensitivityPlugin(), // OSX wont check but other unix os will | ||
new webpack.NoErrorsPlugin(),{% if cookiecutter.existing_project == 'y' %} | ||
// local bundle stats file | ||
new BundleTracker({filename: './webpack-stats.json'}), | ||
{%- endif %} | ||
]); | ||
// local loaders | ||
config.module.loaders.push( | ||
// lint in our local server | ||
{test: /(\.jsx|\.js)$/, loader: 'eslint-loader', exclude: /node_modules/} | ||
); | ||
return config; | ||
return { | ||
...config, | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
output: { | ||
...config.output, | ||
publicPath: 'http://localhost:8080/bundles/', | ||
}, | ||
{% endif -%} | ||
plugins: [ | ||
...config.plugins, | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
// local bundle stats file | ||
new BundleTracker({filename: './webpack-stats.json'}), | ||
{% endif -%} | ||
new ForceCaseSensitivityPlugin(), // OSX wont check but other unix os will | ||
new webpack.NoErrorsPlugin(), | ||
], | ||
}; | ||
}; |
@@ -1,7 +0,8 @@ | ||
const | ||
path = require('path'), | ||
webpack = require('webpack'),{% if cookiecutter.existing_project == 'y' %} | ||
BundleTracker = require('webpack-bundle-tracker'),{% endif %} | ||
import path from 'path'; | ||
import webpack from 'webpack'; | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
import BundleTracker from 'webpack-bundle-tracker'; | ||
{% endif -%} | ||
baseConfig = require('./webpack.base.config.js'); | ||
import baseConfig from './webpack.base.config.js'; | ||
@@ -11,35 +12,39 @@ | ||
const config = baseConfig(opts); | ||
const | ||
{CDN_PATH, PROJECT_ROOT} = opts, | ||
config = baseConfig(opts); | ||
if (opts.cdnPath) { | ||
// set CDN_PATH to your cdn static file directory | ||
config.output.publicPath = `${opts.cdnPath}/{{ cookiecutter.production_output_path }}`; | ||
} | ||
config.output.path = path.resolve(__dirname, '{{ cookiecutter.production_output_path }}'); | ||
config.plugins = config.plugins.concat([ | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
// production bundle stats file | ||
new BundleTracker({filename: './webpack-stats-production.json'}), | ||
{%- endif %} | ||
// pass options to uglify | ||
new webpack.LoaderOptionsPlugin({ | ||
minimize: true, | ||
debug: false, | ||
}), | ||
// minifies your code | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false, | ||
}, | ||
output: { | ||
comments: false, | ||
}, | ||
sourceMap: false, | ||
}), | ||
]); | ||
return config; | ||
return { | ||
...config, | ||
output: { | ||
...config.output, | ||
path: path.resolve(PROJECT_ROOT, '{{ cookiecutter.production_output_path }}'), | ||
// set CDN_PATH to your cdn static file directory | ||
publicPath: CDN_PATH || '/', | ||
}, | ||
plugins: [ | ||
...config.plugins, | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
// production bundle stats file | ||
new BundleTracker({filename: './webpack-stats-production.json'}), | ||
{% endif -%} | ||
// pass options to uglify | ||
new webpack.LoaderOptionsPlugin({ | ||
minimize: true, | ||
debug: false, | ||
}), | ||
// minifies your code | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false, | ||
}, | ||
output: { | ||
comments: false, | ||
}, | ||
sourceMap: false, | ||
}), | ||
// removes duplicate modules | ||
new webpack.optimize.DedupePlugin(), | ||
], | ||
}; | ||
}; |
@@ -8,7 +8,4 @@ /** | ||
*/ | ||
const webpackConfig = require('./webpack.config'); | ||
const | ||
baseConfig = require('./config/webpack.base.config')( | ||
{projectRoot: __dirname} | ||
); | ||
@@ -20,3 +17,3 @@ module.exports = function(config) { | ||
files: [ | ||
'src/**/__tests__/**/*.js', | ||
'{{ cookiecutter.static_root }}/**/__tests__/**/*.js', | ||
], | ||
@@ -26,10 +23,6 @@ | ||
// add webpack as a preprocessor | ||
'src/**/*.js': ['webpack', 'sourcemap'], | ||
'src/**/__tests__/**/*.js': ['webpack', 'sourcemap'], | ||
'{{ cookiecutter.static_root }}/**/*.js': ['webpack', 'sourcemap'], | ||
}, | ||
webpack: { | ||
devtool: 'inline-source-map', | ||
module: baseConfig.module, | ||
}, | ||
webpack: webpackConfig, | ||
@@ -44,3 +37,2 @@ webpackMiddleware: { | ||
'karma-chrome-launcher', | ||
'karma-phantomjs-launcher', | ||
'karma-mocha', | ||
@@ -55,4 +47,5 @@ ], | ||
browsers: ['Chrome'], | ||
singleRun: false, | ||
singleRun: true, | ||
concurrency: Infinity, | ||
}); | ||
}; |
@@ -7,10 +7,18 @@ { | ||
"scripts": { | ||
"test": "NODE_ENV=test ./node_modules/karma/bin/karma start --single-run --browsers PhantomJS", | ||
"webpack": "NODE_ENV=production ./node_modules/.bin/webpack --progress", | ||
"build": "npm run webpack", | ||
"dev": "NODE_ENV=local ./node_modules/.bin/webpack-dev-server --progress --hot", | ||
"babel": "./node_modules/.bin/babel-node --presets es2015", | ||
"test": "NODE_ENV=test npm run babel -- ./node_modules/karma/bin/karma start", | ||
"watch:test": "npm test -- --auto-watch --no-single-run", | ||
"webpack": "npm run babel -- ./node_modules/.bin/webpack --progress", | ||
"build": "NODE_ENV=production npm run webpack", | ||
"dev": "NODE_ENV=local npm run babel -- ./node_modules/.bin/webpack-dev-server --progress --hot", | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
"python": "python manage.py runserver", | ||
"start": "npm run dev & npm run python"{% else %}"start": "npm run dev"{%- endif %} | ||
"start": "npm run dev & npm run python" | ||
{% else -%} | ||
"start": "npm run dev" | ||
{% endif -%} | ||
}, | ||
"author": "{{ cookiecutter.author_name }}", | ||
"license": "{{ cookiecutter.open_source_license }}", | ||
{% if cookiecutter.repo_owner -%} | ||
"repository": { | ||
@@ -20,4 +28,2 @@ "type": "git", | ||
}, | ||
"author": "{{ cookiecutter.author_name }}", | ||
"license": "ISC", | ||
"bugs": { | ||
@@ -27,3 +33,4 @@ "url": "https://github.com/{{ cookiecutter.repo_owner }}/{{ cookiecutter.repo_name }}/issues" | ||
"homepage": "https://github.com/{{ cookiecutter.repo_owner }}/{{ cookiecutter.repo_name }}#readme", | ||
"devDependencies": { | ||
{% endif -%} | ||
"dependencies": { | ||
"babel": "^6.5.2", | ||
@@ -42,14 +49,43 @@ "babel-cli": "^6.9.0", | ||
"css-loader": "^0.23.1", | ||
"deep-freeze": "0.0.1", | ||
"ejs-loader": "^0.2.1", | ||
"es6-promise": "^3.2.1", | ||
"eslint": "^2.11.1", | ||
"eslint-loader": "^1.3.0", | ||
"eslint-plugin-babel": "^3.1.0", | ||
"eslint-plugin-react": "^5.1.1", | ||
"exports-loader": "^0.6.3", | ||
"file-loader": "^0.8.5", | ||
{% if cookiecutter.use_ejs -%} | ||
"html-webpack-plugin": "^2.19.0", | ||
{% endif -%} | ||
"imports-loader": "^0.6.5", | ||
{% if cookiecutter.css_extension == 'less' -%} | ||
"less": "^2.6.1", | ||
"less-loader": "^2.2.3", | ||
{% endif -%} | ||
{% if cookiecutter.css_extension == 'sass' -%} | ||
"node-sass": "^3.7.0", | ||
{% endif -%} | ||
"react": "^15.1.0", | ||
"react-dom": "^15.1.0", | ||
"react-redux": "^4.4.5", | ||
"react-router": "^2.4.1", | ||
"redux": "^3.5.2", | ||
{% if cookiecutter.css_extension == 'sass' -%} | ||
"sass": "^0.5.0", | ||
"sass-loader": "^3.2.0", | ||
{% endif -%} | ||
"style-loader": "^0.13.1", | ||
"url-loader": "^0.5.7", | ||
"watchify": "^3.7.0", | ||
"webpack": "^2.1.0-beta.13", | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
"webpack-bundle-tracker": "0.0.93", | ||
{% endif -%} | ||
"webpack-dev-server": "^2.0.0-beta", | ||
"whatwg-fetch": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^2.11.1", | ||
"expect": "^1.20.1", | ||
"file-loader": "^0.8.5", | ||
"force-case-sensitivity-webpack-plugin": "^0.1.1", | ||
"html-webpack-plugin": "^2.19.0", | ||
"jasmine-core": "^2.4.1", | ||
"karma": "^0.13.22", | ||
@@ -60,16 +96,7 @@ "karma-babel-preprocessor": "^6.0.1", | ||
"karma-mocha": "^1.0.1", | ||
"karma-phantomjs-launcher": "^1.0.0", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "goldhand/karma-webpack",{# TODO: update when karma-webpack supports webpack 2.1.0-betas #} | ||
"less": "^2.6.1", | ||
"less-loader": "^2.2.3", | ||
"mocha": "^2.5.3", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"react": "^15.1.0", | ||
"react-addons-test-utils": "^15.1.0", | ||
"react-dom": "^15.1.0", | ||
"react-redux": "^4.4.5", | ||
"react-router": "^2.4.1", | ||
"react-transform-hmr": "^1.0.4", | ||
"redux": "^3.5.2", | ||
"redux-devtools": "^3.3.1", | ||
@@ -81,11 +108,4 @@ "redux-devtools-dispatch": "^2.2.0", | ||
"redux-immutable-state-invariant": "1.2.3", | ||
"redux-slider-monitor": "^1.0.5", | ||
"style-loader": "^0.13.1", | ||
"url-loader": "^0.5.7", | ||
"watchify": "^3.7.0", | ||
"webpack": "^2.1.0-beta.13", | ||
{% if cookiecutter.existing_project == 'y' -%} | ||
"webpack-bundle-tracker": "0.0.93", | ||
{% endif %}"webpack-dev-server": "^2.0.0-beta" | ||
"redux-slider-monitor": "^1.0.5" | ||
} | ||
} |
@@ -36,6 +36,6 @@ {{ cookiecutter.project_name }} | ||
React-Redux Project Structure | ||
----------------- | ||
----------------------------- | ||
Outline the structure of the project. | ||
### Source `./{{ cookiecutter.static_root }}/` | ||
#### Source `./{{ cookiecutter.static_root }}/` | ||
Main project source. | ||
@@ -42,0 +42,0 @@ |
@@ -14,5 +14,5 @@ /** | ||
const OPTIONS = { | ||
projectRoot: __dirname, | ||
nodeEnv: JSON.stringify(process.env.NODE_ENV), | ||
cdnPath: JSON.stringify(process.env.CDN_PATH), | ||
PROJECT_ROOT: __dirname, | ||
NODE_ENV: process.env.NODE_ENV, | ||
CDN_PATH: process.env.CDN_PATH, | ||
}; | ||
@@ -26,2 +26,4 @@ | ||
return require('./config/webpack.local.config.js'); | ||
case 'test': | ||
return require('./config/webpack.test.config.js'); | ||
default: | ||
@@ -28,0 +30,0 @@ return require('./config/webpack.local.config.js'); |
@@ -1,6 +0,25 @@ | ||
# Change Log | ||
All enhancements and patches to Cookiecutter Django will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
### [Sat Jun 18 2016] | ||
* Refactor configs | ||
* Remove phantomjs from karma | ||
* Add open_source_license to cookiecutter options | ||
* Fix test configuration | ||
* :shirt: Appease the linter | ||
* Fix counter tests | ||
* Add webpack test config | ||
* Add promise and fetch polyfills | ||
### [Sun Jun 12 2016] | ||
* Update readme with css_extenson option | ||
* Add make file | ||
* Make it easier to hide devtools by default | ||
* Add css_extension option - [none, less, sass] | ||
* Make ejs templates optional | ||
* Fix karma paths | ||
* Add webpack stats to django gitignore | ||
* Remove unneeded cookiecutter options | ||
* Update readme | ||
* Fix karma conf | ||
* Update config to use es6 syntex with babel-node | ||
### [2016-06-07] | ||
@@ -51,1 +70,6 @@ ### Added | ||
- Readme to reflect redux-react application structure (@goldhand) | ||
# Change Log | ||
All enhancements and patches to Cookiecutter Django will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). |
{ | ||
"project_name": "project_name", | ||
"repo_name": "{{ cookiecutter.project_name|replace(' ', '')|lower }}", | ||
"repo_owner": "github_username", | ||
"repo_owner": "", | ||
"static_root": "src", | ||
"local_output_path": "src/bundles", | ||
"production_output_path": "src/dist", | ||
"author_name": "Your Name", | ||
"email": "Your email", | ||
"description": "A short description of the project.", | ||
"version": "0.1.0", | ||
"existing_project": "n" | ||
"existing_project": "n", | ||
"css_extension": ["none", "less", "sass"], | ||
"use_ejs": "{% if cookiecutter.existing_project == 'n' %}y{% else %}n{% endif %}", | ||
"open_source_license": "ISC" | ||
} |
{ | ||
"name": "cookiecutter-webpack", | ||
"version": "0.3.0", | ||
"version": "0.3.2", | ||
"description": "Boilerplate for setting up webpack 2 configuration with hot reloading, babel for es6 modules, react + redux.", | ||
@@ -17,3 +17,4 @@ "directories": { | ||
"scripts": { | ||
"test": "py.test" | ||
"test": "py.test", | ||
"version": "make test && make changelog && git add -p CHANGELOG.md && git checkout CHANGELOG.md" | ||
}, | ||
@@ -20,0 +21,0 @@ "repository": { |
Cookiecutter-webpack | ||
==================== | ||
Boilerplate for setting up [webpack 2][webpack2] configuration with [hot reloading][hmr], [babel][babel] for es6 modules, [react][react] + [redux][redux] for views and state, and [karma][karma] + [mocha][mocha] + [expect][expect] for testing. | ||
Boilerplate for setting up webpack 2 configuration with hot reloading, babel for es6 modules, react + redux for views and state, and karma + mocha + expect for testing. | ||
[webpack2]: https://github.com/webpack/webpack/tree/v2.1.0-beta.13 | ||
[hmr]: https://github.com/gaearon/react-transform-hmr | ||
[babel]: https://babeljs.io/ | ||
[react]: https://facebook.github.io/react/ | ||
[redux]: http://redux.js.org/index.html | ||
[karma]: https://github.com/karma-runner/karma | ||
[mocha]: https://github.com/mochajs/mocha | ||
[expect]: https://github.com/mjackson/expect | ||
Getting Started | ||
@@ -28,4 +35,39 @@ --------------- | ||
Open up http://localhost:8080 in your browser. | ||
You will have a React / Redux counter app running with redux dev-tools. See the generated `README.md` for an explanation of the react / redux project structure. | ||
You can run the test suite | ||
$ npm test | ||
You should also create a new git repo and push it to github | ||
``` | ||
$ git init | ||
$ git add . | ||
$ git commit -m "Init" | ||
$ git remote add origin git@github.com:hzdg/project_name.git | ||
$ git push -u origin master | ||
``` | ||
Options | ||
------- | ||
* `project_name`: Your Project Name | ||
* `repo_name`: Name of this projects git repository | ||
* `repo_owner`: Your github username | ||
* `static_root`: Path to where this projects source code lives, or path to static files directory if integrating into an existing project | ||
* `production_output_path`: Path where your compiled bundles should go | ||
* `author_name`: Your Name | ||
* `description`: A short description of the project for the `README.md` file | ||
* `version`: Project version number | ||
* `existing_project`: `n` if this is a new project and `y` if you're integrating into an existing project. See the notes below about integrating into an existing project. | ||
* `css_extension`: [`none`, `less`, `sass`] - use `less` or `sass` to preprocess styles. | ||
* `use_ejs`: `y` if you want to include `ejs` templates and loaders in the project. Recommended if not using an existing project. | ||
Integrating into existing projects | ||
@@ -39,20 +81,22 @@ ---------------------------------- | ||
from cookiecutter.main import cookiecutter | ||
```python | ||
from cookiecutter.main import cookiecutter | ||
cookiecutter( | ||
'git@github.com:hzdg/cookiecutter-webpack.git', | ||
replay=False, overwrite_if_exists=True, output_dir='../', | ||
checkout=None, no_input=True, extra_context={ | ||
'project_name': '{{ cookiecutter.project_name }}', | ||
'repo_name': '{{ cookiecutter.repo_name }}', | ||
'repo_owner': 'hzdg', | ||
'static_root': '{{ cookiecutter.project_dir }}/static/{{ cookiecutter.project_dir }}', | ||
'local_output_path': '{{ cookiecutter.project_dir }}/static/{{ cookiecutter.project_dir }}/bundles/', | ||
'production_output_path': '{{ cookiecutter.project_dir }}/static/{{ cookiecutter.project_dir }}/dist/', | ||
'author_name': '{{ cookiecutter.author_name }}', | ||
'email': '{{ cookiecutter.email }}', | ||
'description': '{{ cookiecutter.description }}', | ||
'version': '{{ cookiecutter.version }}', | ||
'existing_project': 'y' | ||
}) | ||
cookiecutter( | ||
'git@github.com:hzdg/cookiecutter-webpack.git', | ||
replay=False, overwrite_if_exists=True, output_dir='../', | ||
checkout=None, no_input=True, extra_context={ | ||
'project_name': '{{ cookiecutter.project_name }}', | ||
'repo_name': '{{ cookiecutter.repo_name }}', | ||
'repo_owner': 'hzdg', | ||
'static_root': '{{ cookiecutter.project_dir }}/static/{{ cookiecutter.project_dir }}', | ||
'production_output_path': '{{ cookiecutter.project_dir }}/static/{{ cookiecutter.project_dir }}/dist/', | ||
'author_name': '{{ cookiecutter.author_name }}', | ||
'description': '{{ cookiecutter.description }}', | ||
'version': '{{ cookiecutter.version }}', | ||
'existing_project': 'y', | ||
'css_extension': 'sass', | ||
'use_ejs': 'n' | ||
}) | ||
``` | ||
@@ -59,0 +103,0 @@ The flag `existing_project` will move/remove some files and dependencies and also add supporting configurations for a django project. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54857
43
570
126