Skip to content

Commit 80a9fd6

Browse files
committed
chore: remove tsdx and upgrade dependencies
1 parent 03ef720 commit 80a9fd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1860
-4740
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v2
1616
- uses: actions/setup-node@v1
1717
with:
18-
node-version: '12'
18+
node-version: '14'
1919
- run: yarn install --frozen-lockfile
2020
- run: yarn lint
2121

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ node_modules
44
coverage
55
.cache
66
packages/core/dist/**
7-
!packages/core/dist/index.js
7+
!packages/core/dist/index.cjs
88
packages/utils/dist/**
9-
!packages/utils/dist/index.js
9+
!packages/utils/dist/index.cjs
1010
packages/dom/dist/**
11-
!packages/dom/dist/index.js
11+
!packages/dom/dist/index.cjs

package.json

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
{
2020
"path": "./packages/dom/dist/dom.cjs.production.min.js",
21-
"maxSize": "1 kB",
21+
"maxSize": "2 kB",
2222
"compression": "none"
2323
},
2424
{
@@ -40,22 +40,29 @@
4040
"trailingComma": "all"
4141
},
4242
"devDependencies": {
43-
"cross-env": "^7.0.3",
44-
"esbuild": "^0.11.2",
45-
"eslint-plugin-prettier": "^3.3.1",
43+
"@babel/preset-env": "^7.14.2",
44+
"@babel/preset-typescript": "^7.13.0",
45+
"@testing-library/jest-dom": "^5.12.0",
46+
"@testing-library/react": "^11.2.7",
47+
"@testing-library/react-hooks": "^7.0.0",
48+
"@types/jest": "^26.0.23",
49+
"@types/react": "^17.0.8",
50+
"@types/react-dom": "^17.0.5",
51+
"esbuild": "^0.12.3",
52+
"jest": "^27.0.1",
53+
"jest-marbles": "^2.5.1",
4654
"husky": "^4.3.7",
4755
"lint-staged": "^10.5.4",
48-
"prettier": "^2.2.1",
49-
"typescript": "^4.2.3",
56+
"prettier": "^2.3.0",
57+
"react": "^17.0.2",
58+
"react-dom": "^17.0.2",
59+
"react-test-renderer": "^17.0.2",
60+
"rxjs": "^7.1.0",
61+
"typescript": "^4.2.4",
62+
"ts-jest": "^27.0.1",
63+
"tslib": "^2.2.0",
5064
"wsrun": "^5.2.4"
5165
},
52-
"resolutions": {
53-
"**/@typescript-eslint/eslint-plugin": "^4.11.1",
54-
"**/@typescript-eslint/parser": "^4.11.1",
55-
"**/jest": "^26.6.3",
56-
"**/ts-jest": "^26.4.4",
57-
"**/typescript": "^4.2.3"
58-
},
5966
"lint-staged": {
6067
"*.{js,jsx,ts,tsx,json,md}": "prettier --write"
6168
},

packages/core/babel.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Only used by Jest
2+
module.exports = {
3+
presets: [
4+
[
5+
"@babel/preset-env",
6+
{ useBuiltIns: "entry", corejs: "2", targets: { node: "current" } },
7+
],
8+
"@babel/preset-typescript",
9+
],
10+
plugins: [
11+
function () {
12+
return {
13+
visitor: {
14+
MetaProperty(path) {
15+
path.replaceWithSourceString("process")
16+
},
17+
},
18+
}
19+
},
20+
],
21+
}
File renamed without changes.

packages/core/jest.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
module.exports = {
2+
preset: "ts-jest",
3+
testEnvironment: "jsdom",
4+
moduleNameMapper: {
5+
"^@/(.*)$": "<rootDir>/src/$1",
6+
},
7+
setupFilesAfterEnv: ["<rootDir>/setupTests.ts"],
28
globals: {
39
"ts-jest": {
4-
diagnostics: false,
10+
babelConfig: true,
511
},
612
},
713
}

packages/core/package.json

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,25 @@
66
},
77
"license": "MIT",
88
"sideEffects": false,
9-
"exports": "dist/core.esm2019.js",
10-
"module": "dist/core.esm2017.js",
11-
"main": "dist/index.js",
12-
"typings": "dist/index.d.ts",
9+
"exports": {
10+
"import": "./dist/core.es2019.mjs",
11+
"require": "./dist/index.cjs"
12+
},
13+
"module": "./dist/core.es2017.mjs",
14+
"main": "./dist/index.cjs",
15+
"typings": "./dist/index.d.ts",
1316
"files": [
1417
"dist"
1518
],
1619
"scripts": {
17-
"start": "tsdx watch",
1820
"build": "yarn build:ts && yarn build:esm2017 && yarn build:esm2019 && yarn build:cjs:dev && yarn build:cjs:prod",
19-
"build:esm2019": "esbuild src/index.tsx --bundle --outfile=./dist/core.esm2019.js --target=es2019 --external:react --external:rxjs --format=esm --sourcemap",
20-
"build:esm2017": "esbuild src/index.tsx --bundle --outfile=./dist/core.esm2017.js --target=es2017 --external:react --external:rxjs --format=esm --sourcemap",
21+
"build:esm2019": "esbuild src/index.tsx --bundle --outfile=./dist/core.es2019.mjs --target=es2019 --external:react --external:rxjs --format=esm --sourcemap",
22+
"build:esm2017": "esbuild src/index.tsx --bundle --outfile=./dist/core.es2017.mjs --target=es2017 --external:react --external:rxjs --format=esm --sourcemap",
2123
"build:cjs:dev": "esbuild src/index.tsx --bundle --outfile=./dist/core.cjs.development.js --target=es2015 --external:react --external:rxjs --format=cjs --sourcemap",
2224
"build:cjs:prod": "esbuild src/index.tsx --bundle --outfile=./dist/core.cjs.production.min.js --target=es2015 --external:react --external:rxjs --format=cjs --minify --sourcemap",
23-
"build:ts": "tsc -p ./tsconfig.json --outDir ./dist --skipLibCheck --emitDeclarationOnly",
24-
"test": "tsdx test --coverage",
25-
"lint": "prettier --check README.md && tsdx lint src",
25+
"build:ts": "tsc -p ./tsconfig-build.json --outDir ./dist --skipLibCheck --emitDeclarationOnly",
26+
"test": "jest --coverage",
27+
"lint": "prettier --check README.md \"src/**/*.{js,jsx,ts,tsx,json,md}\"",
2628
"format": "prettier --write README.md \"src/**/*.{js,jsx,ts,tsx,json,md}\"",
2729
"prepare": "yarn build"
2830
},
@@ -39,22 +41,5 @@
3941
"authors": [
4042
"Josep M Sobrepere (https://github.com/josepot)",
4143
"Victor Oliva (https://github.com/voliva)"
42-
],
43-
"devDependencies": {
44-
"@testing-library/react": "^11.2.6",
45-
"@testing-library/react-hooks": "^5.1.1",
46-
"@types/jest": "^26.0.22",
47-
"@types/react": "^17.0.3",
48-
"@types/react-dom": "^17.0.3",
49-
"esbuild": "^0.11.2",
50-
"jest-marbles": "^2.5.1",
51-
"lint-staged": "^10.5.4",
52-
"react": "^17.0.2",
53-
"react-dom": "^17.0.2",
54-
"react-test-renderer": "^17.0.2",
55-
"rxjs": "^6.6.7",
56-
"tsdx": "^0.14.1",
57-
"tslib": "^2.1.0",
58-
"typescript": "^4.2.3"
59-
}
60-
}
44+
]
45+
}

packages/core/setupTests.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// jest-dom adds custom jest matchers for asserting on DOM nodes.
2+
// allows you to do things like:
3+
// expect(element).toHaveTextContent(/react/i)
4+
// learn more: https://github.com/testing-library/jest-dom
5+
import "@testing-library/jest-dom"

packages/core/src/Subscribe.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ export const Subscribe: React.FC<{
4646
subscriptionRef.current = new Subscription()
4747
}
4848

49-
const [subscribedSource, setSubscribedSource] = useState<
50-
Observable<any> | null | undefined
51-
>(null)
49+
const [subscribedSource, setSubscribedSource] =
50+
useState<Observable<any> | null | undefined>(null)
5251

5352
if (subscribedSource !== null && subscribedSource !== source$) {
5453
if (source$ === undefined) {

packages/core/src/bind/connectFactoryObservable.test.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
merge,
1010
EMPTY,
1111
NEVER,
12-
noop,
1312
} from "rxjs"
1413
import { renderHook, act as actHook } from "@testing-library/react-hooks"
1514
import {
@@ -145,11 +144,9 @@ describe("connectFactoryObservable", () => {
145144
return from([1, 2, 3, 4, 5])
146145
})
147146

148-
const [
149-
useLatestNumber,
150-
latestNumber$,
151-
] = bind((id: number, value: { val: number }) =>
152-
concat(observable$, of(id + value.val)),
147+
const [useLatestNumber, latestNumber$] = bind(
148+
(id: number, value: { val: number }) =>
149+
concat(observable$, of(id + value.val)),
153150
)
154151
expect(subscriberCount).toBe(0)
155152

@@ -835,13 +832,15 @@ describe("connectFactoryObservable", () => {
835832
it("does not crash when the observable lazily references its enhanced self", () => {
836833
const [, obs$] = bind(
837834
(key: number) => defer(() => obs$(key)).pipe(take(1)),
838-
(key) => key,
839-
)
835+
(key: number) => key,
836+
) as [(key: number) => number, (key: number) => Observable<number>]
840837

841838
let error = null
842839
obs$(1)
843-
.subscribe(noop, (e: any) => {
844-
error = e
840+
.subscribe({
841+
error: (e: any) => {
842+
error = e
843+
},
845844
})
846845
.unsubscribe()
847846

0 commit comments

Comments
 (0)