@toktokhan-dev/cli-plugin-gen-api-react-query 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +37 -0
- package/package.json +1 -1
- package/templates/my/react-query-type.eta +2 -2
package/dist/index.js
CHANGED
|
@@ -199,6 +199,9 @@ const genApi = defineCommand({
|
|
|
199
199
|
],
|
|
200
200
|
},
|
|
201
201
|
run: async (config) => {
|
|
202
|
+
if (config.swaggerSchemaUrls && config.swaggerSchemaUrls.length === 0) {
|
|
203
|
+
throw new Error('No URLs provided');
|
|
204
|
+
}
|
|
202
205
|
const isWebUrl = (string) => string.startsWith('http://') || string.startsWith('https://');
|
|
203
206
|
// 다중 URL 처리 로직 추가
|
|
204
207
|
const urls = (() => {
|
|
@@ -246,6 +249,40 @@ const genApi = defineCommand({
|
|
|
246
249
|
config,
|
|
247
250
|
});
|
|
248
251
|
});
|
|
252
|
+
// 최종 단계 포매팅: 디렉터리 전체를 한 번에 포맷
|
|
253
|
+
await withLoading('Prettier format', covered.output, async () => {
|
|
254
|
+
const fs = await import('fs');
|
|
255
|
+
const pathMod = await import('path');
|
|
256
|
+
const { prettierString } = await import('@toktokhan-dev/node');
|
|
257
|
+
const listTsFiles = (dir) => {
|
|
258
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
259
|
+
const files = [];
|
|
260
|
+
for (const entry of entries) {
|
|
261
|
+
const full = pathMod.resolve(dir, entry.name);
|
|
262
|
+
if (entry.isDirectory()) {
|
|
263
|
+
files.push(...listTsFiles(full));
|
|
264
|
+
}
|
|
265
|
+
else if (entry.isFile() && full.endsWith('.ts')) {
|
|
266
|
+
files.push(full);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return files;
|
|
270
|
+
};
|
|
271
|
+
const files = listTsFiles(covered.output);
|
|
272
|
+
for (const file of files) {
|
|
273
|
+
try {
|
|
274
|
+
const raw = fs.readFileSync(file, 'utf8');
|
|
275
|
+
const formatted = await prettierString(raw, {
|
|
276
|
+
parser: 'typescript',
|
|
277
|
+
configPath: 'auto',
|
|
278
|
+
});
|
|
279
|
+
fs.writeFileSync(file, formatted);
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
console.warn('Prettier final pass failed for', file);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
});
|
|
249
286
|
}
|
|
250
287
|
},
|
|
251
288
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toktokhan-dev/cli-plugin-gen-api-react-query",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "A CLI plugin for generating API hooks with React Query built by TOKTOKHAN.DEV",
|
|
5
5
|
"author": "TOKTOKHAN.DEV <fe-system@toktokhan.dev>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -43,7 +43,7 @@ export type InfiniteQueryHookParams<
|
|
|
43
43
|
> = {
|
|
44
44
|
options?: Partial<
|
|
45
45
|
Omit<
|
|
46
|
-
UseInfiniteQueryOptions<OriginData, Error, TData,
|
|
46
|
+
UseInfiniteQueryOptions<OriginData, Error, TData, any, any>,
|
|
47
47
|
'queryKey' | 'queryFn'
|
|
48
48
|
>
|
|
49
49
|
>;
|
|
@@ -83,7 +83,7 @@ export type SuspenseInfiniteQueryHookParams<
|
|
|
83
83
|
> = {
|
|
84
84
|
options?: Partial<
|
|
85
85
|
Omit<
|
|
86
|
-
UseSuspenseInfiniteQueryOptions<OriginData, Error, TData,
|
|
86
|
+
UseSuspenseInfiniteQueryOptions<OriginData, Error, TData, any, any>,
|
|
87
87
|
'queryKey' | 'queryFn'
|
|
88
88
|
>
|
|
89
89
|
>;
|