Skip to content

chore(build): makes redux a peerDependency #184

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

Merged
merged 1 commit into from
Feb 7, 2018
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ npm-debug.log
.DS_Store
lib
es
umd
coverage
*.tgz
examples/**/dist
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,26 @@ npm install --save ng-redux
```

#### bower (deprecated)
**Warning!** Bower recommends using yarn and webpack as an alternative for new projects. `ng-redux` will no longer version compiled versions of code. The latest version of ng-redux supported for bower use is `3.5.2`
**Warning!** Starting with 4.0.0, we will no longer be publishing new releases on Bower. You can continue using Bower for old releases, or point your bower config to the UMD build hosted on unpkg that mirrors our npm releases.

```js
bower install --save ng-redux#3.5.2
```json
{
"dependencies": {
"ng-redux": "https://unpkg.com/ng-redux/umd/ng-redux.min.js"
Copy link
Collaborator

Choose a reason for hiding this comment

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

neat! Had no idea you could do that!

}
}
```

Add the following script tag to your html:

```html
<script src="bower_components/ng-redux/dist/ng-redux.js"></script>
```

Or directly from unpkg
```html
<script src="https://unpkg.com/ng-redux/umd/ng-redux.min.js"></script>
```

## Quick Start

#### Initialization
Expand Down
20 changes: 13 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"lib",
"es",
"src",
"umd",
"index.d.ts"
],
"scripts": {
"clean": "rimraf lib dist es",
"commitmsg": "commitlint -e $GIT_PARAMS",
"build": "npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min",
"build:commonjs": "cross-env NODE_ENV=cjs rollup -c -o lib/ng-redux.js",
"build:es": "cross-env NODE_ENV=es rollup -c -o es/ng-redux.js",
"build": "npm run build:commonjs && npm run build:es",
"test": "cross-env NODE_ENV=test mocha --compilers js:babel-register --recursive",
"build:umd": "cross-env NODE_ENV=development rollup -c -o umd/ng-redux.js",
"build:umd:min": "cross-env NODE_ENV=production rollup -c -o umd/ng-redux.min.js",
"clean": "rimraf lib umd es",
"commitmsg": "commitlint -e $GIT_PARAMS",
"prepublish": "npm run clean && npm test && npm run build",
"prerelease": "npm run prepublish"
"prerelease": "npm run prepublish",
"test": "cross-env NODE_ENV=test mocha --compilers js:babel-register --recursive"
},
"repository": {
"type": "git",
Expand All @@ -41,6 +44,7 @@
"expect": "^1.20.2",
"husky": "^0.14.3",
"mocha": "^3.5.0",
"redux": "^3.7.2",
"rimraf": "^2.6.1",
"rollup": "^0.47.4",
"rollup-plugin-babel": "^3.0.2",
Expand All @@ -58,7 +62,9 @@
"lodash.isfunction": "^3.0.8",
"lodash.isobject": "^3.0.2",
"lodash.isplainobject": "^4.0.6",
"lodash.map": "^4.6.0",
"redux": "^3.7.2"
"lodash.map": "^4.6.0"
},
"peerDependencies": {
"redux": "^3.0.0"
}
}
13 changes: 10 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify';
import { dependencies } from './package.json'
import { dependencies, devDependencies } from './package.json'

const env = process.env.NODE_ENV;
const config = {
entry: 'src/index.js',
plugins: [],
};

const externals = Object.keys(dependencies).join('|');
const externals = [
...Object.keys(dependencies),
...Object.keys(devDependencies),
].join('|');

if (env === 'es' || env === 'cjs') {
config.format = env;
Expand All @@ -28,6 +31,10 @@ if (env === 'development' || env === 'production') {
config.format = 'umd';
config.moduleName = 'NgRedux';
config.sourceMap = true;
config.external = ['redux'];
config.globals = {
redux: 'Redux',
};
config.plugins.push(
replace({
'process.env.NODE_ENV': JSON.stringify(env)
Expand All @@ -38,7 +45,7 @@ if (env === 'development' || env === 'production') {
commonjs(),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**'
exclude: 'node_modules/**',
})
)
}
Expand Down