Skip to content

Commit

Permalink
refactor: better type declarations (refinedev#2440)
Browse files Browse the repository at this point in the history
* fix(core): useResource `any` issue on ts compiler

* chore: add changeset

* refactor(core): add custom tsconfig file for declarations

* chore(core): add `.npmignore` for smaller install size

* refactor(core): separation of declarations from `tsup` to `tsc`

* chore(core): add changeset

* test(ui-tests): fix missing prop type

* chore(ui-types): add changeset for fix

* chore(antd-mui): add changeset for type declarations

* chore: add `.npmignore` for smaller install sizes

* chore: add type declaration changesets

* refactor: update type declarations with declaration maps

* chore: fix typo in changes

Co-authored-by: Aydın <[email protected]>

* fix: `ThemeProvider` export

* chore(mui): add changeset for export change

Co-authored-by: Aydın <[email protected]>
  • Loading branch information
aliemir and biskuvit authored Sep 6, 2022
1 parent 333bea0 commit 0150dcd
Show file tree
Hide file tree
Showing 131 changed files with 1,074 additions and 155 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-pumas-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pankod/refine-core": minor
---

Updated the generation of type declarations, moved the declarations from `tsup` to `tsc` for a better experience with `Peek Definition` and `Go to Definition` features. After this change, it's expected to navigate to the source code of the `refine` packages instead of the `dist` directory with combined declarations.
5 changes: 5 additions & 0 deletions .changeset/curly-rats-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pankod/refine-mui": minor
---

Update type declaration generation with `tsc` instead of `tsup` for better navigation throughout projects source code.
31 changes: 31 additions & 0 deletions .changeset/gentle-points-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
"@pankod/refine-ably": minor
"@pankod/refine-airtable": minor
"@pankod/refine-altogic": minor
"@pankod/refine-antd-audit-log": minor
"@pankod/refine-appwrite": minor
"@pankod/refine-cloud": minor
"@pankod/refine-demo-sidebar": minor
"@pankod/refine-graphql": minor
"@pankod/refine-hasura": minor
"@pankod/refine-kbar": minor
"@pankod/refine-medusa": minor
"@pankod/refine-nestjsx-crud": minor
"@pankod/refine-nextjs-router": minor
"@pankod/refine-nhost": minor
"@pankod/refine-react-hook-form": minor
"@pankod/refine-react-location": minor
"@pankod/refine-react-router-v6": minor
"@pankod/refine-react-table": minor
"@pankod/refine-remix-router": minor
"@pankod/refine-sdk": minor
"@pankod/refine-simple-rest": minor
"@pankod/refine-strapi": minor
"@pankod/refine-strapi-graphql": minor
"@pankod/refine-strapi-v4": minor
"@pankod/refine-supabase": minor
"@pankod/refine-ui-tests": minor
"@pankod/refine-ui-types": minor
---

Update type declaration generation with `tsc` instead of `tsup` for better navigation throughout projects source code.
5 changes: 5 additions & 0 deletions .changeset/light-pets-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pankod/refine-ui-types": patch
---

Update `TestWrapper` props with `children` prop type.
5 changes: 5 additions & 0 deletions .changeset/purple-garlics-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pankod/refine-antd": minor
---

Update type declaration generation with `tsc` instead of `tsup` for better navigation throughout projects source code.
5 changes: 5 additions & 0 deletions .changeset/silver-rice-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pankod/refine-core": patch
---

Fixed the issue with the TS compiler and `useResource` hooks return type.
5 changes: 5 additions & 0 deletions .changeset/sixty-otters-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pankod/refine-mui": patch
---

Update `ThemeProvider` export as value instead of type.
7 changes: 7 additions & 0 deletions packages/ably/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.DS_Store
./test
jest.config.js
tsup.config.js
tsconfig.test.json
tsconfig.declarations.json
4 changes: 2 additions & 2 deletions packages/ably/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"node": ">=10"
},
"scripts": {
"start": "tsup --watch --dts --format esm,cjs,iife --legacy-output",
"build": "tsup --dts --format esm,cjs,iife --minify --legacy-output",
"start": "tsup --watch --format esm,cjs,iife --legacy-output",
"build": "tsup --format esm,cjs,iife --minify --legacy-output",
"test": "jest --passWithNoTests --runInBand",
"prepare": "npm run build"
},
Expand Down
21 changes: 21 additions & 0 deletions packages/ably/tsconfig.declarations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"exclude": [
"node_modules",
"dist",
"test",
"../test/**/*",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx"
],
"compilerOptions": {
"outDir": "dist",
"declarationDir": "dist",
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"declarationMap": true
}
}
1 change: 1 addition & 0 deletions packages/ably/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export default defineConfig({
},
}),
],
onSuccess: "tsc --project tsconfig.declarations.json",
});
7 changes: 7 additions & 0 deletions packages/airtable/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.DS_Store
./test
jest.config.js
tsup.config.js
tsconfig.test.json
tsconfig.declarations.json
4 changes: 2 additions & 2 deletions packages/airtable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"node": ">=10"
},
"scripts": {
"start": "tsup --watch --dts --format esm,cjs,iife --legacy-output",
"build": "tsup --dts --format esm,cjs,iife --minify --legacy-output",
"start": "tsup --watch --format esm,cjs,iife --legacy-output",
"build": "tsup --format esm,cjs,iife --minify --legacy-output",
"test": "jest --passWithNoTests --runInBand",
"prepare": "npm run build"
},
Expand Down
21 changes: 21 additions & 0 deletions packages/airtable/tsconfig.declarations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"exclude": [
"node_modules",
"dist",
"test",
"../test/**/*",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx"
],
"compilerOptions": {
"outDir": "dist",
"declarationDir": "dist",
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"declarationMap": true
}
}
1 change: 1 addition & 0 deletions packages/airtable/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export default defineConfig({
},
}),
],
onSuccess: "tsc --project tsconfig.declarations.json",
});
7 changes: 7 additions & 0 deletions packages/altogic/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.DS_Store
./test
jest.config.js
tsup.config.js
tsconfig.test.json
tsconfig.declarations.json
4 changes: 2 additions & 2 deletions packages/altogic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"node": ">=10"
},
"scripts": {
"start": "tsup --watch --dts --format esm,cjs,iife --legacy-output",
"build": "tsup --dts --format esm,cjs,iife --minify --legacy-output",
"start": "tsup --watch --format esm,cjs,iife --legacy-output",
"build": "tsup --format esm,cjs,iife --minify --legacy-output",
"test": "jest --passWithNoTests --runInBand",
"prepare": "npm run build"
},
Expand Down
21 changes: 21 additions & 0 deletions packages/altogic/tsconfig.declarations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"exclude": [
"node_modules",
"dist",
"test",
"../test/**/*",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx"
],
"compilerOptions": {
"outDir": "dist",
"declarationDir": "dist",
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"declarationMap": true
}
}
1 change: 1 addition & 0 deletions packages/altogic/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export default defineConfig({
},
}),
],
onSuccess: "tsc --project tsconfig.declarations.json",
});
7 changes: 7 additions & 0 deletions packages/antd-audit-log/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.DS_Store
./test
jest.config.js
tsup.config.js
tsconfig.test.json
tsconfig.declarations.json
7 changes: 4 additions & 3 deletions packages/antd-audit-log/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"node": ">=10"
},
"scripts": {
"start": "tsup --watch --dts --format esm,cjs,iife --legacy-output",
"build": "tsup --dts --format esm,cjs,iife --minify --legacy-output",
"start": "tsup --watch --format esm,cjs,iife --legacy-output",
"build": "tsup --format esm,cjs,iife --minify --legacy-output",
"prepare": "npm run build"
},
"peerDependencies": {
Expand Down Expand Up @@ -55,6 +55,7 @@
"splitting": false,
"sourcemap": true,
"clean": false,
"platform": "browser"
"platform": "browser",
"onSuccess": "tsc --project tsconfig.declarations.json"
}
}
21 changes: 21 additions & 0 deletions packages/antd-audit-log/tsconfig.declarations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"exclude": [
"node_modules",
"dist",
"test",
"../test/**/*",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx"
],
"compilerOptions": {
"outDir": "dist",
"declarationDir": "dist",
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"declarationMap": true
}
}
7 changes: 7 additions & 0 deletions packages/antd/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.DS_Store
./test
jest.config.js
tsup.config.js
tsconfig.test.json
tsconfig.declarations.json
4 changes: 2 additions & 2 deletions packages/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"module": "dist/esm/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"start": "tsup --watch --dts --format esm,cjs,iife --legacy-output",
"build": "tsup --dts --format esm,cjs,iife --minify --legacy-output",
"start": "tsup --watch --format esm,cjs,iife --legacy-output",
"build": "tsup --format esm,cjs,iife --minify --legacy-output",
"test": "jest --passWithNoTests --runInBand",
"prepare": "npm run build",
"generate-theme": "npx @emeks/antd-custom-theme-generator -w --antd ../../node_modules/antd ./src/assets/styles/custom-theme.less ./src/assets/styles/styles.min.css"
Expand Down
37 changes: 37 additions & 0 deletions packages/antd/tsconfig.declarations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": "./tsconfig.json",
"exclude": [
"node_modules",
"dist",
"test",
"../test/**/*",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx"
],
"compilerOptions": {
"outDir": "dist",
"declarationDir": "dist",
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"declarationMap": true,
"paths": {
"@components/*": ["src/components/*"],
"@components": ["src/components"],
"@containers/*": ["src/containers/*"],
"@containers": ["src/containers"],
"@pages/*": ["src/pages/*"],
"@pages": ["src/pages"],
"@contexts/*": ["src/contexts/*"],
"@contexts": ["src/contexts"],
"@dataProviders/*": ["src/dataProviders/*"],
"@dataProviders": ["src/dataProviders"],
"@hooks/*": ["src/hooks/*"],
"@hooks": ["src/hooks"],
"@definitions/*": ["src/definitions/*"],
"@definitions": ["src/definitions"]
}
}
}
Loading

0 comments on commit 0150dcd

Please sign in to comment.