Skip to content

Commit

Permalink
Merge pull request #1075 from hey-api/fix/types-openapi-ts
Browse files Browse the repository at this point in the history
fix: properly handle dual publishing and type generation
  • Loading branch information
mrlubos authored Sep 22, 2024
2 parents 769a9f1 + 11a276a commit e8a6bd1
Show file tree
Hide file tree
Showing 157 changed files with 4,026 additions and 922 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-plums-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hey-api/openapi-ts': patch
---

fix: properly handle dual publishing and type generation
6 changes: 6 additions & 0 deletions .changeset/giant-buckets-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hey-api/client-axios': patch
'@hey-api/client-fetch': patch
---

fix: properly handle dual publishing and type generation
11 changes: 6 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.hbs]
indent_style = tab
indent_size = 2
indent_style = space
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ export default tseslint.config(
configPrettier,
{
ignores: [
'**/.tsup/',
'**/dist/',
'**/node_modules/',
'temp/',
'packages/openapi-ts/src/legacy/handlebars/compiled/**/*.js',
'packages/openapi-ts/src/legacy/handlebars/templates/**/*.hbs',
'**/test/e2e/generated/',
'**/test/generated/',
'**/.svelte-kit/',
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@
"node": "^18.0.0 || >=20.0.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.16.4",
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.7",
"@rollup/plugin-commonjs": "26.0.1",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "11.1.6",
"@types/node": "20.14.10",
"@typescript-eslint/eslint-plugin": "7.15.0",
"@vitest/coverage-v8": "1.6.0",
Expand All @@ -52,9 +50,7 @@
"husky": "9.0.11",
"lint-staged": "15.2.7",
"prettier": "3.3.2",
"rimraf": "5.0.8",
"rollup": "4.18.0",
"rollup-plugin-dts": "6.1.1",
"tsup": "8.3.0",
"typescript": "5.5.3",
"typescript-eslint": "7.15.0",
"vitest": "1.6.0"
Expand Down
27 changes: 11 additions & 16 deletions packages/client-axios/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@hey-api/client-axios",
"version": "0.2.4",
"type": "module",
"description": "Type-safe Axios client for your @hey-api/openapi-ts types",
"homepage": "https://heyapi.vercel.app/",
"repository": {
Expand All @@ -25,18 +24,19 @@
"typescript",
"vue"
],
"types": "dist/node/index.d.ts",
"main": "dist/node/index.cjs",
"module": "dist/node/index.mjs",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/node/index.d.ts",
"default": "./dist/node/index.mjs"
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/node/index.d.ts",
"default": "./dist/node/index.cjs"
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
Expand All @@ -48,14 +48,9 @@
"src"
],
"scripts": {
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
"build-types-check": "tsc --project tsconfig.check.json",
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp",
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
"build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check",
"build": "pnpm clean && pnpm build-bundle && pnpm build-types",
"clean": "rimraf dist coverage node_modules/.cache",
"dev": "rimraf dist && pnpm build-bundle --watch",
"build": "tsup && pnpm check-exports",
"check-exports": "attw --pack .",
"dev": "tsup --watch",
"prepublishOnly": "pnpm build",
"test:coverage": "vitest run --coverage",
"test:update": "vitest watch --update",
Expand Down
67 changes: 0 additions & 67 deletions packages/client-axios/rollup.config.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/client-axios/rollup.dts.config.ts

This file was deleted.

8 changes: 8 additions & 0 deletions packages/client-axios/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,11 @@ export const createClient = (config: Config): Client => {
setConfig,
} as Client;
};

export type { Config, Options } from './types';
export {
createConfig,
formDataBodySerializer,
jsonBodySerializer,
urlSearchParamsBodySerializer,
} from './utils';
15 changes: 0 additions & 15 deletions packages/client-axios/src/node/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions packages/client-axios/src/node/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/client-axios/tsconfig.check.json

This file was deleted.

4 changes: 1 addition & 3 deletions packages/client-axios/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
"compilerOptions": {
"declaration": false,
"esModuleInterop": true
},
"exclude": ["node_modules", "**/__mocks__"],
"include": ["./src/**/*.ts", "rollup.config.ts", "rollup.dts.config.ts"]
}
}
12 changes: 12 additions & 0 deletions packages/client-axios/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsup';

export default defineConfig((options) => ({
clean: true,
dts: true,
entry: ['src/index.ts'],
format: ['cjs', 'esm'],
minify: !options.watch,
shims: false,
sourcemap: true,
treeshake: true,
}));
8 changes: 0 additions & 8 deletions packages/client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@
"types": "./dist/node/index.d.ts"
},
"scripts": {
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
"build-types-check": "tsc --project tsconfig.check.json",
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp",
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
"build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check",
"build": "pnpm clean && pnpm build-bundle && pnpm build-types",
"clean": "rimraf dist coverage node_modules/.cache",
"dev": "rimraf dist && pnpm build-bundle --watch",
"prepublishOnly": "pnpm build",
"test:coverage": "vitest run --coverage",
"test:update": "vitest watch --update",
Expand Down
67 changes: 0 additions & 67 deletions packages/client-core/rollup.config.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/client-core/rollup.dts.config.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/client-core/tsconfig.check.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/client-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"esModuleInterop": true
},
"exclude": ["node_modules", "**/__mocks__"],
"include": ["./src/**/*.ts", "rollup.config.ts", "rollup.dts.config.ts"]
"include": ["./src/**/*.ts"]
}
Loading

0 comments on commit e8a6bd1

Please sign in to comment.