Skip to content
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
16 changes: 13 additions & 3 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ jobs:
size:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: andresz1/size-limit-action@v1
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
node-version: 20.x
- name: Test
run: |
yarn install
npm run build
npm run size
# - uses: andresz1/size-limit-action@v1.8.0
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# package_manager: yarn
12 changes: 6 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Test
run: |
npm install
yarn install
npm run build
npm run test:ci
env:
CI: true
- name: Archive code coverage results
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
name: code-coverage-report-${{ matrix.node-version }}
path: junit.xml
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"lint": "eslint \"{src,test}/**/*.{ts,tsx}\" --ext .js,.ts,.tsx --ignore-pattern node_modules/",
"check": "npm run style && npm run lint",
"check:ci": "npm run style:ci && npm run lint",
"build:clean": "rimraf dist %% mkdirp dist",
"build:clean": "rimraf dist && mkdirp dist",
"build:compile": "rollup -c",
"build:tsc": "tsc",
"build": "run-s build:clean build:compile",
Expand All @@ -42,7 +42,7 @@
"test:coverage:open": "run-s test:coverage coverage:report",
"test:unit:ci": "jest --ci --coverage --reporters=default --reporters=jest-junit",
"coverage:report": "open coverage/lcov-report/index.html",
"test:ci": "run-s check:ci test:unit:ci size",
"test:ci": "run-s check:ci test:unit:ci",
"size": "run-s build size:check",
"size:check": "size-limit",
"prepublishOnly": "run-s test:ci",
Expand All @@ -60,10 +60,12 @@
},
"size-limit": [
{
"name": "CommonJS",
"path": "dist/main.js",
"limit": "2.9kb"
},
{
"name": "ESM",
"webpack": false,
"path": "dist/module.js",
"limit": "3.5kb"
Expand All @@ -76,8 +78,8 @@
"@size-limit/preset-small-lib": "^5.0.2",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.1.1",
"@types/react": "^17.0.16",
"@types/react-dom": "^17.0.9",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"eslint": "^8.10.0",
Expand All @@ -98,10 +100,10 @@
"rollup": "^2.56.1",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"size-limit": "^5.0.2",
"rollup-plugin-typescript2": "^0.36.0",
"size-limit": "7.x",
"ts-jest": "^27.1.4",
"tslib": "^2.3.0",
"tslib": "^2.8.1",
"typescript": "^4.3.5"
}
}
6 changes: 3 additions & 3 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function usePathParams<Path extends string>(
options?: PathParamOptions
):
| ValueOf<{
[P in typeof routes[number]]: [
[P in (typeof routes)[number]]: [
P,
NonEmptyRecord<ExtractPathParams<P extends `${infer P1}*` ? P1 : P>>
]
Expand All @@ -119,7 +119,7 @@ export function usePathParams<Params extends ReadonlyArray<string> | string>(
): Params extends ReadonlyArray<string>
?
| ValueOf<{
[P in typeof routes[number]]: [
[P in (typeof routes)[number]]: [
P,
NonEmptyRecord<ExtractPathParams<P extends `${infer P1}*` ? P1 : P>>
]
Expand All @@ -142,7 +142,7 @@ export function usePathParams<Params extends ReadonlyArray<string> | string>(
return isSingle
? props
: ([routeMatch.path, props] as ValueOf<{
[P in typeof routes[number]]: [
[P in (typeof routes)[number]]: [
P,
NonEmptyRecord<ExtractPathParams<P extends `${infer P1}*` ? P1 : P>>
]
Expand Down
76 changes: 38 additions & 38 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
{
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
"include": ["src"],
"compilerOptions": {
"module": "esnext",
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"target": "ES2019",
// "noEmitHelpers": true,
"importHelpers": true,
// output .d.ts declaration files for consumers
"declaration": true,
// output .js.map sourcemap files for consumers
"sourceMap": true,
// match output dir to input dir. e.g. dist/index instead of dist/src/index
"rootDir": "./src",
"outDir": "build",
// stricter type-checking for stronger correctness. Recommended by TS
"strict": true,
// linter checks for common issues
"noImplicitReturns": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noFallthroughCasesInSwitch": true,
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
"noUnusedLocals": true,
"noUnusedParameters": true,
// use Node's module resolution algorithm, instead of the legacy TS one
"moduleResolution": "node",
// transpile JSX to React.createElement
"jsx": "react",
// interop between ESM and CJS modules. Recommended by TS
"esModuleInterop": true,
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
"skipLibCheck": true,
// error out if import and file system have a casing mismatch. Recommended by TS
"forceConsistentCasingInFileNames": true,
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
// "noEmit": true
}
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
"include": ["src"],
"compilerOptions": {
"module": "esnext",
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"target": "ES2019",
// "noEmitHelpers": true,
"importHelpers": true,
// output .d.ts declaration files for consumers
"declaration": true,
// output .js.map sourcemap files for consumers
"sourceMap": true,
// match output dir to input dir. e.g. dist/index instead of dist/src/index
"rootDir": "./src",
"outDir": "build",
// stricter type-checking for stronger correctness. Recommended by TS
"strict": true,
// linter checks for common issues
"noImplicitReturns": true,
"noImplicitAny": false,
"strictNullChecks": true,
"noFallthroughCasesInSwitch": true,
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
"noUnusedLocals": true,
"noUnusedParameters": true,
// use Node's module resolution algorithm, instead of the legacy TS one
"moduleResolution": "node",
// transpile JSX to React.createElement
"jsx": "react",
// interop between ESM and CJS modules. Recommended by TS
"esModuleInterop": true,
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
"skipLibCheck": true,
// error out if import and file system have a casing mismatch. Recommended by TS
"forceConsistentCasingInFileNames": true
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
// "noEmit": true
}
}
Loading
Loading