Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisit dependencies and add browser ready builds #142

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"stage": 0,
"optional": ["runtime"]
}
"loose": "all"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
npm-debug.log
.DS_Store
dist
lib
coverage
react.js
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Change Log
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to fill this from Releases page?

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased][unreleased]
### Added
- Dist build script (borrowed from flummox) to create distribution ready builds of redux
that can be used in a browser directly. `dist/` is ignored by git.
- Configuration for `cdnjs` autoimport from npm.

### Changed
- Clean up package.json by removing the unused browserify section;
- Remove envify and babel-runtime as they aren't being used;
- A change log :)

[unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.11.1...HEAD
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Atomic Flux with hot reloading",
"main": "lib/index.js",
"scripts": {
"browser": "scripts/browser",
"build": "scripts/build",
"clean": "scripts/clean",
"lint": "scripts/lint",
Expand Down Expand Up @@ -53,13 +54,13 @@
"webpack-dev-server": "^1.8.2"
},
"dependencies": {
"babel-runtime": "^5.5.8",
"envify": "^3.4.0",
"invariant": "^2.0.0"
},
"browserify": {
"transform": [
"envify"
"npmName": "redux",
"npmFileMap": [{
"basePath": "/dist/",
"files": [
"*.js"
]
}
}]
}
14 changes: 14 additions & 0 deletions scripts/browser
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh -e

WEBPACK_CMD=node_modules/.bin/webpack

mkdir -p dist

$WEBPACK_CMD src/index.js dist/redux.js
NODE_ENV=production $WEBPACK_CMD src/index.js dist/redux.min.js

$WEBPACK_CMD src/react.js dist/redux-react.js
NODE_ENV=production $WEBPACK_CMD src/react.js dist/redux-react.min.js

$WEBPACK_CMD src/react-native.js dist/redux-react-native.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, let's ditch it, it's the same thing.

NODE_ENV=production $WEBPACK_CMD src/react-native.js dist/redux-react-native.min.js
1 change: 1 addition & 0 deletions scripts/prepublish
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

sh scripts/lint
sh scripts/clean
sh scripts/browser
sh scripts/build
41 changes: 41 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict';

var webpack = require('webpack');

var plugins = [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new webpack.optimize.OccurenceOrderPlugin()
];

if (process.env.NODE_ENV === 'production') {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
warnings: false
}
})
);
}

module.exports = {
externals: {
'react': 'React',
'react-native': 'React'
},
module: {
loaders: [
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ }
]
},
output: {
library: 'Redux',
libraryTarget: 'var'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
plugins: plugins,
resolve: {
extensions: ['', '.js']
}
};