diff --git a/CHANGELOG.mdx b/CHANGELOG.mdx index 3f2a781..0d82fc2 100644 --- a/CHANGELOG.mdx +++ b/CHANGELOG.mdx @@ -2,6 +2,10 @@ This is the log of notable changes to the `tsdk` that are developer-facing. +### 0.1.15 2024/5/9 + +- Feat: support `scripts` config in `tsdk.config.ts` + ### 0.1.14 2024/5/8 - Feat: API support `FormData` diff --git a/packages/tsdk-server-adapters/package.json b/packages/tsdk-server-adapters/package.json index 481aa0e..7bf7eb6 100644 --- a/packages/tsdk-server-adapters/package.json +++ b/packages/tsdk-server-adapters/package.json @@ -1,6 +1,6 @@ { "name": "tsdk-server-adapters", - "version": "0.1.14", + "version": "0.1.15", "main": "lib/index.js", "repository": "tsdk-monorepo/tsdk", "bugs": "https://github.com/tsdk-monorepo/tsdk/issues", diff --git a/packages/tsdk/package.json b/packages/tsdk/package.json index 44b6c82..595baed 100644 --- a/packages/tsdk/package.json +++ b/packages/tsdk/package.json @@ -1,6 +1,6 @@ { "name": "tsdk", - "version": "0.1.14", + "version": "0.1.15", "description": "Type-safe API development and code share tool for TypeScript projects.", "repository": "tsdk-monorepo/tsdk", "bugs": "https://github.com/tsdk-monorepo/tsdk/issues", diff --git a/packages/tsdk/src/config.ts b/packages/tsdk/src/config.ts index e2fa17b..0b9d1e0 100644 --- a/packages/tsdk/src/config.ts +++ b/packages/tsdk/src/config.ts @@ -17,9 +17,11 @@ export interface TSDKConfig { /** default: axios */ httpLib?: 'xior' | 'axios'; dataHookLib?: 'SWR' | 'ReactQuery'; - /** custom dependencies */ + /** custom dependencies or override */ dependencies?: { [key: string]: string }; devDependencies?: { [key: string]: string }; + /** custom scripts or override */ + scripts?: { [key: string]: string }; /** * remove unnecessary filelds in *.apiconf.js after build * @default diff --git a/packages/tsdk/src/sync-files.ts b/packages/tsdk/src/sync-files.ts index 09337f7..35252c4 100644 --- a/packages/tsdk/src/sync-files.ts +++ b/packages/tsdk/src/sync-files.ts @@ -119,6 +119,12 @@ async function reconfigPkg() { ...config.devDependencies, }; } + if (config.scripts) { + pkgContent.scripts = { + ...pkgContent.scripts, + ...config.scripts, + }; + } await Promise.all([fsExtra.writeFile(pkgPath, JSON.stringify(pkgContent, null, 2))]);