From edc1bd677b1a9fe79d889ac9ba2f8295aa5a2aca Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 23 Nov 2022 18:30:18 +0800 Subject: [PATCH] chore: improve types (#115) * wip: improve types * feat: improve types * Apply suggestions from code review Co-authored-by: Sylvain Marroufin * chore: update * chore: enable ci typecheck * chore: fix Co-authored-by: Sylvain Marroufin --- .github/workflows/ci-dev.yml | 3 +++ .github/workflows/ci.yml | 3 +++ build.config.ts | 12 +++++++++++ docs/app.vue | 7 +++++++ docs/nuxt.config.ts | 9 --------- package.json | 2 ++ src/env.d.ts | 6 ++++++ src/runtime/components/elements/Button.vue | 4 ++-- src/runtime/components/elements/Dropdown.vue | 5 +++-- src/runtime/components/elements/Icon.vue | 12 +++++++---- src/runtime/components/elements/Link.vue | 5 +++-- src/runtime/components/feedback/Alert.vue | 2 +- src/runtime/components/forms/Checkbox.vue | 2 +- src/runtime/components/forms/Input.vue | 11 +++++----- src/runtime/components/forms/Select.vue | 2 +- src/runtime/components/forms/SelectCustom.vue | 8 ++++---- src/runtime/components/forms/Textarea.vue | 7 +++---- .../components/navigation/CommandPalette.vue | 3 ++- .../navigation/CommandPaletteGroup.vue | 2 +- .../navigation/VerticalNavigation.vue | 2 +- .../components/overlays/ContextMenu.vue | 3 ++- .../components/overlays/Notification.vue | 3 ++- .../components/overlays/Notifications.vue | 3 ++- src/runtime/components/overlays/Popover.vue | 5 +++-- src/runtime/composables/usePopper.ts | 20 ++++++++++--------- src/runtime/composables/useTimer.ts | 6 +++--- src/runtime/plugins/toast.client.ts | 3 +-- src/runtime/presets/default.ts | 4 +++- src/runtime/types/toast.d.ts | 11 ++++++---- tsconfig.json | 13 +++++++++++- 30 files changed, 114 insertions(+), 64 deletions(-) create mode 100644 build.config.ts create mode 100644 src/env.d.ts diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml index 149cc312..416392a0 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/ci-dev.yml @@ -41,6 +41,9 @@ jobs: - name: Lint run: yarn lint + - name: Typecheck + run: yarn typecheck + - name: Build run: yarn build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb3e0e54..60c29081 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,9 @@ jobs: - name: Lint run: yarn lint + - name: Typecheck + run: yarn typecheck + - name: Build run: yarn build diff --git a/build.config.ts b/build.config.ts new file mode 100644 index 00000000..f00cb933 --- /dev/null +++ b/build.config.ts @@ -0,0 +1,12 @@ +import fs from 'node:fs/promises' +import { join, resolve } from 'node:path' +import { defineBuildConfig } from 'unbuild' + +export default defineBuildConfig({ + hooks: { + 'rollup:done': async (ctx) => { + // copy env.d.ts to dist + await fs.copyFile(resolve('src/env.d.ts'), join(ctx.options.outDir, 'env.d.ts')) + } + } +}) diff --git a/docs/app.vue b/docs/app.vue index 9016361e..2f3615c8 100644 --- a/docs/app.vue +++ b/docs/app.vue @@ -60,6 +60,13 @@