From 23b8137bd69cbc896046a497dc4cbf7bf23d70ec Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Tue, 12 Nov 2024 20:57:20 +0100 Subject: [PATCH] chore: examples for @kubb/react (#1388) --- .changeset/shiny-rules-invent.md | 5 + .codesandbox/ci.json | 1 + docs/.vitepress/config.ts | 4 + docs/changelog.md | 3 + docs/examples/react.md | 18 + docs/helpers/react/hooks/index.md | 16 + docs/package.json | 2 +- e2e/package.json | 2 +- examples/advanced/package.json | 2 +- examples/msw/package.json | 2 +- examples/react/.codesandbox/Dockerfile | 2 + examples/react/.codesandbox/build.js | 20 ++ examples/react/.codesandbox/tasks.json | 33 ++ examples/react/example1/index.tsx | 43 +++ examples/react/example2/index.tsx | 28 ++ examples/react/example2/result.ts | 1 + examples/react/example3/index.tsx | 42 +++ examples/react/example3/name.ts | 1 + examples/react/example3/result.ts | 3 + examples/react/example4/index.tsx | 67 ++++ examples/react/example4/result.ts | 12 + examples/react/example5/App.tsx | 3 + examples/react/example5/index.tsx | 34 ++ examples/react/package.json | 41 +++ examples/react/tsconfig.json | 25 ++ examples/vue-query/package.json | 2 +- packages/core/src/FileManager.ts | 19 +- packages/core/src/build.ts | 3 +- packages/core/src/index.ts | 2 +- packages/core/src/utils/parser.ts | 15 +- packages/fs/src/write.ts | 2 - packages/parser-ts/src/format.ts | 6 +- packages/parser-ts/src/print.ts | 9 +- packages/plugin-client/package.json | 2 +- packages/plugin-faker/package.json | 2 +- packages/plugin-msw/package.json | 2 +- packages/plugin-oas/package.json | 2 +- packages/plugin-react-query/package.json | 2 +- packages/plugin-redoc/package.json | 2 +- packages/plugin-solid-query/package.json | 2 +- packages/plugin-svelte-query/package.json | 2 +- packages/plugin-swr/package.json | 2 +- packages/plugin-ts/package.json | 2 +- packages/plugin-vue-query/package.json | 2 +- packages/plugin-zod/package.json | 2 +- packages/react/package.json | 1 - packages/react/src/ReactTemplate.tsx | 72 +++- packages/react/src/components/Const.tsx | 1 - packages/react/src/components/Function.tsx | 1 - packages/react/src/components/Root.tsx | 24 +- packages/react/src/components/Type.tsx | 1 - .../__snapshots__/Const.test.tsx.snap | 10 +- .../__snapshots__/Function.test.tsx.snap | 15 +- .../__snapshots__/Type.test.tsx.snap | 8 +- packages/react/src/hooks/useApp.ts | 2 +- packages/react/src/hooks/useLifecycle.tsx | 14 + packages/react/src/index.ts | 1 + packages/react/src/runner.tsx | 37 -- packages/unplugin-kubb/package.json | 4 +- pnpm-lock.yaml | 335 +++++++----------- 60 files changed, 681 insertions(+), 337 deletions(-) create mode 100644 .changeset/shiny-rules-invent.md create mode 100644 docs/examples/react.md create mode 100644 examples/react/.codesandbox/Dockerfile create mode 100644 examples/react/.codesandbox/build.js create mode 100644 examples/react/.codesandbox/tasks.json create mode 100644 examples/react/example1/index.tsx create mode 100644 examples/react/example2/index.tsx create mode 100644 examples/react/example2/result.ts create mode 100644 examples/react/example3/index.tsx create mode 100644 examples/react/example3/name.ts create mode 100644 examples/react/example3/result.ts create mode 100644 examples/react/example4/index.tsx create mode 100644 examples/react/example4/result.ts create mode 100644 examples/react/example5/App.tsx create mode 100644 examples/react/example5/index.tsx create mode 100644 examples/react/package.json create mode 100644 examples/react/tsconfig.json create mode 100644 packages/react/src/hooks/useLifecycle.tsx delete mode 100644 packages/react/src/runner.tsx diff --git a/.changeset/shiny-rules-invent.md b/.changeset/shiny-rules-invent.md new file mode 100644 index 000000000..cd8fa5a0b --- /dev/null +++ b/.changeset/shiny-rules-invent.md @@ -0,0 +1,5 @@ +--- +"@kubb/react": patch +--- + +Better error logging + wider range for `@kubb/react` peerDependency diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index 5760ff61c..baa2eeb14 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -26,6 +26,7 @@ "/examples/react-query", "/examples/typescript", "/examples/simple-single", + "/examples/react", "/examples/solid-query", "/examples/svelte-query", "/examples/swr", diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index addf10397..828924327 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -309,6 +309,10 @@ const examplesSidebar = [ text: 'Generators new', link: '/examples/generators', }, + { + text: 'React new', + link: '/examples/react', + }, ] const blogSidebar = [ diff --git a/docs/changelog.md b/docs/changelog.md index a70568be4..caa499b95 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,9 @@ title: Changelog # Changelog +## 3.0.4 +- [`react`](/helpers/react//): Better error logging + wider range for `@kubb/react` peerDependency + ## 3.0.3 - [`plugin-ts`](/plugins/plugin-ts/): `@deprecated` jsdoc tag for schemas diff --git a/docs/examples/react.md b/docs/examples/react.md new file mode 100644 index 000000000..d62727a2a --- /dev/null +++ b/docs/examples/react.md @@ -0,0 +1,18 @@ +--- +title: React +aside: false +--- + +