stackkit 0.2.6 → 0.2.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.
Files changed (83) hide show
  1. package/dist/cli/create.js +1 -2
  2. package/dist/cli/list.js +73 -83
  3. package/dist/index.js +25 -44
  4. package/dist/lib/constants.d.ts +110 -0
  5. package/dist/lib/constants.js +112 -0
  6. package/dist/lib/env/env-editor.js +41 -47
  7. package/dist/lib/fs/files.d.ts +0 -1
  8. package/dist/lib/fs/files.js +12 -40
  9. package/dist/lib/generation/code-generator.d.ts +4 -1
  10. package/dist/lib/generation/code-generator.js +36 -10
  11. package/dist/lib/pm/package-manager.d.ts +1 -1
  12. package/dist/lib/pm/package-manager.js +130 -14
  13. package/dist/lib/ui/logger.d.ts +8 -1
  14. package/dist/lib/ui/logger.js +60 -3
  15. package/dist/lib/utils/fs-helpers.d.ts +12 -0
  16. package/dist/lib/utils/fs-helpers.js +61 -0
  17. package/dist/lib/utils/json-loader.d.ts +6 -0
  18. package/dist/lib/utils/json-loader.js +34 -0
  19. package/dist/lib/utils/module-loader.d.ts +9 -0
  20. package/dist/lib/utils/module-loader.js +98 -0
  21. package/dist/lib/utils/package-root.d.ts +1 -0
  22. package/dist/lib/utils/package-root.js +75 -2
  23. package/dist/lib/utils/path-resolver.d.ts +9 -0
  24. package/dist/lib/utils/path-resolver.js +44 -0
  25. package/modules/auth/authjs/files/nextjs/api/auth/[...nextauth]/route.ts +3 -0
  26. package/modules/auth/authjs/files/nextjs/proxy.ts +1 -0
  27. package/modules/auth/authjs/files/shared/lib/auth.ts +119 -0
  28. package/modules/auth/authjs/files/{prisma → shared/prisma}/schema.prisma +11 -1
  29. package/modules/auth/authjs/generator.json +18 -8
  30. package/modules/auth/better-auth/files/express/middlewares/authorize.ts +54 -0
  31. package/modules/auth/better-auth/files/express/types/express.d.ts +16 -0
  32. package/modules/auth/better-auth/files/nextjs/lib/auth/auth-guards.ts +31 -0
  33. package/modules/auth/better-auth/files/nextjs/proxy.ts +34 -0
  34. package/modules/auth/better-auth/files/{lib → shared/lib}/auth-client.ts +1 -1
  35. package/modules/auth/better-auth/files/{lib → shared/lib}/auth.ts +46 -20
  36. package/modules/auth/better-auth/files/{prisma → shared/prisma}/schema.prisma +11 -2
  37. package/modules/auth/better-auth/generator.json +74 -19
  38. package/modules/database/mongoose/generator.json +16 -2
  39. package/modules/database/prisma/files/lib/prisma.ts +1 -1
  40. package/modules/database/prisma/files/prisma/schema.prisma +1 -2
  41. package/modules/database/prisma/generator.json +8 -1
  42. package/package.json +2 -2
  43. package/templates/express/env.example +2 -1
  44. package/templates/express/package.json +3 -4
  45. package/templates/express/src/app.ts +18 -25
  46. package/templates/express/src/config/cors.ts +12 -0
  47. package/templates/express/src/config/helmet.ts +5 -0
  48. package/templates/express/src/config/logger.ts +6 -0
  49. package/templates/express/src/config/rate-limit.ts +11 -0
  50. package/templates/express/src/{features → modules}/health/health.route.ts +1 -1
  51. package/templates/express/src/routes/index.ts +12 -0
  52. package/templates/express/src/shared/errors/api-error.ts +14 -0
  53. package/templates/express/src/shared/errors/error-codes.ts +9 -0
  54. package/templates/express/src/shared/logger/logger.ts +20 -0
  55. package/templates/express/src/{middlewares → shared/middlewares}/error.middleware.ts +1 -1
  56. package/templates/express/src/shared/middlewares/not-found.middleware.ts +9 -0
  57. package/templates/express/src/shared/utils/async-handler.ts +9 -0
  58. package/templates/express/src/shared/utils/pagination.ts +6 -0
  59. package/templates/express/src/shared/utils/response.ts +9 -0
  60. package/templates/express/tsconfig.json +9 -3
  61. package/templates/react/src/app/layouts/dashboard-layout.tsx +8 -0
  62. package/templates/react/src/app/layouts/public-layout.tsx +5 -0
  63. package/templates/react/src/app/providers.tsx +20 -0
  64. package/templates/react/src/app/router.tsx +21 -0
  65. package/templates/react/src/{pages/About.tsx → features/about/pages/about.tsx} +1 -1
  66. package/templates/react/src/{pages/Home.tsx → features/home/pages/home.tsx} +1 -1
  67. package/templates/react/src/main.tsx +2 -2
  68. package/templates/react/src/{api/client.ts → shared/api/http.ts} +1 -1
  69. package/templates/react/src/{pages/NotFound.tsx → shared/pages/not-found.tsx} +1 -1
  70. package/dist/lib/git-utils.d.ts +0 -1
  71. package/dist/lib/git-utils.js +0 -29
  72. package/modules/auth/authjs/files/api/auth/[...nextauth]/route.ts +0 -2
  73. package/modules/auth/authjs/files/lib/auth.ts +0 -22
  74. /package/modules/auth/better-auth/files/{api → nextjs/api}/auth/[...all]/route.ts +0 -0
  75. /package/modules/auth/better-auth/files/{lib → shared/lib/email}/email-service.ts +0 -0
  76. /package/modules/auth/better-auth/files/{lib → shared/lib/email}/email-templates.ts +0 -0
  77. /package/templates/express/src/{features → modules}/health/health.controller.ts +0 -0
  78. /package/templates/express/src/{features → modules}/health/health.service.ts +0 -0
  79. /package/templates/react/src/{components/ErrorBoundary.tsx → shared/components/error-boundary.tsx} +0 -0
  80. /package/templates/react/src/{components/Layout.tsx → shared/components/layout.tsx} +0 -0
  81. /package/templates/react/src/{components/Loading.tsx → shared/components/loading.tsx} +0 -0
  82. /package/templates/react/src/{components/SEO.tsx → shared/components/seo.tsx} +0 -0
  83. /package/templates/react/src/{lib/queryClient.ts → shared/lib/query-client.ts} +0 -0
@@ -16,7 +16,6 @@ const shared_1 = require("../lib/discovery/shared");
16
16
  const env_editor_1 = require("../lib/env/env-editor");
17
17
  const framework_utils_1 = require("../lib/framework/framework-utils");
18
18
  const code_generator_1 = require("../lib/generation/code-generator");
19
- const git_utils_1 = require("../lib/git-utils");
20
19
  const package_manager_1 = require("../lib/pm/package-manager");
21
20
  const logger_1 = require("../lib/ui/logger");
22
21
  const package_root_1 = require("../lib/utils/package-root");
@@ -304,7 +303,7 @@ async function generateProject(config, targetDir, options) {
304
303
  if (options?.git !== false && !(options?.["no-git"] || options?.noGit)) {
305
304
  const gitSpinner = logger_1.logger.startSpinner("Initializing git repository...");
306
305
  try {
307
- await (0, git_utils_1.initGit)(targetDir);
306
+ await (0, package_manager_1.initGit)(targetDir);
308
307
  gitSpinner.succeed("Git repository initialized");
309
308
  }
310
309
  catch (error) {
package/dist/cli/list.js CHANGED
@@ -9,6 +9,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const shared_1 = require("../lib/discovery/shared");
11
11
  const logger_1 = require("../lib/ui/logger");
12
+ const module_loader_1 = require("../lib/utils/module-loader");
12
13
  const package_root_1 = require("../lib/utils/package-root");
13
14
  async function listCommand(options) {
14
15
  const showFrameworks = !options.modules || options.frameworks;
@@ -16,72 +17,22 @@ async function listCommand(options) {
16
17
  try {
17
18
  logger_1.logger.header("StackKit Resources");
18
19
  logger_1.logger.newLine();
19
- let hasFrameworks = false;
20
- let hasModules = false;
20
+ let hasContent = false;
21
21
  if (showFrameworks) {
22
- const templatesDir = path_1.default.join((0, package_root_1.getPackageRoot)(), "templates");
23
- const frameworks = await getAvailableFrameworks(templatesDir);
22
+ const frameworks = await getAvailableFrameworks();
24
23
  if (frameworks.length > 0) {
25
- hasFrameworks = true;
26
- logger_1.logger.log(chalk_1.default.bold.blue("FRAMEWORKS"));
27
- frameworks.forEach((framework, index) => {
28
- const isLast = index === frameworks.length - 1;
29
- const prefix = isLast ? "└──" : "├──";
30
- logger_1.logger.log(` ${chalk_1.default.gray(prefix)} ${chalk_1.default.cyan(framework.displayName || framework.name)}`);
31
- });
32
- logger_1.logger.newLine();
24
+ hasContent = true;
25
+ printFrameworks(frameworks);
33
26
  }
34
27
  }
35
28
  if (showModules) {
36
- const modulesDir = path_1.default.join((0, package_root_1.getPackageRoot)(), "modules");
37
- const modules = await getAvailableModules(modulesDir);
29
+ const modules = await getAvailableModules();
38
30
  if (modules.length > 0) {
39
- hasModules = true;
40
- logger_1.logger.log(chalk_1.default.bold.magenta("MODULES"));
41
- const grouped = modules.reduce((acc, mod) => {
42
- const cat = mod.category || "other";
43
- if (!acc[cat])
44
- acc[cat] = [];
45
- acc[cat].push(mod);
46
- return acc;
47
- }, {});
48
- const categories = Object.keys(grouped);
49
- categories.forEach((category, categoryIndex) => {
50
- const mods = grouped[category];
51
- const isLastCategory = categoryIndex === categories.length - 1;
52
- const categoryPrefix = isLastCategory ? "└──" : "├──";
53
- logger_1.logger.log(` ${chalk_1.default.gray(categoryPrefix)} ${chalk_1.default.yellow(formatCategoryName(category))} ${chalk_1.default.dim(`(${mods.length})`)}`);
54
- mods.forEach((mod, modIndex) => {
55
- const isLastMod = modIndex === mods.length - 1;
56
- const modPrefix = isLastCategory
57
- ? isLastMod
58
- ? " └──"
59
- : " ├──"
60
- : isLastMod
61
- ? "│ └──"
62
- : "│ ├──";
63
- logger_1.logger.log(` ${chalk_1.default.gray(modPrefix)} ${chalk_1.default.green(mod.displayName)}`);
64
- if (mod.category === "database" && mod.name === "prisma") {
65
- const providerPrefix = isLastCategory
66
- ? isLastMod
67
- ? " └──"
68
- : " ├──"
69
- : isLastMod
70
- ? "│ └──"
71
- : "│ ├──";
72
- // Derive provider list directly from the Prisma generator metadata
73
- const providers = (0, shared_1.getPrismaProvidersFromGenerator)((0, package_root_1.getPackageRoot)());
74
- const providersText = providers.length
75
- ? providers.map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(", ")
76
- : "None";
77
- logger_1.logger.log(` ${chalk_1.default.gray(providerPrefix)} ${chalk_1.default.dim(`Providers: ${providersText}`)}`);
78
- }
79
- });
80
- });
81
- logger_1.logger.newLine();
31
+ hasContent = true;
32
+ printModules(modules);
82
33
  }
83
34
  }
84
- if (!hasFrameworks && !hasModules) {
35
+ if (!hasContent) {
85
36
  logger_1.logger.log(chalk_1.default.dim("No resources available"));
86
37
  logger_1.logger.newLine();
87
38
  }
@@ -93,18 +44,79 @@ async function listCommand(options) {
93
44
  process.exit(1);
94
45
  }
95
46
  }
96
- async function getAvailableFrameworks(templatesDir) {
47
+ function printFrameworks(frameworks) {
48
+ logger_1.logger.log(chalk_1.default.bold.blue("FRAMEWORKS"));
49
+ frameworks.forEach((framework, index) => {
50
+ const isLast = index === frameworks.length - 1;
51
+ const prefix = isLast ? "└──" : "├──";
52
+ logger_1.logger.log(` ${chalk_1.default.gray(prefix)} ${chalk_1.default.cyan(framework.displayName)}`);
53
+ });
54
+ logger_1.logger.newLine();
55
+ }
56
+ function printModules(modules) {
57
+ logger_1.logger.log(chalk_1.default.bold.magenta("MODULES"));
58
+ const grouped = groupModulesByCategory(modules);
59
+ const categories = Object.keys(grouped);
60
+ categories.forEach((category, categoryIndex) => {
61
+ const mods = grouped[category];
62
+ const isLastCategory = categoryIndex === categories.length - 1;
63
+ const categoryPrefix = isLastCategory ? "└──" : "├──";
64
+ logger_1.logger.log(` ${chalk_1.default.gray(categoryPrefix)} ${chalk_1.default.yellow(formatCategoryName(category))} ${chalk_1.default.dim(`(${mods.length})`)}`);
65
+ mods.forEach((mod, modIndex) => {
66
+ const isLastMod = modIndex === mods.length - 1;
67
+ const modPrefix = getModulePrefix(isLastCategory, isLastMod);
68
+ logger_1.logger.log(` ${chalk_1.default.gray(modPrefix)} ${chalk_1.default.green(mod.displayName)}`);
69
+ if (mod.category === "database" && mod.name === "prisma") {
70
+ printPrismaProviders(isLastCategory, isLastMod);
71
+ }
72
+ });
73
+ });
74
+ logger_1.logger.newLine();
75
+ }
76
+ function printPrismaProviders(isLastCategory, isLastMod) {
77
+ const providerPrefix = getProviderPrefix(isLastCategory, isLastMod);
78
+ const providers = (0, shared_1.getPrismaProvidersFromGenerator)((0, package_root_1.getPackageRoot)());
79
+ const providersText = providers.length
80
+ ? providers.map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(", ")
81
+ : "None";
82
+ logger_1.logger.log(` ${chalk_1.default.gray(providerPrefix)} ${chalk_1.default.dim(`Providers: ${providersText}`)}`);
83
+ }
84
+ function getModulePrefix(isLastCategory, isLastMod) {
85
+ if (isLastCategory) {
86
+ return isLastMod ? " └──" : " ├──";
87
+ }
88
+ return isLastMod ? "│ └──" : "│ ├──";
89
+ }
90
+ function getProviderPrefix(isLastCategory, isLastMod) {
91
+ if (isLastCategory) {
92
+ return isLastMod ? " └──" : " ├──";
93
+ }
94
+ return isLastMod ? "│ └──" : "│ ├──";
95
+ }
96
+ function groupModulesByCategory(modules) {
97
+ return modules.reduce((acc, mod) => {
98
+ const cat = mod.category || "other";
99
+ if (!acc[cat])
100
+ acc[cat] = [];
101
+ acc[cat].push(mod);
102
+ return acc;
103
+ }, {});
104
+ }
105
+ async function getAvailableFrameworks() {
106
+ const templatesDir = path_1.default.join((0, package_root_1.getPackageRoot)(), "templates");
97
107
  if (!(await fs_extra_1.default.pathExists(templatesDir))) {
98
108
  return [];
99
109
  }
100
110
  const frameworkDirs = await fs_extra_1.default.readdir(templatesDir);
101
- const frameworks = frameworkDirs
111
+ return frameworkDirs
102
112
  .filter((dir) => dir !== "node_modules" && dir !== ".git")
103
113
  .map((dir) => ({
104
114
  name: dir,
105
115
  displayName: formatFrameworkName(dir),
106
116
  }));
107
- return frameworks;
117
+ }
118
+ async function getAvailableModules() {
119
+ return (0, module_loader_1.getAllModules)();
108
120
  }
109
121
  function formatFrameworkName(name) {
110
122
  return name
@@ -115,25 +127,3 @@ function formatFrameworkName(name) {
115
127
  function formatCategoryName(name) {
116
128
  return name.charAt(0).toUpperCase() + name.slice(1);
117
129
  }
118
- async function getAvailableModules(modulesDir) {
119
- if (!(await fs_extra_1.default.pathExists(modulesDir))) {
120
- return [];
121
- }
122
- const modules = [];
123
- const categories = await fs_extra_1.default.readdir(modulesDir);
124
- for (const category of categories) {
125
- const categoryPath = path_1.default.join(modulesDir, category);
126
- const stat = await fs_extra_1.default.stat(categoryPath);
127
- if (!stat.isDirectory())
128
- continue;
129
- const moduleDirs = await fs_extra_1.default.readdir(categoryPath);
130
- for (const moduleDir of moduleDirs) {
131
- const metadataPath = path_1.default.join(categoryPath, moduleDir, "module.json");
132
- if (await fs_extra_1.default.pathExists(metadataPath)) {
133
- const metadata = await fs_extra_1.default.readJSON(metadataPath);
134
- modules.push(metadata);
135
- }
136
- }
137
- }
138
- return modules;
139
- }
package/dist/index.js CHANGED
@@ -36,65 +36,51 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  const commander_1 = require("commander");
38
38
  const fs = __importStar(require("fs"));
39
- const fs_1 = require("fs");
40
39
  const path_1 = require("path");
41
40
  const add_1 = require("./cli/add");
42
41
  const create_1 = require("./cli/create");
43
42
  const doctor_1 = require("./cli/doctor");
44
43
  const list_1 = require("./cli/list");
44
+ const constants_1 = require("./lib/constants");
45
45
  const shared_1 = require("./lib/discovery/shared");
46
46
  const logger_1 = require("./lib/ui/logger");
47
+ const json_loader_1 = require("./lib/utils/json-loader");
47
48
  const package_root_1 = require("./lib/utils/package-root");
48
- const packageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, "../package.json"), "utf-8"));
49
+ const path_resolver_1 = require("./lib/utils/path-resolver");
50
+ const packageJson = (0, json_loader_1.loadJsonSync)((0, path_1.join)(__dirname, "../package.json"));
49
51
  function buildOptionHints() {
50
52
  try {
51
- const pkgRoot = (0, package_root_1.getPackageRoot)();
52
- const modulesDir = (0, path_1.join)(pkgRoot, "modules");
53
+ const databaseModulesPath = (0, path_resolver_1.getDatabaseModulesPath)();
54
+ const authModulesPath = (0, path_resolver_1.getAuthModulesPath)();
53
55
  const dbs = [];
54
56
  const auths = [];
55
- if (fs.existsSync((0, path_1.join)(modulesDir, "database"))) {
56
- for (const d of fs.readdirSync((0, path_1.join)(modulesDir, "database"))) {
57
- const moduleJson = (0, path_1.join)(modulesDir, "database", d, "module.json");
57
+ if (fs.existsSync(databaseModulesPath)) {
58
+ for (const d of fs.readdirSync(databaseModulesPath)) {
59
+ const moduleJson = (0, path_resolver_1.getModuleJsonPath)(constants_1.MODULE_CATEGORIES.DATABASE, d);
58
60
  if (fs.existsSync(moduleJson)) {
59
- try {
60
- const m = JSON.parse((0, fs_1.readFileSync)(moduleJson, "utf-8"));
61
- if (m && m.name === "prisma") {
62
- try {
63
- const providers = (0, shared_1.getPrismaProvidersFromGenerator)((0, package_root_1.getPackageRoot)());
64
- if (providers.length > 0) {
65
- for (const p of providers)
66
- dbs.push(`prisma-${p}`);
67
- }
68
- else {
69
- dbs.push("prisma");
70
- }
71
- }
72
- catch {
73
- dbs.push("prisma");
74
- }
61
+ const m = (0, json_loader_1.loadJsonSync)(moduleJson);
62
+ if (m && m.name === "prisma") {
63
+ const providers = (0, shared_1.getPrismaProvidersFromGenerator)((0, package_root_1.getPackageRoot)());
64
+ if (providers.length > 0) {
65
+ providers.forEach((p) => dbs.push(`prisma-${p}`));
75
66
  }
76
- else if (m && m.name) {
77
- dbs.push(m.name);
67
+ else {
68
+ dbs.push("prisma");
78
69
  }
79
70
  }
80
- catch {
81
- // ignore malformed module.json
71
+ else if (m && m.name) {
72
+ dbs.push(m.name);
82
73
  }
83
74
  }
84
75
  }
85
76
  }
86
- if (fs.existsSync((0, path_1.join)(modulesDir, "auth"))) {
87
- for (const a of fs.readdirSync((0, path_1.join)(modulesDir, "auth"))) {
88
- const moduleJson = (0, path_1.join)(modulesDir, "auth", a, "module.json");
77
+ if (fs.existsSync(authModulesPath)) {
78
+ for (const a of fs.readdirSync(authModulesPath)) {
79
+ const moduleJson = (0, path_resolver_1.getModuleJsonPath)(constants_1.MODULE_CATEGORIES.AUTH, a);
89
80
  if (fs.existsSync(moduleJson)) {
90
- try {
91
- const m = JSON.parse((0, fs_1.readFileSync)(moduleJson, "utf-8"));
92
- if (m && m.name)
93
- auths.push(m.name);
94
- }
95
- catch {
96
- // ignore malformed module.json
97
- }
81
+ const m = (0, json_loader_1.loadJsonSync)(moduleJson);
82
+ if (m && m.name)
83
+ auths.push(m.name);
98
84
  }
99
85
  }
100
86
  }
@@ -112,7 +98,7 @@ const program = new commander_1.Command();
112
98
  program
113
99
  .name("stackkit")
114
100
  .description("CLI for creating and managing StackKit projects")
115
- .version(packageJson.version)
101
+ .version(packageJson?.version || "0.0.0")
116
102
  .configureHelp({
117
103
  subcommandTerm: (cmd) => {
118
104
  const name = cmd.name();
@@ -129,7 +115,6 @@ program
129
115
  return name + " [options]";
130
116
  },
131
117
  });
132
- // Create command
133
118
  program
134
119
  .command("create [project-name]")
135
120
  .description("Create a new StackKit project")
@@ -152,7 +137,6 @@ program
152
137
  process.exit(1);
153
138
  }
154
139
  });
155
- // Add command
156
140
  program
157
141
  .command("add [module]")
158
142
  .description("Add a module or category to your existing project")
@@ -171,7 +155,6 @@ program
171
155
  process.exit(1);
172
156
  }
173
157
  });
174
- // Doctor command
175
158
  program
176
159
  .command("doctor")
177
160
  .description("Check project health and compatibility with StackKit modules")
@@ -187,7 +170,6 @@ program
187
170
  process.exit(1);
188
171
  }
189
172
  });
190
- // List command
191
173
  program
192
174
  .command("list")
193
175
  .description("List available frameworks and modules")
@@ -202,7 +184,6 @@ program
202
184
  process.exit(1);
203
185
  }
204
186
  });
205
- // Error handling
206
187
  program.on("command:*", () => {
207
188
  logger_1.logger.error(`Invalid command: ${program.args.join(" ")}`);
208
189
  logger_1.logger.log("Run stackkit --help for a list of available commands.");
@@ -0,0 +1,110 @@
1
+ export declare const PACKAGE_MANAGERS: {
2
+ PNPM: "pnpm";
3
+ NPM: "npm";
4
+ YARN: "yarn";
5
+ BUN: "bun";
6
+ };
7
+ export declare const LOCK_FILES: {
8
+ readonly pnpm: "pnpm-lock.yaml";
9
+ readonly yarn: "yarn.lock";
10
+ readonly bun: "bun.lockb";
11
+ readonly npm: "package-lock.json";
12
+ };
13
+ export declare const LOCK_FILES_ARRAY: readonly [{
14
+ readonly file: "pnpm-lock.yaml";
15
+ readonly pm: "pnpm";
16
+ }, {
17
+ readonly file: "yarn.lock";
18
+ readonly pm: "yarn";
19
+ }, {
20
+ readonly file: "bun.lockb";
21
+ readonly pm: "bun";
22
+ }, {
23
+ readonly file: "package-lock.json";
24
+ readonly pm: "npm";
25
+ }];
26
+ export declare const LANGUAGES: {
27
+ TYPESCRIPT: "typescript";
28
+ JAVASCRIPT: "javascript";
29
+ };
30
+ export declare const MODULE_CATEGORIES: {
31
+ DATABASE: "database";
32
+ AUTH: "auth";
33
+ FRAMEWORK: "framework";
34
+ };
35
+ export declare const DIRECTORY_NAMES: {
36
+ readonly MODULES: "modules";
37
+ readonly TEMPLATES: "templates";
38
+ readonly NODE_MODULES: "node_modules";
39
+ readonly GIT: ".git";
40
+ readonly PRISMA: "prisma";
41
+ readonly FILES: "files";
42
+ readonly SRC: "src";
43
+ readonly DIST: "dist";
44
+ readonly BIN: "bin";
45
+ };
46
+ export declare const FILE_NAMES: {
47
+ readonly PACKAGE_JSON: "package.json";
48
+ readonly TSCONFIG_JSON: "tsconfig.json";
49
+ readonly MODULE_JSON: "module.json";
50
+ readonly GENERATOR_JSON: "generator.json";
51
+ readonly TEMPLATE_JSON: "template.json";
52
+ readonly CONFIG_JSON: "config.json";
53
+ readonly ENV: ".env";
54
+ readonly ENV_LOCAL: ".env.local";
55
+ readonly ENV_EXAMPLE: ".env.example";
56
+ readonly GITIGNORE: ".gitignore";
57
+ readonly README: "README.md";
58
+ readonly SCHEMA_PRISMA: "schema.prisma";
59
+ };
60
+ export declare const ENV_FILES: readonly [".env", ".env.local"];
61
+ export declare const EXCLUDE_FROM_COPY: readonly ["template.json", "config.json", "node_modules", ".git"];
62
+ export declare const TIMEOUTS: {
63
+ readonly PACKAGE_INSTALL: 300000;
64
+ readonly GIT_INIT: 30000;
65
+ readonly RETRY_DELAY_BASE: 1000;
66
+ };
67
+ export declare const RETRY_CONFIG: {
68
+ readonly MAX_ATTEMPTS: 2;
69
+ readonly PACKAGE_ROOT_MAX_ATTEMPTS: 10;
70
+ };
71
+ export declare const ENV_PATTERNS: {
72
+ readonly KEY: RegExp;
73
+ readonly COMMENT: RegExp;
74
+ };
75
+ export declare const ROUTER_TYPES: {
76
+ readonly APP: "app";
77
+ readonly PAGES: "pages";
78
+ };
79
+ export declare const DISPLAY_NAMES: {
80
+ readonly database: "Database";
81
+ readonly auth: "Auth";
82
+ readonly framework: "Framework";
83
+ };
84
+ export declare const ERROR_MESSAGES: {
85
+ readonly NO_PACKAGE_JSON: "No package.json found in current directory or any parent directory.";
86
+ readonly INVALID_DIRECTORY: "Target directory already exists and is not empty.";
87
+ readonly INVALID_PROJECT_NAME: "Invalid project name. Please use a valid npm package name.";
88
+ readonly UNKNOWN_MODULE_TYPE: (module: string) => string;
89
+ readonly MODULE_NOT_FOUND: (moduleName: string) => string;
90
+ readonly TEMPLATE_NOT_FOUND: (framework: string) => string;
91
+ readonly GIT_INIT_FAILED: "Failed to initialize git repository";
92
+ readonly PACKAGE_INSTALL_FAILED: "Failed to install dependencies";
93
+ };
94
+ export declare const SUCCESS_MESSAGES: {
95
+ readonly PROJECT_CREATED: "✨ Project created successfully!";
96
+ readonly MODULE_ADDED: "✨ Module added successfully!";
97
+ readonly DEPENDENCIES_INSTALLED: "✓ Dependencies installed";
98
+ readonly GIT_INITIALIZED: "✓ Git repository initialized";
99
+ };
100
+ export declare const CLI_COLORS: {
101
+ readonly PRIMARY: "cyan";
102
+ readonly SUCCESS: "green";
103
+ readonly WARNING: "yellow";
104
+ readonly ERROR: "red";
105
+ readonly INFO: "blue";
106
+ readonly HEADER: "magenta";
107
+ };
108
+ export declare const PACKAGE_NAME: "stackkit";
109
+ export declare const DEFAULT_PACKAGE_MANAGER: "npm";
110
+ export declare const DEFAULT_LANGUAGE: "typescript";
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_LANGUAGE = exports.DEFAULT_PACKAGE_MANAGER = exports.PACKAGE_NAME = exports.CLI_COLORS = exports.SUCCESS_MESSAGES = exports.ERROR_MESSAGES = exports.DISPLAY_NAMES = exports.ROUTER_TYPES = exports.ENV_PATTERNS = exports.RETRY_CONFIG = exports.TIMEOUTS = exports.EXCLUDE_FROM_COPY = exports.ENV_FILES = exports.FILE_NAMES = exports.DIRECTORY_NAMES = exports.MODULE_CATEGORIES = exports.LANGUAGES = exports.LOCK_FILES_ARRAY = exports.LOCK_FILES = exports.PACKAGE_MANAGERS = void 0;
4
+ exports.PACKAGE_MANAGERS = {
5
+ PNPM: "pnpm",
6
+ NPM: "npm",
7
+ YARN: "yarn",
8
+ BUN: "bun",
9
+ };
10
+ exports.LOCK_FILES = {
11
+ [exports.PACKAGE_MANAGERS.PNPM]: "pnpm-lock.yaml",
12
+ [exports.PACKAGE_MANAGERS.YARN]: "yarn.lock",
13
+ [exports.PACKAGE_MANAGERS.BUN]: "bun.lockb",
14
+ [exports.PACKAGE_MANAGERS.NPM]: "package-lock.json",
15
+ };
16
+ // Array of lock files with package managers for iteration
17
+ exports.LOCK_FILES_ARRAY = [
18
+ { file: exports.LOCK_FILES.pnpm, pm: exports.PACKAGE_MANAGERS.PNPM },
19
+ { file: exports.LOCK_FILES.yarn, pm: exports.PACKAGE_MANAGERS.YARN },
20
+ { file: exports.LOCK_FILES.bun, pm: exports.PACKAGE_MANAGERS.BUN },
21
+ { file: exports.LOCK_FILES.npm, pm: exports.PACKAGE_MANAGERS.NPM },
22
+ ];
23
+ exports.LANGUAGES = {
24
+ TYPESCRIPT: "typescript",
25
+ JAVASCRIPT: "javascript",
26
+ };
27
+ exports.MODULE_CATEGORIES = {
28
+ DATABASE: "database",
29
+ AUTH: "auth",
30
+ FRAMEWORK: "framework",
31
+ };
32
+ exports.DIRECTORY_NAMES = {
33
+ MODULES: "modules",
34
+ TEMPLATES: "templates",
35
+ NODE_MODULES: "node_modules",
36
+ GIT: ".git",
37
+ PRISMA: "prisma",
38
+ FILES: "files",
39
+ SRC: "src",
40
+ DIST: "dist",
41
+ BIN: "bin",
42
+ };
43
+ exports.FILE_NAMES = {
44
+ PACKAGE_JSON: "package.json",
45
+ TSCONFIG_JSON: "tsconfig.json",
46
+ MODULE_JSON: "module.json",
47
+ GENERATOR_JSON: "generator.json",
48
+ TEMPLATE_JSON: "template.json",
49
+ CONFIG_JSON: "config.json",
50
+ ENV: ".env",
51
+ ENV_LOCAL: ".env.local",
52
+ ENV_EXAMPLE: ".env.example",
53
+ GITIGNORE: ".gitignore",
54
+ README: "README.md",
55
+ SCHEMA_PRISMA: "schema.prisma",
56
+ };
57
+ exports.ENV_FILES = [exports.FILE_NAMES.ENV, exports.FILE_NAMES.ENV_LOCAL];
58
+ exports.EXCLUDE_FROM_COPY = [
59
+ exports.FILE_NAMES.TEMPLATE_JSON,
60
+ exports.FILE_NAMES.CONFIG_JSON,
61
+ exports.DIRECTORY_NAMES.NODE_MODULES,
62
+ exports.DIRECTORY_NAMES.GIT,
63
+ ];
64
+ exports.TIMEOUTS = {
65
+ PACKAGE_INSTALL: 300000, // 5 minutes in milliseconds
66
+ GIT_INIT: 30000, // 30 seconds
67
+ RETRY_DELAY_BASE: 1000, // 1 second base delay for retries
68
+ };
69
+ exports.RETRY_CONFIG = {
70
+ MAX_ATTEMPTS: 2,
71
+ PACKAGE_ROOT_MAX_ATTEMPTS: 10,
72
+ };
73
+ exports.ENV_PATTERNS = {
74
+ KEY: /^[A-Z_][A-Z0-9_]*$/,
75
+ COMMENT: /^\s*#/,
76
+ };
77
+ exports.ROUTER_TYPES = {
78
+ APP: "app",
79
+ PAGES: "pages",
80
+ };
81
+ exports.DISPLAY_NAMES = {
82
+ [exports.MODULE_CATEGORIES.DATABASE]: "Database",
83
+ [exports.MODULE_CATEGORIES.AUTH]: "Auth",
84
+ [exports.MODULE_CATEGORIES.FRAMEWORK]: "Framework",
85
+ };
86
+ exports.ERROR_MESSAGES = {
87
+ NO_PACKAGE_JSON: "No package.json found in current directory or any parent directory.",
88
+ INVALID_DIRECTORY: "Target directory already exists and is not empty.",
89
+ INVALID_PROJECT_NAME: "Invalid project name. Please use a valid npm package name.",
90
+ UNKNOWN_MODULE_TYPE: (module) => `Unknown module type "${module}". Use "${exports.MODULE_CATEGORIES.DATABASE}" or "${exports.MODULE_CATEGORIES.AUTH}", or specify a provider directly.`,
91
+ MODULE_NOT_FOUND: (moduleName) => `Module "${moduleName}" not found.`,
92
+ TEMPLATE_NOT_FOUND: (framework) => `Base template not found for framework: ${framework}`,
93
+ GIT_INIT_FAILED: "Failed to initialize git repository",
94
+ PACKAGE_INSTALL_FAILED: "Failed to install dependencies",
95
+ };
96
+ exports.SUCCESS_MESSAGES = {
97
+ PROJECT_CREATED: "✨ Project created successfully!",
98
+ MODULE_ADDED: "✨ Module added successfully!",
99
+ DEPENDENCIES_INSTALLED: "✓ Dependencies installed",
100
+ GIT_INITIALIZED: "✓ Git repository initialized",
101
+ };
102
+ exports.CLI_COLORS = {
103
+ PRIMARY: "cyan",
104
+ SUCCESS: "green",
105
+ WARNING: "yellow",
106
+ ERROR: "red",
107
+ INFO: "blue",
108
+ HEADER: "magenta",
109
+ };
110
+ exports.PACKAGE_NAME = "stackkit";
111
+ exports.DEFAULT_PACKAGE_MANAGER = exports.PACKAGE_MANAGERS.NPM;
112
+ exports.DEFAULT_LANGUAGE = exports.LANGUAGES.TYPESCRIPT;