From 680882fbfd7f5b5fc85ffd9a666ee5c78e30a9a8 Mon Sep 17 00:00:00 2001 From: trydofor Date: Thu, 17 Oct 2024 15:43:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20global=20index.d.ts=20t?= =?UTF-8?q?ypes=20#56?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layers/common/CHANGELOG.md | 6 ++++++ layers/common/index.d.ts | 3 +++ layers/common/nuxt.config.ts | 3 --- layers/common/package.json | 5 +++-- layers/common/test/typed-fetching.test.ts | 1 - layers/common/types/common.d.ts | 6 ------ layers/common/types/common.global.d.ts | 11 +++++++++++ layers/common/utils/typed-fetching.ts | 4 +--- layers/mobile/CHANGELOG.md | 6 ++++++ layers/mobile/package.json | 2 +- layers/mobile/test/ionic-fetching.test.ts | 1 - layers/mobile/utils/ionic-fetching.ts | 1 - package.json | 2 +- 13 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 layers/common/index.d.ts delete mode 100644 layers/common/types/common.d.ts create mode 100644 layers/common/types/common.global.d.ts diff --git a/layers/common/CHANGELOG.md b/layers/common/CHANGELOG.md index aff78c0..f19486d 100644 --- a/layers/common/CHANGELOG.md +++ b/layers/common/CHANGELOG.md @@ -1,5 +1,11 @@ # @fessional/razor-common +## 0.1.22 + +### Patch Changes + +- f863d36: 🏷️ global index.d.ts types #56 + ## 0.1.19 ### Patch Changes diff --git a/layers/common/index.d.ts b/layers/common/index.d.ts new file mode 100644 index 0000000..fabad53 --- /dev/null +++ b/layers/common/index.d.ts @@ -0,0 +1,3 @@ +export * from './types/common.global'; + +export {}; diff --git a/layers/common/nuxt.config.ts b/layers/common/nuxt.config.ts index 1874624..d19d3e9 100644 --- a/layers/common/nuxt.config.ts +++ b/layers/common/nuxt.config.ts @@ -22,8 +22,5 @@ export default defineNuxtConfig({ }, typescript: { typeCheck: true, - tsConfig: { - include: ['./types/*'], - }, }, }); diff --git a/layers/common/package.json b/layers/common/package.json index e48415e..f1cd609 100644 --- a/layers/common/package.json +++ b/layers/common/package.json @@ -1,9 +1,10 @@ { "name": "@fessional/razor-common", "type": "module", - "version": "0.1.19", + "version": "0.1.22", "description": "common layer for mobile and desktop", "main": "./nuxt.config.ts", + "types": "./index.d.ts", "scripts": { "build": "nuxi build", "dev": "nuxi dev", @@ -36,4 +37,4 @@ "@vueuse/nuxt": "catalog:common", "vue": "catalog:common" } -} +} \ No newline at end of file diff --git a/layers/common/test/typed-fetching.test.ts b/layers/common/test/typed-fetching.test.ts index bd72d00..d306d9c 100644 --- a/layers/common/test/typed-fetching.test.ts +++ b/layers/common/test/typed-fetching.test.ts @@ -1,6 +1,5 @@ import { describe, it, expect, vi } from 'vitest'; import { fetchingData, fetchingDataAsync } from '../utils/typed-fetching'; -import type { DataResult } from '../types/common'; describe('fetchingData', () => { it('should call loading with true and false', () => { diff --git a/layers/common/types/common.d.ts b/layers/common/types/common.d.ts deleted file mode 100644 index 97c2d69..0000000 --- a/layers/common/types/common.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface DataResult { - success: boolean; - data?: T; - message?: string; - code?: string; -} diff --git a/layers/common/types/common.global.d.ts b/layers/common/types/common.global.d.ts new file mode 100644 index 0000000..57f28fc --- /dev/null +++ b/layers/common/types/common.global.d.ts @@ -0,0 +1,11 @@ +declare global { + interface DataResult { + success: boolean; + data?: T; + message?: string; + code?: string; + } +} + +// +export {}; diff --git a/layers/common/utils/typed-fetching.ts b/layers/common/utils/typed-fetching.ts index d09d3ae..f8a6122 100644 --- a/layers/common/utils/typed-fetching.ts +++ b/layers/common/utils/typed-fetching.ts @@ -1,6 +1,4 @@ -import type { DataResult } from '../types/common'; - -export type TypedFetchingOptions = { +export type TypedFetchingOptions = { /** * @param status - true if loading, false if done */ diff --git a/layers/mobile/CHANGELOG.md b/layers/mobile/CHANGELOG.md index 25e43be..cb478fb 100644 --- a/layers/mobile/CHANGELOG.md +++ b/layers/mobile/CHANGELOG.md @@ -1,5 +1,11 @@ # @fessional/razor-mobile +## 0.1.22 + +### Patch Changes + +- f863d36: 🏷️ global index.d.ts types #56 + ## 0.1.19 ### Patch Changes diff --git a/layers/mobile/package.json b/layers/mobile/package.json index 05f1b20..3be19c0 100644 --- a/layers/mobile/package.json +++ b/layers/mobile/package.json @@ -1,7 +1,7 @@ { "name": "@fessional/razor-mobile", "type": "module", - "version": "0.1.19", + "version": "0.1.22", "description": "mobile layer with ionic and capacitor", "main": "./nuxt.config.ts", "scripts": { diff --git a/layers/mobile/test/ionic-fetching.test.ts b/layers/mobile/test/ionic-fetching.test.ts index d3e5309..f57ecc2 100644 --- a/layers/mobile/test/ionic-fetching.test.ts +++ b/layers/mobile/test/ionic-fetching.test.ts @@ -1,7 +1,6 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'; import { loadingController, alertController } from '@ionic/vue'; import { ionicFetchingDataAsync } from '../utils/ionic-fetching'; -import type { DataResult } from '~razor-common/types/common'; // Mocking Ionic controllers vi.mock('@ionic/vue', () => ({ diff --git a/layers/mobile/utils/ionic-fetching.ts b/layers/mobile/utils/ionic-fetching.ts index 8ed53cd..e046176 100644 --- a/layers/mobile/utils/ionic-fetching.ts +++ b/layers/mobile/utils/ionic-fetching.ts @@ -1,5 +1,4 @@ import { loadingController, alertController } from '@ionic/vue'; -import type { DataResult } from '~razor-common/types/common'; import { fetchingResultAsync } from '~razor-common/utils/typed-fetching'; function _failure(message?: string, code?: string) { diff --git a/package.json b/package.json index 67cc298..0305e8f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@fessional/razor", "type": "module", - "version": "0.1.19", + "version": "0.1.22", "description": "Use front-end tech (Nuxt/Ts) to build multi-platform from one codebase, suitable for small team and app to write app once, apply almost anywhere.", "packageManager": "pnpm@9.9.0", "engines": {