@geekmidas/cli 1.2.1 → 1.2.3
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +110 -182
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +111 -183
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-DrbBWq0s.mjs → openapi-NthphEWK.mjs} +3 -4
- package/dist/{openapi-DrbBWq0s.mjs.map → openapi-NthphEWK.mjs.map} +1 -1
- package/dist/{openapi-BZP8jkI4.cjs → openapi-ZhO7wwya.cjs} +2 -9
- package/dist/{openapi-BZP8jkI4.cjs.map → openapi-ZhO7wwya.cjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +1 -1
- package/package.json +4 -4
- package/src/__tests__/openapi.spec.ts +385 -5
- package/src/dev/index.ts +71 -107
- package/src/generators/OpenApiTsGenerator.ts +0 -1
- package/src/init/generators/ui.ts +20 -20
- package/src/openapi.ts +2 -1
- package/src/workspace/__tests__/client-generator.spec.ts +472 -19
- package/src/workspace/client-generator.ts +139 -199
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @geekmidas/cli
|
|
2
2
|
|
|
3
|
+
## 1.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 🐛 [`11c96af`](https://github.com/geekmidas/toolbox/commit/11c96af896fa5355f37edd276fc96010cd177ccc) Thanks [@geekmidas](https://github.com/geekmidas)! - Fix cli client generation for monorepos
|
|
8
|
+
|
|
9
|
+
## 1.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 🐛 [`ab91786`](https://github.com/geekmidas/toolbox/commit/ab917864eaf64793e5bc93818a98caeb5b766324) Thanks [@geekmidas](https://github.com/geekmidas)! - Fix env var injection for dev, and make sure openapi generation for client apps
|
|
14
|
+
|
|
3
15
|
## 1.2.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
|
3
3
|
const require_workspace = require('./workspace-BMJE18LV.cjs');
|
|
4
4
|
const require_config = require('./config-Bayob8pB.cjs');
|
|
5
5
|
const require_credentials = require('./credentials-C8DWtnMY.cjs');
|
|
6
|
-
const require_openapi = require('./openapi-
|
|
6
|
+
const require_openapi = require('./openapi-ZhO7wwya.cjs');
|
|
7
7
|
const require_storage = require('./storage-CoCNe0Pt.cjs');
|
|
8
8
|
const require_dokploy_api = require('./dokploy-api-CQvhV6Hd.cjs');
|
|
9
9
|
const require_encryption = require('./encryption-BE0UOb8j.cjs');
|
|
@@ -32,7 +32,7 @@ const prompts = require_chunk.__toESM(require("prompts"));
|
|
|
32
32
|
|
|
33
33
|
//#region package.json
|
|
34
34
|
var name = "@geekmidas/cli";
|
|
35
|
-
var version = "1.2.
|
|
35
|
+
var version = "1.2.2";
|
|
36
36
|
var description = "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs";
|
|
37
37
|
var private$1 = false;
|
|
38
38
|
var type = "module";
|
|
@@ -628,99 +628,61 @@ export async function setupSubscribers(
|
|
|
628
628
|
//#region src/workspace/client-generator.ts
|
|
629
629
|
const logger$10 = console;
|
|
630
630
|
/**
|
|
631
|
-
*
|
|
632
|
-
*/
|
|
633
|
-
const specHashCache = /* @__PURE__ */ new Map();
|
|
634
|
-
/**
|
|
635
|
-
* Calculate hash of content for change detection.
|
|
631
|
+
* Get frontend apps that depend on a backend app.
|
|
636
632
|
*/
|
|
637
|
-
function
|
|
638
|
-
|
|
633
|
+
function getDependentFrontends(workspace, backendAppName) {
|
|
634
|
+
const dependentApps = [];
|
|
635
|
+
for (const [appName, app] of Object.entries(workspace.apps)) if (app.type === "frontend" && app.dependencies.includes(backendAppName)) dependentApps.push(appName);
|
|
636
|
+
return dependentApps;
|
|
639
637
|
}
|
|
640
638
|
/**
|
|
641
|
-
*
|
|
642
|
-
* @internal Exported for use in dev command
|
|
639
|
+
* Get the path to a backend's OpenAPI spec file.
|
|
643
640
|
*/
|
|
644
|
-
function
|
|
645
|
-
|
|
646
|
-
|
|
641
|
+
function getBackendOpenApiPath(workspace, backendAppName) {
|
|
642
|
+
const app = workspace.apps[backendAppName];
|
|
643
|
+
if (!app || app.type !== "backend") return null;
|
|
644
|
+
return (0, node_path.join)(workspace.root, app.path, ".gkm", "openapi.ts");
|
|
647
645
|
}
|
|
648
646
|
/**
|
|
649
|
-
*
|
|
650
|
-
* Returns the spec content and endpoint count.
|
|
647
|
+
* Count endpoints in an OpenAPI spec content.
|
|
651
648
|
*/
|
|
652
|
-
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
const appPath = (0, node_path.join)(workspace.root, app.path);
|
|
656
|
-
const routesPatterns = normalizeRoutes(app.routes);
|
|
657
|
-
if (routesPatterns.length === 0) return null;
|
|
658
|
-
const endpointGenerator = new require_openapi.EndpointGenerator();
|
|
659
|
-
const allLoadedEndpoints = [];
|
|
660
|
-
for (const pattern of routesPatterns) {
|
|
661
|
-
const fullPattern = (0, node_path.join)(appPath, pattern);
|
|
662
|
-
const loaded = await endpointGenerator.load(fullPattern);
|
|
663
|
-
allLoadedEndpoints.push(...loaded);
|
|
664
|
-
}
|
|
665
|
-
const loadedEndpoints = allLoadedEndpoints;
|
|
666
|
-
if (loadedEndpoints.length === 0) return null;
|
|
667
|
-
const endpoints = loadedEndpoints.map(({ construct }) => construct);
|
|
668
|
-
const tsGenerator = new require_openapi.OpenApiTsGenerator();
|
|
669
|
-
const content = await tsGenerator.generate(endpoints, {
|
|
670
|
-
title: `${appName} API`,
|
|
671
|
-
version: "1.0.0",
|
|
672
|
-
description: `Auto-generated API client for ${appName}`
|
|
673
|
-
});
|
|
674
|
-
return {
|
|
675
|
-
content,
|
|
676
|
-
endpointCount: loadedEndpoints.length
|
|
677
|
-
};
|
|
649
|
+
function countEndpoints(content) {
|
|
650
|
+
const endpointMatches = content.match(/'(GET|POST|PUT|PATCH|DELETE)\s+\/[^']+'/g);
|
|
651
|
+
return endpointMatches?.length ?? 0;
|
|
678
652
|
}
|
|
679
653
|
/**
|
|
680
|
-
*
|
|
681
|
-
*
|
|
654
|
+
* Copy the OpenAPI client from a backend to all dependent frontend apps.
|
|
655
|
+
* Called when the backend's .gkm/openapi.ts file changes.
|
|
682
656
|
*/
|
|
683
|
-
async function
|
|
657
|
+
async function copyClientToFrontends(workspace, backendAppName, options = {}) {
|
|
658
|
+
const log = options.silent ? () => {} : logger$10.log.bind(logger$10);
|
|
684
659
|
const results = [];
|
|
685
|
-
const
|
|
686
|
-
if (!
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
660
|
+
const backendApp = workspace.apps[backendAppName];
|
|
661
|
+
if (!backendApp || backendApp.type !== "backend") return results;
|
|
662
|
+
const openApiPath = (0, node_path.join)(workspace.root, backendApp.path, ".gkm", "openapi.ts");
|
|
663
|
+
if (!(0, node_fs.existsSync)(openApiPath)) return results;
|
|
664
|
+
const content = await (0, node_fs_promises.readFile)(openApiPath, "utf-8");
|
|
665
|
+
const endpointCount = countEndpoints(content);
|
|
666
|
+
const dependentFrontends = getDependentFrontends(workspace, backendAppName);
|
|
667
|
+
for (const frontendAppName of dependentFrontends) {
|
|
668
|
+
const frontendApp = workspace.apps[frontendAppName];
|
|
669
|
+
if (!frontendApp || frontendApp.type !== "frontend") continue;
|
|
670
|
+
const clientOutput = frontendApp.client?.output;
|
|
671
|
+
if (!clientOutput) continue;
|
|
697
672
|
const result = {
|
|
698
673
|
frontendApp: frontendAppName,
|
|
699
674
|
backendApp: backendAppName,
|
|
700
675
|
outputPath: "",
|
|
701
|
-
endpointCount
|
|
702
|
-
|
|
676
|
+
endpointCount,
|
|
677
|
+
success: false
|
|
703
678
|
};
|
|
704
679
|
try {
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
result.reason = "No endpoints found in backend";
|
|
708
|
-
results.push(result);
|
|
709
|
-
continue;
|
|
710
|
-
}
|
|
711
|
-
result.endpointCount = spec.endpointCount;
|
|
712
|
-
const cacheKey = `${backendAppName}:${frontendAppName}`;
|
|
713
|
-
const newHash = hashContent(spec.content);
|
|
714
|
-
const oldHash = specHashCache.get(cacheKey);
|
|
715
|
-
if (!options.force && oldHash === newHash) {
|
|
716
|
-
result.reason = "No schema changes detected";
|
|
717
|
-
results.push(result);
|
|
718
|
-
continue;
|
|
719
|
-
}
|
|
680
|
+
const frontendPath = (0, node_path.join)(workspace.root, frontendApp.path);
|
|
681
|
+
const outputDir = (0, node_path.join)(frontendPath, clientOutput);
|
|
720
682
|
await (0, node_fs_promises.mkdir)(outputDir, { recursive: true });
|
|
721
|
-
const fileName =
|
|
683
|
+
const fileName = `${backendAppName}.ts`;
|
|
722
684
|
const outputPath = (0, node_path.join)(outputDir, fileName);
|
|
723
|
-
const backendRelPath = (0, node_path.relative)((0, node_path.dirname)(outputPath), (0, node_path.join)(workspace.root,
|
|
685
|
+
const backendRelPath = (0, node_path.relative)((0, node_path.dirname)(outputPath), (0, node_path.join)(workspace.root, backendApp.path));
|
|
724
686
|
const clientContent = `/**
|
|
725
687
|
* Auto-generated API client for ${backendAppName}
|
|
726
688
|
* Generated from: ${backendRelPath}
|
|
@@ -728,43 +690,31 @@ async function generateClientForFrontend(workspace, frontendAppName, options = {
|
|
|
728
690
|
* DO NOT EDIT - This file is automatically regenerated when backend schemas change.
|
|
729
691
|
*/
|
|
730
692
|
|
|
731
|
-
${
|
|
693
|
+
${content}
|
|
732
694
|
`;
|
|
733
695
|
await (0, node_fs_promises.writeFile)(outputPath, clientContent);
|
|
734
|
-
specHashCache.set(cacheKey, newHash);
|
|
735
696
|
result.outputPath = outputPath;
|
|
736
|
-
result.
|
|
737
|
-
|
|
697
|
+
result.success = true;
|
|
698
|
+
log(`📦 Copied client to ${frontendAppName} from ${backendAppName} (${endpointCount} endpoints)`);
|
|
738
699
|
} catch (error) {
|
|
739
|
-
result.
|
|
740
|
-
results.push(result);
|
|
700
|
+
result.error = error.message;
|
|
741
701
|
}
|
|
702
|
+
results.push(result);
|
|
742
703
|
}
|
|
743
704
|
return results;
|
|
744
705
|
}
|
|
745
706
|
/**
|
|
746
|
-
*
|
|
707
|
+
* Copy clients from all backends to their dependent frontends.
|
|
708
|
+
* Useful for initial setup or force refresh.
|
|
747
709
|
*/
|
|
748
|
-
async function
|
|
749
|
-
const log = options.silent ? () => {} : logger$10.log.bind(logger$10);
|
|
710
|
+
async function copyAllClients(workspace, options = {}) {
|
|
750
711
|
const allResults = [];
|
|
751
|
-
for (const [appName, app] of Object.entries(workspace.apps)) if (app.type === "
|
|
752
|
-
const results = await
|
|
753
|
-
|
|
754
|
-
if (result.generated) log(`📦 Generated client for ${result.frontendApp} from ${result.backendApp} (${result.endpointCount} endpoints)`);
|
|
755
|
-
allResults.push(result);
|
|
756
|
-
}
|
|
712
|
+
for (const [appName, app] of Object.entries(workspace.apps)) if (app.type === "backend" && app.routes) {
|
|
713
|
+
const results = await copyClientToFrontends(workspace, appName, options);
|
|
714
|
+
allResults.push(...results);
|
|
757
715
|
}
|
|
758
716
|
return allResults;
|
|
759
717
|
}
|
|
760
|
-
/**
|
|
761
|
-
* Get frontend apps that depend on a backend app.
|
|
762
|
-
*/
|
|
763
|
-
function getDependentFrontends(workspace, backendAppName) {
|
|
764
|
-
const dependentApps = [];
|
|
765
|
-
for (const [appName, app] of Object.entries(workspace.apps)) if (app.type === "frontend" && app.dependencies.includes(backendAppName)) dependentApps.push(appName);
|
|
766
|
-
return dependentApps;
|
|
767
|
-
}
|
|
768
718
|
|
|
769
719
|
//#endregion
|
|
770
720
|
//#region src/dev/index.ts
|
|
@@ -1264,10 +1214,10 @@ async function workspaceDevCommand(workspace, options) {
|
|
|
1264
1214
|
if (hasErrors) throw new Error("Frontend app validation failed. Fix the issues above and try again.");
|
|
1265
1215
|
logger$9.log("✅ Frontend apps validated");
|
|
1266
1216
|
}
|
|
1267
|
-
if (frontendApps.length > 0) {
|
|
1268
|
-
const clientResults = await
|
|
1269
|
-
const
|
|
1270
|
-
if (
|
|
1217
|
+
if (frontendApps.length > 0 && backendApps.length > 0) {
|
|
1218
|
+
const clientResults = await copyAllClients(workspace);
|
|
1219
|
+
const copiedCount = clientResults.filter((r) => r.success).length;
|
|
1220
|
+
if (copiedCount > 0) logger$9.log(`\n📦 Copied ${copiedCount} API client(s)`);
|
|
1271
1221
|
}
|
|
1272
1222
|
await startWorkspaceServices(workspace);
|
|
1273
1223
|
const secretsEnv = await loadDevSecrets(workspace);
|
|
@@ -1328,65 +1278,42 @@ async function workspaceDevCommand(workspace, options) {
|
|
|
1328
1278
|
stdio: "inherit",
|
|
1329
1279
|
env: turboEnv
|
|
1330
1280
|
});
|
|
1331
|
-
let
|
|
1281
|
+
let openApiWatcher = null;
|
|
1332
1282
|
if (frontendApps.length > 0 && backendApps.length > 0) {
|
|
1333
|
-
const
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
const patternKey = (0, node_path.join)(app.path, routePattern);
|
|
1341
|
-
const existing = backendRouteMap.get(patternKey) || [];
|
|
1342
|
-
backendRouteMap.set(patternKey, [...existing, appName]);
|
|
1343
|
-
}
|
|
1283
|
+
const openApiPaths = [];
|
|
1284
|
+
for (const [appName] of backendApps) {
|
|
1285
|
+
const openApiPath = getBackendOpenApiPath(workspace, appName);
|
|
1286
|
+
if (openApiPath) openApiPaths.push({
|
|
1287
|
+
path: openApiPath,
|
|
1288
|
+
appName
|
|
1289
|
+
});
|
|
1344
1290
|
}
|
|
1345
|
-
if (
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1291
|
+
if (openApiPaths.length > 0) {
|
|
1292
|
+
logger$9.log(`\n👀 Watching ${openApiPaths.length} backend OpenAPI spec(s) for changes`);
|
|
1293
|
+
const pathToApp = new Map(openApiPaths.map((p) => [p.path, p.appName]));
|
|
1294
|
+
openApiWatcher = chokidar.default.watch(openApiPaths.map((p) => p.path), {
|
|
1295
|
+
persistent: true,
|
|
1296
|
+
ignoreInitial: true,
|
|
1297
|
+
depth: 0
|
|
1350
1298
|
});
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
break;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
if (changedBackends.length === 0) return;
|
|
1374
|
-
const affectedFrontends = /* @__PURE__ */ new Set();
|
|
1375
|
-
for (const backend of changedBackends) {
|
|
1376
|
-
const dependents = getDependentFrontends(workspace, backend);
|
|
1377
|
-
for (const frontend of dependents) affectedFrontends.add(frontend);
|
|
1378
|
-
}
|
|
1379
|
-
if (affectedFrontends.size === 0) return;
|
|
1380
|
-
logger$9.log(`\n🔄 Detected schema change in ${changedBackends.join(", ")}`);
|
|
1381
|
-
for (const frontend of affectedFrontends) try {
|
|
1382
|
-
const results = await generateClientForFrontend(workspace, frontend);
|
|
1383
|
-
for (const result of results) if (result.generated) logger$9.log(` 📦 Regenerated client for ${result.frontendApp} (${result.endpointCount} endpoints)`);
|
|
1384
|
-
} catch (error) {
|
|
1385
|
-
logger$9.error(` ❌ Failed to regenerate client for ${frontend}: ${error.message}`);
|
|
1386
|
-
}
|
|
1387
|
-
}, 500);
|
|
1388
|
-
});
|
|
1389
|
-
}
|
|
1299
|
+
let copyTimeout = null;
|
|
1300
|
+
const handleChange = async (changedPath) => {
|
|
1301
|
+
if (copyTimeout) clearTimeout(copyTimeout);
|
|
1302
|
+
copyTimeout = setTimeout(async () => {
|
|
1303
|
+
const backendAppName = pathToApp.get(changedPath);
|
|
1304
|
+
if (!backendAppName) return;
|
|
1305
|
+
logger$9.log(`\n🔄 OpenAPI spec changed for ${backendAppName}`);
|
|
1306
|
+
try {
|
|
1307
|
+
const results = await copyClientToFrontends(workspace, backendAppName, { silent: true });
|
|
1308
|
+
for (const result of results) if (result.success) logger$9.log(` 📦 Copied client to ${result.frontendApp} (${result.endpointCount} endpoints)`);
|
|
1309
|
+
else if (result.error) logger$9.error(` ❌ Failed to copy client to ${result.frontendApp}: ${result.error}`);
|
|
1310
|
+
} catch (error) {
|
|
1311
|
+
logger$9.error(` ❌ Failed to copy clients: ${error.message}`);
|
|
1312
|
+
}
|
|
1313
|
+
}, 200);
|
|
1314
|
+
};
|
|
1315
|
+
openApiWatcher.on("change", handleChange);
|
|
1316
|
+
openApiWatcher.on("add", handleChange);
|
|
1390
1317
|
}
|
|
1391
1318
|
}
|
|
1392
1319
|
let isShuttingDown = false;
|
|
@@ -1394,7 +1321,7 @@ async function workspaceDevCommand(workspace, options) {
|
|
|
1394
1321
|
if (isShuttingDown) return;
|
|
1395
1322
|
isShuttingDown = true;
|
|
1396
1323
|
logger$9.log("\n🛑 Shutting down workspace...");
|
|
1397
|
-
if (
|
|
1324
|
+
if (openApiWatcher) openApiWatcher.close().catch(() => {});
|
|
1398
1325
|
if (turboProcess.pid) try {
|
|
1399
1326
|
process.kill(-turboProcess.pid, "SIGTERM");
|
|
1400
1327
|
} catch {
|
|
@@ -1412,7 +1339,7 @@ async function workspaceDevCommand(workspace, options) {
|
|
|
1412
1339
|
reject(error);
|
|
1413
1340
|
});
|
|
1414
1341
|
turboProcess.on("exit", (code) => {
|
|
1415
|
-
if (
|
|
1342
|
+
if (openApiWatcher) openApiWatcher.close().catch(() => {});
|
|
1416
1343
|
if (code !== null && code !== 0) reject(new Error(`Turbo exited with code ${code}`));
|
|
1417
1344
|
else resolve$3();
|
|
1418
1345
|
});
|
|
@@ -1465,11 +1392,12 @@ function generateCredentialsInjection(secretsJsonPath) {
|
|
|
1465
1392
|
return `import { Credentials } from '@geekmidas/envkit/credentials';
|
|
1466
1393
|
import { existsSync, readFileSync } from 'node:fs';
|
|
1467
1394
|
|
|
1468
|
-
// Inject dev secrets into Credentials
|
|
1395
|
+
// Inject dev secrets into Credentials and process.env
|
|
1469
1396
|
const secretsPath = '${secretsJsonPath}';
|
|
1470
1397
|
if (existsSync(secretsPath)) {
|
|
1471
1398
|
const secrets = JSON.parse(readFileSync(secretsPath, 'utf-8'));
|
|
1472
1399
|
Object.assign(Credentials, secrets);
|
|
1400
|
+
Object.assign(process.env, secrets);
|
|
1473
1401
|
// Debug: uncomment to verify preload is running
|
|
1474
1402
|
// console.log('[gkm preload] Injected', Object.keys(secrets).length, 'credentials');
|
|
1475
1403
|
}
|
|
@@ -8787,7 +8715,7 @@ Button.displayName = 'Button';
|
|
|
8787
8715
|
export { Button, buttonVariants };
|
|
8788
8716
|
`;
|
|
8789
8717
|
const buttonStories = `import type { Meta, StoryObj } from '@storybook/react';
|
|
8790
|
-
import { Button } from '
|
|
8718
|
+
import { Button } from '~/components/ui/button';
|
|
8791
8719
|
|
|
8792
8720
|
const meta: Meta<typeof Button> = {
|
|
8793
8721
|
title: 'Components/Button',
|
|
@@ -8952,7 +8880,7 @@ CardFooter.displayName = 'CardFooter';
|
|
|
8952
8880
|
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
|
|
8953
8881
|
`;
|
|
8954
8882
|
const inputStories = `import type { Meta, StoryObj } from '@storybook/react';
|
|
8955
|
-
import { Input } from '
|
|
8883
|
+
import { Input } from '~/components/ui/input';
|
|
8956
8884
|
|
|
8957
8885
|
const meta: Meta<typeof Input> = {
|
|
8958
8886
|
title: 'Components/Input',
|
|
@@ -9006,7 +8934,7 @@ export const WithValue: Story = {
|
|
|
9006
8934
|
};
|
|
9007
8935
|
`;
|
|
9008
8936
|
const cardStories = `import type { Meta, StoryObj } from '@storybook/react';
|
|
9009
|
-
import { Button } from '
|
|
8937
|
+
import { Button } from '~/components/ui/button';
|
|
9010
8938
|
import {
|
|
9011
8939
|
Card,
|
|
9012
8940
|
CardContent,
|
|
@@ -9014,8 +8942,8 @@ import {
|
|
|
9014
8942
|
CardFooter,
|
|
9015
8943
|
CardHeader,
|
|
9016
8944
|
CardTitle,
|
|
9017
|
-
} from '
|
|
9018
|
-
import { Input } from '
|
|
8945
|
+
} from '~/components/ui/card';
|
|
8946
|
+
import { Input } from '~/components/ui/input';
|
|
9019
8947
|
|
|
9020
8948
|
const meta: Meta<typeof Card> = {
|
|
9021
8949
|
title: 'Components/Card',
|
|
@@ -9093,8 +9021,8 @@ Label.displayName = LabelPrimitive.Root.displayName;
|
|
|
9093
9021
|
export { Label };
|
|
9094
9022
|
`;
|
|
9095
9023
|
const labelStories = `import type { Meta, StoryObj } from '@storybook/react';
|
|
9096
|
-
import { Input } from '
|
|
9097
|
-
import { Label } from '
|
|
9024
|
+
import { Input } from '~/components/ui/input';
|
|
9025
|
+
import { Label } from '~/components/ui/label';
|
|
9098
9026
|
|
|
9099
9027
|
const meta: Meta<typeof Label> = {
|
|
9100
9028
|
title: 'Components/Label',
|
|
@@ -9169,7 +9097,7 @@ function Badge({ className, variant, ...props }: BadgeProps) {
|
|
|
9169
9097
|
export { Badge, badgeVariants };
|
|
9170
9098
|
`;
|
|
9171
9099
|
const badgeStories = `import type { Meta, StoryObj } from '@storybook/react';
|
|
9172
|
-
import { Badge } from '
|
|
9100
|
+
import { Badge } from '~/components/ui/badge';
|
|
9173
9101
|
|
|
9174
9102
|
const meta: Meta<typeof Badge> = {
|
|
9175
9103
|
title: 'Components/Badge',
|
|
@@ -9245,7 +9173,7 @@ Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
|
9245
9173
|
export { Separator };
|
|
9246
9174
|
`;
|
|
9247
9175
|
const separatorStories = `import type { Meta, StoryObj } from '@storybook/react';
|
|
9248
|
-
import { Separator } from '
|
|
9176
|
+
import { Separator } from '~/components/ui/separator';
|
|
9249
9177
|
|
|
9250
9178
|
const meta: Meta<typeof Separator> = {
|
|
9251
9179
|
title: 'Components/Separator',
|
|
@@ -9350,11 +9278,11 @@ TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
|
9350
9278
|
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
9351
9279
|
`;
|
|
9352
9280
|
const tabsStories = `import type { Meta, StoryObj } from '@storybook/react';
|
|
9353
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from '
|
|
9354
|
-
import { Button } from '
|
|
9355
|
-
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '
|
|
9356
|
-
import { Input } from '
|
|
9357
|
-
import { Label } from '
|
|
9281
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '~/components/ui/tabs';
|
|
9282
|
+
import { Button } from '~/components/ui/button';
|
|
9283
|
+
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '~/components/ui/card';
|
|
9284
|
+
import { Input } from '~/components/ui/input';
|
|
9285
|
+
import { Label } from '~/components/ui/label';
|
|
9358
9286
|
|
|
9359
9287
|
const meta: Meta<typeof Tabs> = {
|
|
9360
9288
|
title: 'Components/Tabs',
|
|
@@ -9454,8 +9382,8 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
|
9454
9382
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
9455
9383
|
`;
|
|
9456
9384
|
const tooltipStories = `import type { Meta, StoryObj } from '@storybook/react';
|
|
9457
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '
|
|
9458
|
-
import { Button } from '
|
|
9385
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '~/components/ui/tooltip';
|
|
9386
|
+
import { Button } from '~/components/ui/button';
|
|
9459
9387
|
|
|
9460
9388
|
const meta: Meta<typeof Tooltip> = {
|
|
9461
9389
|
title: 'Components/Tooltip',
|
|
@@ -9655,10 +9583,10 @@ import {
|
|
|
9655
9583
|
DialogHeader,
|
|
9656
9584
|
DialogTitle,
|
|
9657
9585
|
DialogTrigger,
|
|
9658
|
-
} from '
|
|
9659
|
-
import { Button } from '
|
|
9660
|
-
import { Input } from '
|
|
9661
|
-
import { Label } from '
|
|
9586
|
+
} from '~/components/ui/dialog';
|
|
9587
|
+
import { Button } from '~/components/ui/button';
|
|
9588
|
+
import { Input } from '~/components/ui/input';
|
|
9589
|
+
import { Label } from '~/components/ui/label';
|
|
9662
9590
|
|
|
9663
9591
|
const meta: Meta<typeof Dialog> = {
|
|
9664
9592
|
title: 'Components/Dialog',
|