better-ts-stack 1.1.4 → 2.0.0
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/README.md +113 -82
- package/dist/args.d.ts +12 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +90 -0
- package/dist/args.js.map +1 -0
- package/dist/builder/configGenerator.d.ts.map +1 -1
- package/dist/builder/configGenerator.js +10 -3
- package/dist/builder/configGenerator.js.map +1 -1
- package/dist/builder/dependencyInstaller.d.ts.map +1 -1
- package/dist/builder/dependencyInstaller.js +8 -14
- package/dist/builder/dependencyInstaller.js.map +1 -1
- package/dist/builder/gitInitializer.d.ts.map +1 -1
- package/dist/builder/gitInitializer.js +8 -41
- package/dist/builder/gitInitializer.js.map +1 -1
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +24 -63
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/moduleSelector.d.ts +1 -4
- package/dist/builder/moduleSelector.d.ts.map +1 -1
- package/dist/builder/moduleSelector.js +11 -15
- package/dist/builder/moduleSelector.js.map +1 -1
- package/dist/builder/templateContext.d.ts +2 -17
- package/dist/builder/templateContext.d.ts.map +1 -1
- package/dist/builder/templateContext.js +6 -5
- package/dist/builder/templateContext.js.map +1 -1
- package/dist/index.js +45 -20
- package/dist/index.js.map +1 -1
- package/dist/output/nextSteps.d.ts +1 -2
- package/dist/output/nextSteps.d.ts.map +1 -1
- package/dist/output/nextSteps.js +10 -19
- package/dist/output/nextSteps.js.map +1 -1
- package/dist/prompts/index.d.ts +3 -3
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +22 -58
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/stack.d.ts +3 -2
- package/dist/prompts/stack.d.ts.map +1 -1
- package/dist/prompts/stack.js +81 -70
- package/dist/prompts/stack.js.map +1 -1
- package/dist/types/index.d.ts +20 -42
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +40 -38
- package/dist/types/index.js.map +1 -1
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +19 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/messages.d.ts +9 -0
- package/dist/ui/messages.d.ts.map +1 -0
- package/dist/ui/messages.js +100 -0
- package/dist/ui/messages.js.map +1 -0
- package/dist/ui/prompts.d.ts +20 -0
- package/dist/ui/prompts.d.ts.map +1 -0
- package/dist/ui/prompts.js +71 -0
- package/dist/ui/prompts.js.map +1 -0
- package/dist/ui/theme.d.ts +9 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +24 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/validators/index.d.ts +1 -0
- package/dist/validators/index.d.ts.map +1 -1
- package/dist/validators/index.js +6 -0
- package/dist/validators/index.js.map +1 -1
- package/package.json +70 -66
- package/templates/backend/express/config.json +44 -44
- package/templates/backend/express/eslint.config.mjs +40 -40
- package/templates/backend/express/gitignore +36 -36
- package/templates/backend/express/src/index.ts +76 -76
- package/templates/backend/express/src/routes/health.ts +12 -12
- package/templates/backend/express/tsconfig.json +25 -25
- package/templates/backend/nestjs/.prettierignore +52 -0
- package/templates/backend/nestjs/.prettierrc +16 -0
- package/templates/backend/nestjs/config.json +44 -0
- package/templates/backend/nestjs/eslint.config.mjs +40 -0
- package/templates/backend/nestjs/gitignore +36 -0
- package/templates/backend/nestjs/nest-cli.json +9 -0
- package/templates/backend/nestjs/src/app.module.ts.hbs +34 -0
- package/templates/backend/nestjs/src/health/health.controller.ts +12 -0
- package/templates/backend/nestjs/src/main.ts +23 -0
- package/templates/backend/nestjs/tsconfig.eslint.json +9 -0
- package/templates/backend/nestjs/tsconfig.json +25 -0
- package/templates/frontend/nextjs/app/layout.tsx +13 -13
- package/templates/frontend/nextjs/app/page.tsx.hbs +97 -97
- package/templates/frontend/nextjs/components/ui/button.tsx +51 -51
- package/templates/frontend/nextjs/components/ui/card.tsx +60 -60
- package/templates/frontend/nextjs/components/ui/field.tsx +67 -67
- package/templates/frontend/nextjs/components/ui/input.tsx +18 -18
- package/templates/frontend/nextjs/components.json +19 -19
- package/templates/frontend/nextjs/config.json +38 -38
- package/templates/frontend/nextjs/eslint.config.mjs +11 -11
- package/templates/frontend/nextjs/gitignore +42 -42
- package/templates/frontend/nextjs/lib/utils.ts +6 -6
- package/templates/frontend/nextjs/next.config.ts.hbs +12 -12
- package/templates/frontend/nextjs/proxy.ts.hbs +24 -24
- package/templates/frontend/nextjs/tsconfig.json +34 -34
- package/templates/frontend/tanstack/config.json +48 -48
- package/templates/frontend/tanstack/src/routeTree.gen.ts +68 -68
- package/templates/frontend/tanstack/src/styles/app.css +85 -85
- package/templates/modules/auth/express/config.json +27 -26
- package/templates/modules/auth/express/src/controllers/authController.ts.hbs +116 -130
- package/templates/modules/auth/express/src/middleware/requireAuth.ts.hbs +26 -26
- package/templates/modules/auth/express/src/services/userStore.ts.hbs +117 -117
- package/templates/modules/auth/nestjs/config.json +24 -0
- package/templates/modules/auth/nestjs/src/auth/auth.controller.ts +46 -0
- package/templates/modules/auth/nestjs/src/auth/auth.guard.ts +36 -0
- package/templates/modules/auth/nestjs/src/auth/auth.module.ts.hbs +22 -0
- package/templates/modules/auth/nestjs/src/auth/auth.schemas.ts +35 -0
- package/templates/modules/auth/nestjs/src/auth/auth.service.ts +70 -0
- package/templates/modules/auth/nestjs/src/auth/jwt.ts +27 -0
- package/templates/modules/auth/nestjs/src/auth/users.service.ts.hbs +144 -0
- package/templates/modules/auth/nestjs/src/auth/zod-validation.pipe.ts +16 -0
- package/templates/modules/auth/nextjs/app/dashboard/page.tsx +96 -96
- package/templates/modules/auth/nextjs/app/sign-in/page.tsx +35 -35
- package/templates/modules/auth/nextjs/app/sign-up/page.tsx +35 -35
- package/templates/modules/auth/nextjs/components/auth/sign-in-form.tsx +132 -132
- package/templates/modules/auth/nextjs/components/auth/sign-out-button.tsx +50 -50
- package/templates/modules/auth/nextjs/components/auth/sign-up-form.tsx +152 -152
- package/templates/modules/auth/nextjs/config.json +31 -31
- package/templates/modules/auth/nextjs/lib/auth-schema.ts +39 -39
- package/templates/modules/auth/nextjs/lib/auth.ts.hbs +37 -37
- package/templates/modules/auth/tanstack/src/lib/auth-functions.ts +4 -4
- package/templates/modules/auth/tanstack/src/routeTree.gen.ts +140 -140
- package/templates/modules/docker/.dockerignore +14 -14
- package/templates/modules/docker/Dockerfile.hbs +137 -133
- package/templates/modules/docker/config.json +19 -19
- package/templates/modules/docker/docker-compose.yml.hbs +9 -9
- package/templates/modules/drizzle/express/config.json +27 -27
- package/templates/modules/drizzle/express/drizzle.config.ts +13 -13
- package/templates/modules/drizzle/express/src/lib/db.ts +13 -13
- package/templates/modules/drizzle/express/src/lib/schema.ts +10 -10
- package/templates/modules/drizzle/nestjs/config.json +27 -0
- package/templates/modules/drizzle/nestjs/drizzle.config.ts +13 -0
- package/templates/modules/drizzle/nestjs/src/database/database.module.ts +30 -0
- package/templates/modules/drizzle/nestjs/src/database/schema.ts +10 -0
- package/templates/modules/drizzle/nextjs/config.json +29 -29
- package/templates/modules/drizzle/nextjs/lib/db.ts +13 -13
- package/templates/modules/drizzle/nextjs/lib/schema.ts.hbs +84 -84
- package/templates/modules/mongoose/express/config.json +16 -16
- package/templates/modules/mongoose/nestjs/config.json +16 -0
- package/templates/modules/mongoose/nestjs/src/users/user.schema.ts +21 -0
- package/templates/modules/mongoose/nextjs/config.json +16 -16
- package/templates/modules/mongoose/nextjs/lib/db.ts +36 -36
- package/templates/modules/mongoose/tanstack/config.json +17 -17
- package/templates/modules/mongoose/tanstack/src/lib/db.ts +37 -37
- package/templates/modules/prisma/express/config.json +28 -28
- package/templates/modules/prisma/express/prisma/schema.prisma +1 -1
- package/templates/modules/prisma/express/prisma.config.ts +12 -12
- package/templates/modules/prisma/express/src/lib/prisma.ts +24 -24
- package/templates/modules/prisma/nestjs/config.json +28 -0
- package/templates/modules/prisma/nestjs/prisma/schema.prisma +23 -0
- package/templates/modules/prisma/nestjs/prisma.config.ts +12 -0
- package/templates/modules/prisma/nestjs/src/prisma/prisma.module.ts +11 -0
- package/templates/modules/prisma/nestjs/src/prisma/prisma.service.ts +17 -0
- package/templates/modules/prisma/nextjs/config.json +29 -29
- package/templates/modules/prisma/nextjs/prisma/schema.prisma.hbs +91 -91
- package/templates/modules/prisma/tanstack/config.json +5 -5
- package/dist/intro.d.ts +0 -2
- package/dist/intro.d.ts.map +0 -1
- package/dist/intro.js +0 -27
- package/dist/intro.js.map +0 -1
- package/templates/backend/express/.eslintrc.js +0 -24
package/dist/prompts/stack.js
CHANGED
|
@@ -1,77 +1,88 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ask = ask;
|
|
6
4
|
exports.collectStackChoices = collectStackChoices;
|
|
7
|
-
const
|
|
8
|
-
const consola_1 = __importDefault(require("consola"));
|
|
5
|
+
const core_1 = require("@clack/core");
|
|
9
6
|
const types_1 = require("../types");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
message: "
|
|
33
|
-
options: types_1.
|
|
34
|
-
initialValue: "
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
packageManager: () => (0, prompts_1.select)({
|
|
49
|
-
message: "Select a package manager:",
|
|
50
|
-
options: types_1.packageManagerOptions,
|
|
51
|
-
initialValue: "npm",
|
|
52
|
-
}),
|
|
53
|
-
useDocker: () => (0, prompts_1.confirm)({ message: "Use Docker?", initialValue: false }),
|
|
54
|
-
useAuth: async ({ results }) => {
|
|
55
|
-
if (applicationType === "fullstack" && results.databaseType === "none")
|
|
56
|
-
return false;
|
|
57
|
-
return (0, prompts_1.select)({
|
|
58
|
-
message: applicationType === "fullstack"
|
|
59
|
-
? "Add Better Auth?"
|
|
60
|
-
: "Add authentication?",
|
|
61
|
-
options: types_1.authOptions,
|
|
62
|
-
initialValue: false,
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
initGit: () => (0, prompts_1.confirm)({
|
|
66
|
-
message: "Initialize a git repository?",
|
|
67
|
-
initialValue: true,
|
|
68
|
-
}),
|
|
69
|
-
installDeps: () => (0, prompts_1.confirm)({ message: "Install dependencies now?", initialValue: false }),
|
|
70
|
-
}, {
|
|
71
|
-
onCancel: () => {
|
|
72
|
-
(0, prompts_1.cancel)("Operation cancelled.");
|
|
73
|
-
process.exit(0);
|
|
74
|
-
},
|
|
7
|
+
const ui_1 = require("../ui");
|
|
8
|
+
// Returns the preset value when there is one, otherwise asks the user
|
|
9
|
+
async function ask(preset, prompt) {
|
|
10
|
+
if (preset !== undefined)
|
|
11
|
+
return preset;
|
|
12
|
+
const answer = await prompt();
|
|
13
|
+
if ((0, core_1.isCancel)(answer)) {
|
|
14
|
+
(0, ui_1.info)("Cancelled. Nothing was created.");
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
return answer;
|
|
18
|
+
}
|
|
19
|
+
async function askFramework() {
|
|
20
|
+
const applicationType = await (0, ui_1.select)({
|
|
21
|
+
message: "Application type",
|
|
22
|
+
options: types_1.applicationTypeOptions,
|
|
23
|
+
initialValue: "backend",
|
|
24
|
+
});
|
|
25
|
+
if ((0, core_1.isCancel)(applicationType))
|
|
26
|
+
return applicationType;
|
|
27
|
+
return applicationType === "backend"
|
|
28
|
+
? (0, ui_1.select)({
|
|
29
|
+
message: "Backend framework",
|
|
30
|
+
options: types_1.backendFrameworkOptions,
|
|
31
|
+
initialValue: "express",
|
|
32
|
+
})
|
|
33
|
+
: (0, ui_1.select)({
|
|
34
|
+
message: "Frontend framework",
|
|
35
|
+
options: types_1.frontendFrameworkOptions,
|
|
36
|
+
initialValue: "nextjs",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function askDatabase() {
|
|
40
|
+
const system = await (0, ui_1.select)({
|
|
41
|
+
message: "Database",
|
|
42
|
+
options: types_1.databaseSystemOptions,
|
|
43
|
+
initialValue: "none",
|
|
75
44
|
});
|
|
45
|
+
if ((0, core_1.isCancel)(system) || system === "none")
|
|
46
|
+
return system;
|
|
47
|
+
const options = system === "mongodb" ? types_1.mongodbOrmOptions : types_1.postgresqlOrmOptions;
|
|
48
|
+
return (0, ui_1.select)({
|
|
49
|
+
message: "ORM",
|
|
50
|
+
options,
|
|
51
|
+
initialValue: options[0].value,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Collects the stack choices, prompting only for those missing from the preset
|
|
55
|
+
async function collectStackChoices(preset) {
|
|
56
|
+
const framework = await ask(preset.framework, askFramework);
|
|
57
|
+
const database = await ask(preset.database, askDatabase);
|
|
58
|
+
const packageManager = await ask(preset.packageManager, () => (0, ui_1.select)({
|
|
59
|
+
message: "Package manager",
|
|
60
|
+
options: types_1.packageManagerOptions,
|
|
61
|
+
initialValue: "npm",
|
|
62
|
+
}));
|
|
63
|
+
const useDocker = await ask(preset.useDocker, () => (0, ui_1.confirm)({ message: "Add Docker?", initialValue: false }));
|
|
64
|
+
// Better Auth stores users and sessions, so full-stack auth needs a database
|
|
65
|
+
const isFullstack = (0, types_1.getApplicationType)(framework) === "fullstack";
|
|
66
|
+
const isAuthAvailable = !isFullstack || database !== "none";
|
|
67
|
+
if (preset.useAuth && !isAuthAvailable) {
|
|
68
|
+
throw (0, types_1.buildError)(`Auth for ${framework} needs a database. Add --database prisma, drizzle, or mongoose`, "INVALID_ARGUMENT");
|
|
69
|
+
}
|
|
70
|
+
const useAuth = isAuthAvailable
|
|
71
|
+
? await ask(preset.useAuth, () => (0, ui_1.confirm)({
|
|
72
|
+
message: isFullstack ? "Add Better Auth?" : "Add JWT authentication?",
|
|
73
|
+
initialValue: false,
|
|
74
|
+
}))
|
|
75
|
+
: false;
|
|
76
|
+
const initGit = await ask(preset.initGit, () => (0, ui_1.confirm)({ message: "Initialize a git repository?", initialValue: true }));
|
|
77
|
+
const installDeps = await ask(preset.installDeps, () => (0, ui_1.confirm)({ message: "Install dependencies now?", initialValue: false }));
|
|
78
|
+
return {
|
|
79
|
+
framework,
|
|
80
|
+
database,
|
|
81
|
+
packageManager,
|
|
82
|
+
useDocker,
|
|
83
|
+
useAuth,
|
|
84
|
+
initGit,
|
|
85
|
+
installDeps,
|
|
86
|
+
};
|
|
76
87
|
}
|
|
77
88
|
//# sourceMappingURL=stack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../src/prompts/stack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../src/prompts/stack.ts"],"names":[],"mappings":";;AAoBA,kBAYC;AAyCD,kDAkDC;AA3HD,sCAAuC;AAEvC,oCAckB;AAClB,8BAA8C;AAE9C,sEAAsE;AAC/D,KAAK,UAAU,GAAG,CACvB,MAAqB,EACrB,MAAiC;IAEjC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAExC,MAAM,MAAM,GAAG,MAAM,MAAM,EAAE,CAAC;IAC9B,IAAI,IAAA,eAAQ,EAAC,MAAM,CAAC,EAAE,CAAC;QACrB,IAAA,SAAI,EAAC,iCAAiC,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CA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AG,MAAM,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,EAAE,CACrD,IAAA,YAAO,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CACvE,CAAC;IAEF,OAAO;QACL,SAAS;QACT,QAAQ;QACR,cAAc;QACd,SAAS;QACT,OAAO;QACP,OAAO;QACP,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export type PackageManager = "npm" | "pnpm" | "bun";
|
|
2
|
-
export type
|
|
3
|
-
export type OrmOption = "prisma" | "mongoose" | "drizzle" | "none";
|
|
4
|
-
export type DatabaseOption = "none" | "prisma" | "mongoose" | "drizzle";
|
|
2
|
+
export type Database = "none" | "prisma" | "drizzle" | "mongoose";
|
|
5
3
|
export type ApplicationType = "backend" | "fullstack";
|
|
6
4
|
export type ModuleType = "base" | "database" | "feature";
|
|
7
5
|
export interface Dependencies {
|
|
@@ -9,30 +7,21 @@ export interface Dependencies {
|
|
|
9
7
|
}
|
|
10
8
|
export type BackendFramework = "express" | "nestjs";
|
|
11
9
|
export type FrontendFramework = "nextjs" | "tanstack";
|
|
10
|
+
export type Framework = BackendFramework | FrontendFramework;
|
|
12
11
|
export interface ProjectConfig {
|
|
13
12
|
projectName: string;
|
|
14
13
|
applicationType: ApplicationType;
|
|
15
|
-
framework:
|
|
16
|
-
|
|
17
|
-
orm: OrmOption;
|
|
18
|
-
database: DatabaseOption;
|
|
14
|
+
framework: Framework;
|
|
15
|
+
database: Database;
|
|
19
16
|
useDocker: boolean;
|
|
20
17
|
useAuth: boolean;
|
|
21
18
|
packageManager: PackageManager;
|
|
22
19
|
initGit: boolean;
|
|
23
20
|
installDeps: boolean;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*/
|
|
29
|
-
export type PromptChoices = Omit<ProjectConfig, "projectName" | "applicationType" | "database">;
|
|
30
|
-
/**
|
|
31
|
-
* Derives the database option from database type and ORM selection.
|
|
32
|
-
* Returns "none" if either is "none", otherwise returns the ORM which
|
|
33
|
-
* must be a valid DatabaseOption (prisma, mongoose, or drizzle).
|
|
34
|
-
*/
|
|
35
|
-
export declare function deriveDatabase(databaseType: DatabaseType, orm: OrmOption): DatabaseOption;
|
|
22
|
+
export type StackChoices = Omit<ProjectConfig, "projectName" | "applicationType">;
|
|
23
|
+
export declare const DEFAULT_CHOICES: StackChoices;
|
|
24
|
+
export declare const DEFAULT_PORT = 3000;
|
|
36
25
|
export interface ModuleConfig {
|
|
37
26
|
id: string;
|
|
38
27
|
name: string;
|
|
@@ -78,66 +67,61 @@ export interface TemplateContext {
|
|
|
78
67
|
lowercase: (str: string) => string;
|
|
79
68
|
uppercase: (str: string) => string;
|
|
80
69
|
kebabCase: (str: string) => string;
|
|
70
|
+
eq: (a: string, b: string) => boolean;
|
|
71
|
+
runner: () => string;
|
|
81
72
|
};
|
|
82
73
|
}
|
|
83
74
|
export declare const applicationTypeOptions: ({
|
|
84
75
|
value: "backend";
|
|
85
76
|
label: string;
|
|
77
|
+
hint: string;
|
|
86
78
|
} | {
|
|
87
79
|
value: "fullstack";
|
|
88
80
|
label: string;
|
|
81
|
+
hint: string;
|
|
89
82
|
})[];
|
|
90
83
|
export declare const backendFrameworkOptions: ({
|
|
91
84
|
value: "express";
|
|
92
85
|
label: string;
|
|
93
|
-
hint?: undefined;
|
|
94
86
|
} | {
|
|
95
87
|
value: "nestjs";
|
|
96
88
|
label: string;
|
|
97
|
-
hint: string;
|
|
98
89
|
})[];
|
|
99
90
|
export declare const frontendFrameworkOptions: ({
|
|
100
91
|
value: "nextjs";
|
|
101
92
|
label: string;
|
|
102
|
-
hint
|
|
93
|
+
hint: string;
|
|
103
94
|
} | {
|
|
104
95
|
value: "tanstack";
|
|
105
96
|
label: string;
|
|
106
97
|
hint: string;
|
|
107
98
|
})[];
|
|
108
|
-
export declare const
|
|
99
|
+
export declare const databaseSystemOptions: ({
|
|
109
100
|
value: "none";
|
|
110
101
|
label: string;
|
|
102
|
+
hint: string;
|
|
111
103
|
} | {
|
|
112
104
|
value: "mongodb";
|
|
113
105
|
label: string;
|
|
106
|
+
hint?: undefined;
|
|
114
107
|
} | {
|
|
115
108
|
value: "postgresql";
|
|
116
109
|
label: string;
|
|
110
|
+
hint?: undefined;
|
|
117
111
|
})[];
|
|
118
112
|
export declare const mongodbOrmOptions: {
|
|
119
113
|
value: "mongoose";
|
|
120
114
|
label: string;
|
|
115
|
+
hint: string;
|
|
121
116
|
}[];
|
|
122
117
|
export declare const postgresqlOrmOptions: ({
|
|
123
118
|
value: "prisma";
|
|
124
119
|
label: string;
|
|
120
|
+
hint: string;
|
|
125
121
|
} | {
|
|
126
122
|
value: "drizzle";
|
|
127
123
|
label: string;
|
|
128
|
-
|
|
129
|
-
export declare const databaseOptions: ({
|
|
130
|
-
value: "none";
|
|
131
|
-
label: string;
|
|
132
|
-
} | {
|
|
133
|
-
value: "prisma";
|
|
134
|
-
label: string;
|
|
135
|
-
} | {
|
|
136
|
-
value: "mongoose";
|
|
137
|
-
label: string;
|
|
138
|
-
} | {
|
|
139
|
-
value: "drizzle";
|
|
140
|
-
label: string;
|
|
124
|
+
hint: string;
|
|
141
125
|
})[];
|
|
142
126
|
export declare const packageManagerOptions: ({
|
|
143
127
|
value: "npm";
|
|
@@ -149,11 +133,5 @@ export declare const packageManagerOptions: ({
|
|
|
149
133
|
value: "bun";
|
|
150
134
|
label: string;
|
|
151
135
|
})[];
|
|
152
|
-
export declare
|
|
153
|
-
value: false;
|
|
154
|
-
label: string;
|
|
155
|
-
} | {
|
|
156
|
-
value: true;
|
|
157
|
-
label: string;
|
|
158
|
-
})[];
|
|
136
|
+
export declare function getApplicationType(framework: Framework): ApplicationType;
|
|
159
137
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../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AM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE;QACP,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;QACnC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;QACnC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;QACnC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QACtC,MAAM,EAAE,MAAM,MAAM,CAAC;KACtB,CAAC;CACH;AAGD,eAAO,MAAM,sBAAsB;;;;;;;;IAWlC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;IAGnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;IAOpC,CAAC;AAGF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;IAIjC,CAAC;AAGF,eAAO,MAAM,iBAAiB;;;;GAE7B,CAAC;AAGF,eAAO,MAAM,oBAAoB;;;;;;;;IAGhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;IAIjC,CAAC;AAGF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe,CAIxE"}
|
package/dist/types/index.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Core type definitions for the CLI builder
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
exports.deriveDatabase = deriveDatabase;
|
|
4
|
+
exports.packageManagerOptions = exports.postgresqlOrmOptions = exports.mongodbOrmOptions = exports.databaseSystemOptions = exports.frontendFrameworkOptions = exports.backendFrameworkOptions = exports.applicationTypeOptions = exports.DEFAULT_PORT = exports.DEFAULT_CHOICES = void 0;
|
|
6
5
|
exports.buildError = buildError;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
exports.getApplicationType = getApplicationType;
|
|
7
|
+
// Used for every choice not given as a flag when --yes is passed
|
|
8
|
+
exports.DEFAULT_CHOICES = {
|
|
9
|
+
framework: "express",
|
|
10
|
+
database: "none",
|
|
11
|
+
useDocker: false,
|
|
12
|
+
useAuth: false,
|
|
13
|
+
packageManager: "npm",
|
|
14
|
+
initGit: true,
|
|
15
|
+
installDeps: false,
|
|
16
|
+
};
|
|
17
|
+
// Port the generated server listens on
|
|
18
|
+
exports.DEFAULT_PORT = 3000;
|
|
20
19
|
// Unified error creation function
|
|
21
20
|
function buildError(errorOrMessage, code, context, exitCode = 1) {
|
|
22
21
|
const message = errorOrMessage instanceof Error
|
|
@@ -28,50 +27,53 @@ function buildError(errorOrMessage, code, context, exitCode = 1) {
|
|
|
28
27
|
}
|
|
29
28
|
// Type-safe option definitions
|
|
30
29
|
exports.applicationTypeOptions = [
|
|
31
|
-
{
|
|
32
|
-
|
|
30
|
+
{
|
|
31
|
+
value: "backend",
|
|
32
|
+
label: "Backend API",
|
|
33
|
+
hint: "Express or NestJS",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: "fullstack",
|
|
37
|
+
label: "Full-stack app",
|
|
38
|
+
hint: "Next.js or TanStack Start",
|
|
39
|
+
},
|
|
33
40
|
];
|
|
34
41
|
exports.backendFrameworkOptions = [
|
|
35
42
|
{ value: "express", label: "Express" },
|
|
36
|
-
{ value: "nestjs", label: "NestJS"
|
|
43
|
+
{ value: "nestjs", label: "NestJS" },
|
|
37
44
|
];
|
|
38
45
|
exports.frontendFrameworkOptions = [
|
|
39
|
-
{ value: "nextjs", label: "Next.js 16
|
|
46
|
+
{ value: "nextjs", label: "Next.js 16", hint: "App Router" },
|
|
40
47
|
{
|
|
41
48
|
value: "tanstack",
|
|
42
|
-
label: "TanStack Start
|
|
43
|
-
hint: "
|
|
49
|
+
label: "TanStack Start",
|
|
50
|
+
hint: "React, release candidate",
|
|
44
51
|
},
|
|
45
52
|
];
|
|
46
|
-
// Database
|
|
47
|
-
exports.
|
|
48
|
-
{ value: "none", label: "None
|
|
53
|
+
// Database system options; the ORM is chosen in a second step
|
|
54
|
+
exports.databaseSystemOptions = [
|
|
55
|
+
{ value: "none", label: "None", hint: "skip database setup" },
|
|
49
56
|
{ value: "mongodb", label: "MongoDB" },
|
|
50
57
|
{ value: "postgresql", label: "PostgreSQL" },
|
|
51
58
|
];
|
|
52
59
|
// ORM options for MongoDB
|
|
53
60
|
exports.mongodbOrmOptions = [
|
|
54
|
-
{ value: "mongoose", label: "Mongoose
|
|
61
|
+
{ value: "mongoose", label: "Mongoose", hint: "MongoDB ODM" },
|
|
55
62
|
];
|
|
56
63
|
// ORM options for PostgreSQL
|
|
57
64
|
exports.postgresqlOrmOptions = [
|
|
58
|
-
{ value: "prisma", label: "Prisma
|
|
59
|
-
{ value: "drizzle", label: "Drizzle
|
|
60
|
-
];
|
|
61
|
-
// Legacy database options (for backward compatibility)
|
|
62
|
-
exports.databaseOptions = [
|
|
63
|
-
{ value: "none", label: "None (Skip database setup)" },
|
|
64
|
-
{ value: "prisma", label: "Prisma (Type-safe ORM)" },
|
|
65
|
-
{ value: "mongoose", label: "Mongoose (Standard MongoDB ODM)" },
|
|
66
|
-
{ value: "drizzle", label: "Drizzle (Lightweight ORM)" },
|
|
65
|
+
{ value: "prisma", label: "Prisma", hint: "type-safe ORM" },
|
|
66
|
+
{ value: "drizzle", label: "Drizzle", hint: "lightweight ORM" },
|
|
67
67
|
];
|
|
68
68
|
exports.packageManagerOptions = [
|
|
69
69
|
{ value: "npm", label: "npm" },
|
|
70
70
|
{ value: "pnpm", label: "pnpm" },
|
|
71
71
|
{ value: "bun", label: "bun" },
|
|
72
72
|
];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
// Backend frameworks produce an API server, the others a full-stack app
|
|
74
|
+
function getApplicationType(framework) {
|
|
75
|
+
return exports.backendFrameworkOptions.some((option) => option.value === framework)
|
|
76
|
+
? "backend"
|
|
77
|
+
: "fullstack";
|
|
78
|
+
}
|
|
77
79
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AA4G5C,gCAaC;AA0ED,gDAIC;AApJD,iEAAiE;AACpD,QAAA,eAAe,GAAiB;IAC3C,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,KAAK;CACnB,CAAC;AAEF,uCAAuC;AAC1B,QAAA,YAAY,GAAG,IAAI,CAAC;AA4CjC,kCAAkC;AAClC,SAAgB,UAAU,CACxB,cAAuB,EACvB,IAAY,EACZ,OAAgB,EAChB,WAAmB,CAAC;IAEpB,MAAM,OAAO,GACX,cAAc,YAAY,KAAK;QAC7B,CAAC,CAAC,cAAc,CAAC,OAAO;QACxB,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC7B,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AAClD,CAAC;AAqBD,+BAA+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AA,qBAAqB,GAAG;IACnC,EAAE,KAAK,EAAE,KAAc,EAAE,KAAK,EAAE,KAAK,EAAE;IACvC,EAAE,KAAK,EAAE,MAAe,EAAE,KAAK,EAAE,MAAM,EAAE;IACzC,EAAE,KAAK,EAAE,KAAc,EAAE,KAAK,EAAE,KAAK,EAAE;CACxC,CAAC;AAEF,wEAAwE;AACxE,SAAgB,kBAAkB,CAAC,SAAoB;IACrD,OAAO,+BAAuB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC;QACzE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,WAAW,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./messages"), exports);
|
|
18
|
+
__exportStar(require("./prompts"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,4CAA0B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProjectConfig } from "../types";
|
|
2
|
+
export declare const success: (message: string) => void;
|
|
3
|
+
export declare const info: (message: string) => void;
|
|
4
|
+
export declare const warn: (message: string) => void;
|
|
5
|
+
export declare const error: (message: string) => void;
|
|
6
|
+
export declare function showBanner(version: string, isInteractive: boolean): void;
|
|
7
|
+
export declare function showSummary(config: ProjectConfig, targetDir: string): void;
|
|
8
|
+
export declare function showNextSteps(steps: string[]): void;
|
|
9
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/ui/messages.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,aAAa,EAAE,MAAM,UAAU,CAAC;AAiBvD,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,SAAqC,CAAC;AAC7E,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,SAA+B,CAAC;AACpE,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,SAAsC,CAAC;AAC3E,eAAO,MAAM,KAAK,GAAI,SAAS,MAAM,SAAoC,CAAC;AAa1E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,QAqBjE;AAGD,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,QAkBnE;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAU5C"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.error = exports.warn = exports.info = exports.success = void 0;
|
|
7
|
+
exports.showBanner = showBanner;
|
|
8
|
+
exports.showSummary = showSummary;
|
|
9
|
+
exports.showNextSteps = showNextSteps;
|
|
10
|
+
// Everything the CLI prints outside of prompts
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
+
const node_process_1 = require("node:process");
|
|
13
|
+
const types_1 = require("../types");
|
|
14
|
+
const theme_1 = require("./theme");
|
|
15
|
+
// "better-ts-stack" in the figlet Big font
|
|
16
|
+
const WORDMARK = [
|
|
17
|
+
" _ _ _ _ _ _",
|
|
18
|
+
" | | | | | | | | | | | |",
|
|
19
|
+
" | |__ ___| |_| |_ ___ _ __ ______| |_ ___ ______ ___| |_ __ _ ___| | __",
|
|
20
|
+
" | '_ \\ / _ \\ __| __/ _ \\ '__|______| __/ __|______/ __| __/ _` |/ __| |/ /",
|
|
21
|
+
" | |_) | __/ |_| || __/ | | |_\\__ \\ \\__ \\ || (_| | (__| <",
|
|
22
|
+
" |_.__/ \\___|\\__|\\__\\___|_| \\__|___/ |___/\\__\\__,_|\\___|_|\\_\\",
|
|
23
|
+
];
|
|
24
|
+
function write(line = "") {
|
|
25
|
+
process.stdout.write(`${line}\n`);
|
|
26
|
+
}
|
|
27
|
+
const success = (message) => write(`${(0, theme_1.lime)("✓")} ${message}`);
|
|
28
|
+
exports.success = success;
|
|
29
|
+
const info = (message) => write((0, theme_1.dim)(`· ${message}`));
|
|
30
|
+
exports.info = info;
|
|
31
|
+
const warn = (message) => write(`${(0, theme_1.amber)("!")} ${message}`);
|
|
32
|
+
exports.warn = warn;
|
|
33
|
+
const error = (message) => write(`${(0, theme_1.red)("×")} ${message}`);
|
|
34
|
+
exports.error = error;
|
|
35
|
+
const WORDMARK_WIDTH = Math.max(...WORDMARK.map((line) => line.length));
|
|
36
|
+
function greeting() {
|
|
37
|
+
const hour = new Date().getHours();
|
|
38
|
+
if (hour < 12)
|
|
39
|
+
return "Good morning.";
|
|
40
|
+
if (hour < 18)
|
|
41
|
+
return "Good afternoon.";
|
|
42
|
+
return "Good evening.";
|
|
43
|
+
}
|
|
44
|
+
// Opens the session with the wordmark, tagline, and key hints. An interactive
|
|
45
|
+
// session starts on a cleared screen; console.clear() does nothing when piped
|
|
46
|
+
function showBanner(version, isInteractive) {
|
|
47
|
+
if (isInteractive)
|
|
48
|
+
console.clear();
|
|
49
|
+
write();
|
|
50
|
+
if ((process.stdout.columns ?? 80) > WORDMARK_WIDTH) {
|
|
51
|
+
for (const line of WORDMARK)
|
|
52
|
+
write((0, theme_1.lime)(line));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
write((0, theme_1.lime)((0, theme_1.bold)("better-ts-stack")));
|
|
56
|
+
}
|
|
57
|
+
write();
|
|
58
|
+
write((0, theme_1.lavender)((0, theme_1.bold)("TypeScript projects, ready to run.")));
|
|
59
|
+
if (isInteractive) {
|
|
60
|
+
write((0, theme_1.dim)(greeting()));
|
|
61
|
+
write((0, theme_1.lime)((0, theme_1.bold)("Answer a few questions to get started.")));
|
|
62
|
+
write((0, theme_1.dim)(`v${version} · ↑↓ to move · enter to confirm · ctrl+c to cancel`));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
write((0, theme_1.dim)(`v${version}`));
|
|
66
|
+
}
|
|
67
|
+
write();
|
|
68
|
+
}
|
|
69
|
+
// Displays a summary of what will be built
|
|
70
|
+
function showSummary(config, targetDir) {
|
|
71
|
+
const stack = [
|
|
72
|
+
config.framework,
|
|
73
|
+
config.database !== "none" && config.database,
|
|
74
|
+
config.useAuth && "auth",
|
|
75
|
+
config.useDocker && "docker",
|
|
76
|
+
];
|
|
77
|
+
const setup = [
|
|
78
|
+
config.packageManager,
|
|
79
|
+
config.initGit && "git",
|
|
80
|
+
config.installDeps && "install dependencies",
|
|
81
|
+
];
|
|
82
|
+
write(` ${(0, theme_1.amber)((0, theme_1.bold)(config.projectName))}`);
|
|
83
|
+
write(` ${(0, theme_1.pink)("Stack")} ${stack.filter(Boolean).join(" · ")}`);
|
|
84
|
+
write(` ${(0, theme_1.pink)("Setup")} ${setup.filter(Boolean).join(" · ")}`);
|
|
85
|
+
write(` ${(0, theme_1.pink)("Path ")} ${node_path_1.default.relative((0, node_process_1.cwd)(), targetDir) || "."}`);
|
|
86
|
+
write();
|
|
87
|
+
}
|
|
88
|
+
// Shows the numbered next steps, with the commands to run highlighted
|
|
89
|
+
function showNextSteps(steps) {
|
|
90
|
+
write();
|
|
91
|
+
write(` ${(0, theme_1.amber)((0, theme_1.bold)("Next steps"))}`);
|
|
92
|
+
steps.forEach((step, index) => {
|
|
93
|
+
const isCommand = /^(cd|npm|pnpm|bun) /.test(step);
|
|
94
|
+
write(` ${(0, theme_1.dim)(`${index + 1}.`)} ${isCommand ? (0, theme_1.lime)(step) : step}`);
|
|
95
|
+
});
|
|
96
|
+
write();
|
|
97
|
+
write(` ${(0, theme_1.dim)(`Your app will run at http://localhost:${types_1.DEFAULT_PORT}`)}`);
|
|
98
|
+
write();
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/ui/messages.ts"],"names":[],"mappings":";;;;;;AAqCA,gCAqBC;AAGD,kCAkBC;AAGD,sCAUC;AA5FD,+CAA+C;AAC/C,0DAA6B;AAC7B,+CAAmC;AAEnC,oCAAuD;AACvD,mCAAsE;AAEtE,2CAA2C;AAC3C,MAAM,QAAQ,GAAG;IACf,yEAAyE;IACzE,0EAA0E;IAC1E,6EAA6E;IAC7E,gFAAgF;IAChF,gFAAgF;IAChF,uFAAuF;CACxF,CAAC;AAEF,SAAS,KAAK,CAAC,IAAI,GAAG,EAAE;IACtB,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