Skip to content

Commit

Permalink
Feat: support scripts config in tsdk.config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
suhaotian committed May 9, 2024
1 parent 938ee94 commit 538ecb4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion packages/tsdk-server-adapters/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/tsdk/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 3 additions & 1 deletion packages/tsdk/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions packages/tsdk/src/sync-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))]);

Expand Down

0 comments on commit 538ecb4

Please sign in to comment.