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

Combine V4 & V5 together #2248

Merged
merged 15 commits into from
Jan 23, 2020
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
36 changes: 15 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ jobs:
paths:
- ./*

test-all:
test-check:
executor: my-executor
steps:
- attach_workspace:
at: .

- run: yarn test:all
- run: yarn test:check

test-performance:
executor: my-executor
Expand All @@ -60,7 +60,12 @@ jobs:
at: .

- run:
command: time node --expose-gc test/perf/index.js
command: time node --expose-gc test/perf/index.js v4
environment:
PERSIST: true

- run:
command: time node --expose-gc test/perf/index.js v5
environment:
PERSIST: true

Expand All @@ -70,27 +75,19 @@ jobs:
- attach_workspace:
at: .

- run: yarn test -i --coverage
- run: yarn test:coverage
- persist_to_workspace:
root: .
paths:
- ./coverage

test-webpack:
executor: my-executor
steps:
- attach_workspace:
at: .

- run: yarn test:webpack

test-size:
executor: my-executor
steps:
- attach_workspace:
at: .

- run: yarn size
- run: yarn test:size

# upload coverage
upload-coveralls:
Expand All @@ -116,11 +113,11 @@ workflows:
build-and-test:
jobs:
- build:
filters:
branches:
ignore:
- gh-pages
- test-all:
filters:
branches:
ignore:
- gh-pages
- test-check:
requires:
- build
- test-performance:
Expand All @@ -129,9 +126,6 @@ workflows:
- test-coverage:
requires:
- build
- test-webpack:
requires:
- build
- test-size:
requires:
- build
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ node_modules
npm-debug.log
coverage
notes.md
lib
test/babel-tests.js
test/typescript/typescript-tests.js
test/perf/perf.txt
dist/
.build*/
.idea
.wp-build*/
*.iml
Expand Down
8 changes: 7 additions & 1 deletion .size-limit.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[
{
"path": "lib/mobx.js",
"path": "dist/v4/lib/mobx.js",
"limit": "20 KB",
"running": false
},
{
"path": "dist/v5/lib/mobx.js",
"limit": "20 KB",
"running": false
}

]
9 changes: 5 additions & 4 deletions flow-typed/mobx.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@ export interface IObservableArray<T> extends Array<T> {
fireImmediately?: boolean
): Lambda;
intercept(handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda;
intercept(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda;
intercept<T>(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda;
intercept(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda; // TODO: remove in 4.0
intercept<T>(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda; // TODO: remove in 4.0
clear(): T[];
peek(): T[];
replace(newItems: T[]): T[];
find(
predicate: (item: T, index: number, array: Array<T>) => mixed,
Expand Down Expand Up @@ -340,7 +341,7 @@ declare export function reaction<T>(
expression: (r: IReactionPublic) => T,
effect: (arg: T, r: IReactionPublic) => void,
opts?: IReactionOptions
): () => void
): () => mixed

export interface IWhenOptions {
name?: string;
Expand All @@ -356,7 +357,7 @@ declare export function when(
cond: () => boolean,
effect: Lambda,
options?: IWhenOptions
): () => void
): () => mixed
declare export function when(cond: () => boolean, options?: IWhenOptions): Promise<any>

declare export function computed<T>(
Expand Down
26 changes: 15 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobx",
"version": "5.15.2",
"version": "0.15.2",
"description": "Simple, scalable state management.",
"main": "lib/mobx.js",
"umd:main": "lib/mobx.umd.js",
Expand All @@ -15,20 +15,22 @@
"typings": "lib/mobx.d.ts",
"scripts": {
"test": "jest",
"lint": "eslint src/**/*.ts",
"watch": "jest --watch",
"perf": "yarn test:performance v4 && yarn test:performance v5",
"test:mixed-versions": "jest --testRegex mixed-versions",
"test:all": "yarn tsc --noEmit && yarn lint && yarn jest -i && yarn test:flow && yarn test:mixed-versions",
"test:webpack": "node scripts/webpack-regression-tests.js",
"test:check": "yarn test:types && yarn lint",
"test:types": "yarn tsc --noEmit && yarn test:flow",
"test:flow": "node_modules/.bin/flow check",
"test:coverage": "yarn test -i --coverage",
"test:performance": "PERSIST=true time node --expose-gc test/perf/index.js",
"test:ci": "yarn test:all && yarn test:performance && yarn test -i --coverage && yarn test:webpack && yarn size",
"test:size": "size-limit",
"prettier": "prettier \"**/*.js\" \"**/*.jsx\" \"**/*.tsx\" \"**/*.ts\" \"docs/**/*.md\"",
"_prepublish": "yarn small-build",
"quick-build": "tsc --pretty",
"small-build": "node scripts/build.js",
"lint": "eslint src/**/*.ts",
"size": "size-limit",
"publish-script": "node scripts/publish.js",
"release": "node scripts/publish.js",
"publish-script": "yarn release",
"docs:build": "yarn --cwd website build",
"docs:start": "yarn --cwd website start",
"docs:publish": "yarn --cwd website publish-gh-pages",
Expand All @@ -43,7 +45,7 @@
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/immer"
"url": "https://opencollective.com/mobx"
},
"bugs": {
"url": "https://github.com/mobxjs/mobx/issues"
Expand All @@ -53,13 +55,15 @@
"LICENSE"
],
"homepage": "https://mobx.js.org/",
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-decorators": "^7.3.0",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@babel/runtime": "^7.3.4",
"@size-limit/preset-big-lib": "^3.0.0",
"@types/jest": "^24.0.11",
"@types/node": "^11.11.3",
"@typescript-eslint/eslint-plugin": "^1.4.2",
Expand All @@ -75,20 +79,20 @@
"jest": "^24.5.0",
"lint-staged": "^8.1.5",
"prettier": "^1.16.4",
"prompts": "^2.3.0",
"rollup": "^1.6.0",
"rollup-plugin-filesize": "^6.0.1",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-terser": "^4.0.4",
"semver": "^7.1.1",
"serializr": "^1.5.1",
"shelljs": "^0.8.3",
"size-limit": "^1.3.3",
"tape": "^4.10.1",
"ts-jest": "^24.0.0",
"tslib": "^1.9.3",
"typescript": "^3.3.3333"
},
"dependencies": {},
"keywords": [
"mobx",
"mobservable",
Expand Down Expand Up @@ -119,7 +123,7 @@
"^.+\\.tsx?$": "ts-jest",
"^.+\\.jsx?$": "babel-jest"
},
"testRegex": "test/base/.*\\.(t|j)sx?$",
"testRegex": "test/v[4|5]/base/.*\\.(t|j)sx?$",
"moduleFileExtensions": [
"ts",
"tsx",
Expand Down
Loading