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

chore: bundle with umi-library #2015

Merged
merged 13 commits into from
Mar 7, 2019
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
23 changes: 8 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
.DS_Store
tmp
node_modules
lib
es
dist
coverage
.nyc_output
npm-debug.log*
lerna-debug.log
package-lock.json
.changelog
.next/
examples/**/.umi
examples/**/.umi-production
/coverage
/.changelog
/examples/**/.umi
/examples/**/.umi-production
/website/build
yarn.lock
/node_modules
/packages/**/node_modules
/packages/**/dist
/lerna-debug.log
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
language: node_js

node_js:
- "7"
- "8"
- "9"
- "10"

before_script:
Expand Down
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,9 @@ Want more?

## Community

### 微信群

<img src="https://img03.sogoucdn.com/app/a/100520146/3544b6bbdd976ef3caa4f44cd9de38e5" width="60" />

扫码加 `UMI_HELPER`,回复 `dva` 自动加群。

### Telegram

[https://t.me/joinchat/G0DdHw9tDZC-_NmdKY2jYg](https://t.me/joinchat/G0DdHw9tDZC-_NmdKY2jYg)
| Slack Group | Github Issue | 钉钉群 | 微信群 |
| ------------------------------------------------------------ | ------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [sorrycc.slack.com](https://join.slack.com/t/sorrycc/shared_invite/enQtNTUzMTYxNDQ5MzE4LTg1NjEzYWUwNDQzMWU3YjViYjcyM2RkZDdjMzE0NzIxMTg3MzIwMDM2YjUwNTZkNDdhNTY5ZTlhYzc1Nzk2NzI) | [umijs/umi/issues](https://github.com/umijs/umi/issues) | <img src="https://gw.alipayobjects.com/zos/rmsportal/jPXcQOlGLnylGMfrKdBz.jpg" width="60" /> | <img src="https://img.alicdn.com/tfs/TB13U6aF6DpK1RjSZFrXXa78VXa-752-974.jpg" width="60" /> |

## License

Expand Down
12 changes: 3 additions & 9 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,9 @@

## 社区

### 微信群

<img src="https://img03.sogoucdn.com/app/a/100520146/3544b6bbdd976ef3caa4f44cd9de38e5" width="60" />

扫码加 `UMI_HELPER`,回复 `dva` 自动加群。

### Telegram

[https://t.me/joinchat/G0DdHw9tDZC-_NmdKY2jYg](https://t.me/joinchat/G0DdHw9tDZC-_NmdKY2jYg)
| Slack Group | Github Issue | 钉钉群 | 微信群 |
| ------------------------------------------------------------ | ------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [sorrycc.slack.com](https://join.slack.com/t/sorrycc/shared_invite/enQtNTUzMTYxNDQ5MzE4LTg1NjEzYWUwNDQzMWU3YjViYjcyM2RkZDdjMzE0NzIxMTg3MzIwMDM2YjUwNTZkNDdhNTY5ZTlhYzc1Nzk2NzI) | [umijs/umi/issues](https://github.com/umijs/umi/issues) | <img src="https://gw.alipayobjects.com/zos/rmsportal/jPXcQOlGLnylGMfrKdBz.jpg" width="60" /> | <img src="https://img.alicdn.com/tfs/TB13U6aF6DpK1RjSZFrXXa78VXa-752-974.jpg" width="60" /> |

## License

Expand Down
13 changes: 6 additions & 7 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
},
"cacheDir": ".changelog"
},
"commands": {
"publish": {
"ignore": [
"dva-example*"
]
}
},
"packages": [
"packages/*"
],
"command": {
"version": {
"exact": true
}
},
"npmClient": "yarn",
"version": "independent"
}
25 changes: 3 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"private": true,
"scripts": {
"build": "node scripts/build.js",
"build:es": "ES=1 node scripts/build.js",
"build:umd:clean": "rm -rf packages/dva/dist",
"build:umd": "node scripts/umd.js",
"build:umd:production": "NODE_ENV=production node scripts/umd.js",
"build": "umi-lib build",
"doc:dev": "./website/node_modules/.bin/vuepress dev ./docs",
"doc:deploy": "cd ./website && npm run deploy && cd -",
"changelog": "lerna-changelog",
Expand All @@ -18,12 +14,6 @@
"bootstrap": "lerna bootstrap"
},
"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^9.0.0",
"chalk": "^2.3.2",
"coveralls": "^3.0.0",
Expand All @@ -32,25 +22,16 @@
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.11.1",
"expect": "^1.20.2",
"husky": "^0.14.3",
"lerna": "^3.4.0",
"lerna-changelog": "^0.8.0",
"lint-staged": "^7.2.2",
"prettier": "^1.14.3",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"rimraf": "^2.6.2",
"rollup": "^0.66.1",
"rollup-plugin-commonjs": "^9.1.8",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^6.0.0",
"shelljs": "^0.8.1",
"through2": "^2.0.3",
"uglify-js": "^3.4.9",
"umi-test": "^1.0.0",
"vinyl-fs": "^3.0.2"
"umi-library": "^1.0.0",
"umi-test": "^1.0.0"
},
"lint-staged": {
"*.js": [
Expand Down
5 changes: 5 additions & 0 deletions packages/dva-core/.umirc.library.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
cjs: 'rollup',
esm: 'rollup',
runtimeHelpers: true,
};
1 change: 0 additions & 1 deletion packages/dva-core/index.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/dva-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "dva-core",
"version": "1.5.0-beta.2",
"description": "The core lightweight library for dva, based on redux and redux-saga.",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/dvajs/dva"
Expand Down
1 change: 0 additions & 1 deletion packages/dva-core/saga.js

This file was deleted.

10 changes: 5 additions & 5 deletions packages/dva-core/src/getSaga.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import invariant from 'invariant';
import * as sagaEffects from 'redux-saga/lib/effects';
import warning from 'warning';
import {
takeEveryHelper as takeEvery,
takeLatestHelper as takeLatest,
throttleHelper as throttle,
} from 'redux-saga/lib/internal/sagaHelpers';
effects as sagaEffects,
takeEvery,
takeLatest,
throttle,
} from 'redux-saga';
import { NAMESPACE_SEP } from './constants';
import prefixType from './prefixType';

Expand Down
9 changes: 7 additions & 2 deletions packages/dva-core/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { combineReducers } from 'redux';
import createSagaMiddleware from 'redux-saga/lib/internal/middleware';
import createSagaMiddleware, * as saga from 'redux-saga';
import invariant from 'invariant';
import checkModel from './checkModel';
import prefixNamespace from './prefixNamespace';
Expand All @@ -12,7 +12,9 @@ import {
run as runSubscription,
unlisten as unlistenSubscription,
} from './subscription';
import { noop, findIndex } from './utils';
import * as utils from './utils';

const { noop, findIndex } = utils;

// Internal model to update global state when do unmodel
const dvaModel = {
Expand Down Expand Up @@ -277,3 +279,6 @@ export function create(hooksAndOpts = {}, createOpts = {}) {
}
}
}

export { saga };
export { utils };
1 change: 0 additions & 1 deletion packages/dva-core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export isPlainObject from 'is-plain-object';
export const isArray = Array.isArray.bind(Array);
export const isFunction = o => typeof o === 'function';
export const returnSelf = m => m;
// avoid es6 array.prototype.findIndex polyfill
export const noop = () => {};
export const findIndex = (array, predicate) => {
for (let i = 0, length = array.length; i < length; i++) {
Expand Down
9 changes: 4 additions & 5 deletions packages/dva-core/test/checkModel.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import expect from 'expect';
import { create } from '../src/index';

describe('checkModel', () => {
Expand Down Expand Up @@ -28,7 +27,7 @@ describe('checkModel', () => {
namespace: '_array',
reducers: [{}, () => {}],
});
}).toNotThrow();
}).not.toThrow();
});

it('reducers can be object', () => {
Expand All @@ -38,7 +37,7 @@ describe('checkModel', () => {
namespace: '_object',
reducers: {},
});
}).toNotThrow();
}).not.toThrow();
});

it('reducers can not be string', () => {
Expand Down Expand Up @@ -85,7 +84,7 @@ describe('checkModel', () => {
app.model({
namespace: '_',
});
}).toNotThrow();
}).not.toThrow();
});

it('effects should be plain object', () => {
Expand All @@ -107,6 +106,6 @@ describe('checkModel', () => {
namespace: '_',
effects: {},
});
}).toNotThrow();
}).not.toThrow();
});
});
113 changes: 113 additions & 0 deletions packages/dva-core/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@babel/runtime@^7.0.0":
version "7.3.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.3.4.tgz#73d12ba819e365fcf7fd152aed56d6df97d21c83"
integrity sha512-IvfvnMdSaLBateu0jfsYIpZTxAc2cKEXEMiezGGN75QcBcecDUKd3PgLAncT0oOgxKy8dd8hrJKj9MfzgfZd6g==
dependencies:
regenerator-runtime "^0.12.0"

dom-walk@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
integrity sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=

flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
integrity sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=

global@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/global/-/global-4.3.2.tgz#e76989268a6c74c38908b1305b10fc0e394e9d0f"
integrity sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=
dependencies:
min-document "^2.19.0"
process "~0.5.1"

invariant@^2.2.1:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
dependencies:
loose-envify "^1.0.0"

is-plain-object@^2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677"
integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==
dependencies:
isobject "^3.0.1"

isobject@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=

"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==

lodash-es@^4.2.1:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0"
integrity sha512-DHb1ub+rMjjrxqlB3H56/6MXtm1lSksDp2rA2cNWjG8mlDUYFhUj3Di2Zn5IwSU87xLv8tNIQ7sSwE/YOX/D/Q==

lodash@^4.2.1:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==

loose-envify@^1.0.0, loose-envify@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
dependencies:
js-tokens "^3.0.0 || ^4.0.0"

min-document@^2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=
dependencies:
dom-walk "^0.1.0"

process@~0.5.1:
version "0.5.2"
resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf"
integrity sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=

redux-saga@^0.16.0:
version "0.16.2"
resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.16.2.tgz#993662e86bc945d8509ac2b8daba3a8c615cc971"
integrity sha512-iIjKnRThI5sKPEASpUvySemjzwqwI13e3qP7oLub+FycCRDysLSAOwt958niZW6LhxfmS6Qm1BzbU70w/Koc4w==

redux@^3.7.1:
version "3.7.2"
resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b"
integrity sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==
dependencies:
lodash "^4.2.1"
lodash-es "^4.2.1"
loose-envify "^1.1.0"
symbol-observable "^1.0.3"

regenerator-runtime@^0.12.0:
version "0.12.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de"
integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==

symbol-observable@^1.0.3:
version "1.2.0"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==

warning@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c"
integrity sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=
dependencies:
loose-envify "^1.0.0"
5 changes: 5 additions & 0 deletions packages/dva-immer/.umirc.library.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
cjs: 'rollup',
esm: 'rollup',
runtimeHelpers: true,
};
Loading