@reliverse/dler 1.7.69 → 1.7.71

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 (77) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +74 -98
  3. package/bin/app/build/cmd.js +0 -2
  4. package/bin/app/build/postbuild.js +7 -3
  5. package/bin/app/cmds.d.ts +1 -0
  6. package/bin/app/cmds.js +1 -0
  7. package/bin/app/get/cmd.d.ts +1 -0
  8. package/bin/app/get/cmd.js +1 -0
  9. package/bin/app/remove/cmd.d.ts +6 -0
  10. package/bin/app/remove/cmd.js +185 -1
  11. package/bin/app/update/cmd.d.ts +11 -0
  12. package/bin/app/update/cmd.js +277 -2
  13. package/bin/app/upgrade/cmd.d.ts +8 -0
  14. package/bin/app/upgrade/cmd.js +295 -0
  15. package/bin/cli.js +16 -10
  16. package/bin/libs/cfg/cfg-impl/cfg-consts.d.ts +1 -1
  17. package/bin/libs/cfg/cfg-impl/cfg-consts.js +1 -1
  18. package/bin/libs/cfg/cfg-mod.d.ts +1 -23
  19. package/bin/libs/cfg/cfg-mod.js +1 -85
  20. package/bin/libs/get/get-mod.d.ts +37 -0
  21. package/bin/libs/get/get-mod.js +509 -0
  22. package/bin/libs/sdk/sdk-impl/config/default.d.ts +1 -1
  23. package/bin/libs/sdk/sdk-impl/config/default.js +1 -1
  24. package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
  25. package/bin/libs/sdk/sdk-impl/config/init.d.ts +1 -0
  26. package/bin/libs/sdk/sdk-impl/config/init.js +98 -5
  27. package/bin/libs/sdk/sdk-impl/config/load.js +4 -4
  28. package/bin/libs/sdk/sdk-impl/utils/exec/exec-mod.js +0 -8
  29. package/bin/libs/sdk/sdk-mod.d.ts +1 -1
  30. package/bin/libs/sdk/sdk-mod.js +1 -1
  31. package/bin/mod.d.ts +1 -1
  32. package/bin/mod.js +1 -1
  33. package/package.json +3 -9
  34. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-biome.d.ts +0 -2
  35. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-biome.js +0 -34
  36. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-comments.d.ts +0 -1
  37. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-comments.js +0 -57
  38. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-consts.d.ts +0 -34
  39. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-consts.js +0 -36
  40. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-content.d.ts +0 -14
  41. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-content.js +0 -15
  42. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-core.d.ts +0 -14
  43. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-core.js +0 -63
  44. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-create.d.ts +0 -36
  45. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-create.js +0 -275
  46. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-def-utils.d.ts +0 -6
  47. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-def-utils.js +0 -225
  48. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-default.d.ts +0 -3
  49. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-default.js +0 -155
  50. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.d.ts +0 -125
  51. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.js +0 -4
  52. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-detect.d.ts +0 -23
  53. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-detect.js +0 -347
  54. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-gen-cfg.d.ts +0 -3
  55. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-gen-cfg.js +0 -186
  56. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-migrate.d.ts +0 -5
  57. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-migrate.js +0 -56
  58. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-path.d.ts +0 -11
  59. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-path.js +0 -33
  60. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-prompts.d.ts +0 -5
  61. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-prompts.js +0 -12
  62. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-read.d.ts +0 -11
  63. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-read.js +0 -84
  64. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-repair.d.ts +0 -16
  65. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-repair.js +0 -137
  66. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-schema.d.ts +0 -130
  67. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-schema.js +0 -438
  68. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-types.d.ts +0 -75
  69. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-types.js +0 -0
  70. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-unstable.d.ts +0 -11
  71. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-unstable.js +0 -41
  72. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-update.d.ts +0 -10
  73. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-update.js +0 -152
  74. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-utils.d.ts +0 -17
  75. package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-utils.js +0 -86
  76. package/bin/libs/cfg/cfg-impl/rse-config/rse-mod.d.ts +0 -20
  77. package/bin/libs/cfg/cfg-impl/rse-config/rse-mod.js +0 -20
@@ -1,275 +0,0 @@
1
- import path from "@reliverse/pathkit";
2
- import fs from "@reliverse/relifso";
3
- import { relinka } from "@reliverse/relinka";
4
- import { confirmPrompt } from "@reliverse/rempts";
5
- import { Value } from "@sinclair/typebox/value";
6
- import { execaCommand } from "execa";
7
- async function addDevDependency(pkgName, opts) {
8
- const pkgPath = path.join(opts.cwd, "package.json");
9
- let pkg;
10
- try {
11
- const { readPackageJSON } = await import("pkg-types");
12
- pkg = await readPackageJSON(pkgPath);
13
- } catch {
14
- if (await fs.pathExists(pkgPath)) {
15
- pkg = JSON.parse(await fs.readFile(pkgPath, "utf8"));
16
- } else {
17
- pkg = {};
18
- }
19
- }
20
- if (!pkg.devDependencies) pkg.devDependencies = {};
21
- if (!pkg.devDependencies[pkgName]) {
22
- pkg.devDependencies[pkgName] = "latest";
23
- await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
24
- relinka("log", `Added ${pkgName} to devDependencies in ${pkgPath}`);
25
- } else {
26
- relinka("log", `${pkgName} already present in devDependencies in ${pkgPath}`);
27
- }
28
- }
29
- import { injectSectionComments } from "./rse-comments.js";
30
- import { cliDomainDocs } from "./rse-consts.js";
31
- import { UNKNOWN_VALUE, rseName, DEFAULT_DOMAIN, RSE_SCHEMA_DEV } from "./rse-consts.js";
32
- import { generateDefaultRulesForProject, getDefaultRseConfig } from "./rse-def-utils.js";
33
- import { DEFAULT_CONFIG_RSE } from "./rse-default.js";
34
- import { getPackageJson, detectFeatures } from "./rse-detect.js";
35
- import { getRseConfigPath } from "./rse-path.js";
36
- import { readRseConfig } from "./rse-read.js";
37
- import { rseSchema } from "./rse-schema.js";
38
- import {
39
- objectToCodeString,
40
- atomicWriteFile,
41
- cleanGitHubUrl,
42
- getBackupAndTempPaths,
43
- updateTsConfigInclude
44
- } from "./rse-utils.js";
45
- export async function writeRseConfig(configPath, config, isDev, skipInstallPrompt = false, customPathToTypes) {
46
- if (await fs.pathExists(configPath)) {
47
- relinka("verbose", `Config file already exists at ${configPath}, skipping creation`);
48
- return;
49
- }
50
- const configDir = path.dirname(configPath);
51
- if (!await fs.pathExists(configDir)) {
52
- await fs.mkdir(configDir, { recursive: true });
53
- }
54
- if (configPath.endsWith(".ts")) {
55
- const { backupPath: backupPath2, tempPath: tempPath2 } = getBackupAndTempPaths(configPath);
56
- try {
57
- relinka("verbose", `Starting config write process for: ${configPath}`);
58
- relinka("verbose", `Backup path: ${backupPath2}`);
59
- relinka("verbose", `Temp path: ${tempPath2}`);
60
- for (const file of [backupPath2, tempPath2]) {
61
- if (await fs.pathExists(file)) {
62
- relinka("verbose", `Removing existing file: ${file}`);
63
- await fs.remove(file);
64
- }
65
- }
66
- if (await fs.pathExists(configPath)) {
67
- relinka("verbose", `Creating backup of existing config at: ${backupPath2}`);
68
- await fs.copy(configPath, backupPath2);
69
- } else {
70
- relinka("verbose", "No existing config found, skipping backup creation");
71
- }
72
- const objectLiteral = objectToCodeString(config, 0);
73
- const objectLiteralWithComments = injectSectionComments(objectLiteral);
74
- let importPath;
75
- if (customPathToTypes) {
76
- importPath = customPathToTypes;
77
- } else if (isDev) {
78
- importPath = "~/mod";
79
- } else {
80
- importPath = "@reliverse/cfg";
81
- }
82
- const fileContent2 = `import { defineConfigRse } from "${importPath}";
83
- export default defineConfigRse(${objectLiteralWithComments});
84
- `;
85
- await atomicWriteFile(configPath, fileContent2, backupPath2, tempPath2);
86
- await updateTsConfigInclude(path.dirname(configPath));
87
- if (!isDev && !skipInstallPrompt) {
88
- await addDevDependency("@reliverse/cfg", {
89
- cwd: path.dirname(configPath)
90
- });
91
- relinka("verbose", "TS config written successfully");
92
- const shouldRunInstall = await confirmPrompt({
93
- title: "Run `bun install` now to install '@reliverse/cfg'?",
94
- defaultValue: true
95
- });
96
- if (shouldRunInstall) {
97
- await execaCommand("bun install", {
98
- cwd: path.dirname(configPath),
99
- stdio: "inherit"
100
- });
101
- } else {
102
- relinka(
103
- "success",
104
- "Please run `bun install` later, then use `rse cli` again to continue."
105
- );
106
- process.exit(0);
107
- }
108
- } else {
109
- relinka("verbose", "TS config written successfully");
110
- }
111
- return;
112
- } catch (error) {
113
- relinka("error", "Failed to write TS config:", String(error));
114
- if (await fs.pathExists(backupPath2) && !await fs.pathExists(configPath)) {
115
- try {
116
- await fs.copy(backupPath2, configPath);
117
- relinka("warn", "Restored TS config from backup after failed write");
118
- } catch (restoreError) {
119
- relinka("error", "Failed to restore TS config from backup:", String(restoreError));
120
- }
121
- }
122
- if (await fs.pathExists(tempPath2)) {
123
- await fs.remove(tempPath2);
124
- }
125
- throw error;
126
- }
127
- }
128
- if (!Value.Check(rseSchema, config)) {
129
- const issues = [...Value.Errors(rseSchema, config)].map(
130
- (err) => `Path "${err.path}": ${err.message}`
131
- );
132
- relinka("error", "Invalid config:", issues.join("; "));
133
- throw new Error(`Invalid config: ${issues.join("; ")}`);
134
- }
135
- let fileContent = JSON.stringify(config, null, 2);
136
- fileContent = injectSectionComments(fileContent);
137
- const { backupPath, tempPath } = getBackupAndTempPaths(configPath);
138
- if (await fs.pathExists(configPath)) {
139
- await fs.copy(configPath, backupPath);
140
- }
141
- await atomicWriteFile(configPath, fileContent, backupPath, tempPath);
142
- relinka("verbose", "Config written successfully");
143
- }
144
- export async function createRseConfig(projectPath, githubUsername, isDev, overrides) {
145
- const defaultRules = await generateDefaultRulesForProject(projectPath, isDev);
146
- const effectiveProjectName = defaultRules?.projectName ?? path.basename(projectPath);
147
- let effectiveAuthorName = defaultRules?.projectAuthor ?? UNKNOWN_VALUE;
148
- const effectiveDomain = defaultRules?.projectDomain ?? (effectiveProjectName === rseName ? cliDomainDocs : DEFAULT_DOMAIN);
149
- if (effectiveAuthorName === "blefnk" && isDev) {
150
- effectiveAuthorName = "rse";
151
- }
152
- await generateRseConfig({
153
- projectName: effectiveProjectName,
154
- frontendUsername: effectiveAuthorName,
155
- deployService: "vercel",
156
- primaryDomain: effectiveDomain,
157
- projectPath,
158
- githubUsername,
159
- isDev,
160
- overrides
161
- });
162
- relinka(
163
- "verbose",
164
- defaultRules ? "Created config based on detected project settings." : "Created initial config. Please review and adjust as needed."
165
- );
166
- }
167
- export async function generateRseConfig({
168
- projectName,
169
- frontendUsername,
170
- deployService,
171
- primaryDomain,
172
- projectPath,
173
- githubUsername,
174
- enableI18n = false,
175
- overwrite = false,
176
- isDev,
177
- configInfo,
178
- customOutputPath,
179
- customFilename,
180
- skipInstallPrompt = false,
181
- customPathToTypes,
182
- overrides
183
- }) {
184
- const packageJson = await getPackageJson(projectPath);
185
- if (frontendUsername === "blefnk" && isDev) {
186
- frontendUsername = "rse";
187
- }
188
- const defaultConfig = await getDefaultRseConfig(
189
- projectPath,
190
- isDev,
191
- projectName,
192
- frontendUsername
193
- );
194
- defaultConfig.projectName = projectName;
195
- defaultConfig.projectAuthor = frontendUsername;
196
- defaultConfig.projectDescription = packageJson?.description ?? defaultConfig.projectDescription ?? UNKNOWN_VALUE;
197
- defaultConfig.version = packageJson?.version ?? defaultConfig.version;
198
- defaultConfig.projectLicense = packageJson?.license ?? defaultConfig.projectLicense;
199
- const projectNameWithoutAt = projectName?.replace("@", "");
200
- defaultConfig.projectRepository = packageJson?.repository ? typeof packageJson.repository === "string" ? cleanGitHubUrl(packageJson.repository) : cleanGitHubUrl(packageJson.repository.url) : githubUsername && projectName ? `https://github.com/${projectNameWithoutAt}` : DEFAULT_DOMAIN;
201
- defaultConfig.projectGitService = "github";
202
- defaultConfig.projectDeployService = deployService;
203
- defaultConfig.projectDomain = primaryDomain ? `https://${primaryDomain.replace(/^https?:\/\//, "")}` : projectName ? `https://${projectName}.vercel.app` : UNKNOWN_VALUE;
204
- defaultConfig.features = await detectFeatures(projectPath, packageJson);
205
- defaultConfig.features.i18n = enableI18n ?? false;
206
- defaultConfig.multipleRepoCloneMode = false;
207
- defaultConfig.customUserFocusedRepos = [];
208
- defaultConfig.customDevsFocusedRepos = [];
209
- defaultConfig.hideRepoSuggestions = false;
210
- defaultConfig.customReposOnNewProject = false;
211
- defaultConfig.envComposerOpenBrowser = true;
212
- defaultConfig.gitBehavior = "prompt";
213
- defaultConfig.deployBehavior = "prompt";
214
- defaultConfig.depsBehavior = "prompt";
215
- defaultConfig.i18nBehavior = "prompt";
216
- defaultConfig.scriptsBehavior = "prompt";
217
- defaultConfig.skipPromptsUseAutoBehavior = false;
218
- defaultConfig.codeStyle = {
219
- ...defaultConfig.codeStyle,
220
- dontRemoveComments: true,
221
- shouldAddComments: true,
222
- typeOrInterface: "type",
223
- importOrRequire: "import",
224
- quoteMark: "double",
225
- semicolons: true,
226
- lineWidth: 80,
227
- indentStyle: "space",
228
- indentSize: 2,
229
- importSymbol: "~",
230
- trailingComma: "all",
231
- bracketSpacing: true,
232
- arrowParens: "always",
233
- tabWidth: 2,
234
- jsToTs: false,
235
- cjsToEsm: false,
236
- modernize: {
237
- replaceFs: false,
238
- replacePath: false,
239
- replaceHttp: false,
240
- replaceProcess: false,
241
- replaceConsole: false,
242
- replaceEvents: false
243
- }
244
- };
245
- let effectiveConfigPath;
246
- if (customOutputPath && customFilename) {
247
- effectiveConfigPath = path.join(customOutputPath, customFilename);
248
- } else {
249
- const configPathInfo = configInfo ?? await getRseConfigPath(projectPath, isDev, skipInstallPrompt);
250
- effectiveConfigPath = configPathInfo.configPath;
251
- }
252
- let existingContent = null;
253
- if (!overwrite && await fs.pathExists(effectiveConfigPath)) {
254
- try {
255
- existingContent = await readRseConfig(effectiveConfigPath, isDev);
256
- } catch {
257
- }
258
- }
259
- const effectiveConfig = {
260
- ...DEFAULT_CONFIG_RSE,
261
- ...existingContent,
262
- ...defaultConfig,
263
- ...overrides
264
- };
265
- if (isDev) {
266
- effectiveConfig.$schema = RSE_SCHEMA_DEV;
267
- }
268
- await writeRseConfig(
269
- effectiveConfigPath,
270
- effectiveConfig,
271
- isDev,
272
- skipInstallPrompt,
273
- customPathToTypes
274
- );
275
- }
@@ -1,6 +0,0 @@
1
- import type { RseConfig } from "./rse-types";
2
- /**
3
- * Generating a Default Config and Merging with Detected Data
4
- */
5
- export declare function getDefaultRseConfig(projectPath: string, isDev: boolean, projectName?: string, projectAuthor?: string): Promise<RseConfig>;
6
- export declare function generateDefaultRulesForProject(projectPath: string, isDev: boolean): Promise<RseConfig | null>;
@@ -1,225 +0,0 @@
1
- import path from "@reliverse/pathkit";
2
- import fs from "@reliverse/relifso";
3
- import { getUserPkgManager, runtimeInfo } from "@reliverse/runtime";
4
- import { safeDestr } from "destr";
5
- import { readPackageJSON } from "pkg-types";
6
- import { getBiomeConfig } from "./rse-biome.js";
7
- import { DEFAULT_DOMAIN, UNKNOWN_VALUE, rseName, cliDomainDocs } from "./rse-consts.js";
8
- import { DEFAULT_CONFIG_RSE } from "./rse-default.js";
9
- import { detectFeatures, detectProjectFramework, getPackageJsonSafe } from "./rse-detect.js";
10
- export async function getDefaultRseConfig(projectPath, isDev, projectName, projectAuthor) {
11
- const packageJson = await getPackageJsonSafe(projectPath);
12
- const effectiveProjectName = packageJson?.name ?? projectName ?? UNKNOWN_VALUE;
13
- let effectiveAuthorName = typeof packageJson?.author === "object" ? packageJson.author?.name ?? projectAuthor : packageJson?.author ?? projectAuthor ?? UNKNOWN_VALUE;
14
- if (effectiveAuthorName === "blefnk" && isDev) {
15
- effectiveAuthorName = "reliverse";
16
- }
17
- const biomeConfig = await getBiomeConfig(projectPath);
18
- const detectedPkgManager = await getUserPkgManager(projectPath);
19
- const packageJsonPath = path.join(projectPath, "package.json");
20
- let packageData = {
21
- name: effectiveProjectName,
22
- author: effectiveAuthorName
23
- };
24
- if (await fs.pathExists(packageJsonPath)) {
25
- try {
26
- packageData = await readPackageJSON(projectPath);
27
- } catch {
28
- }
29
- }
30
- const detectedProjectFramework = await detectProjectFramework(projectPath);
31
- return {
32
- ...DEFAULT_CONFIG_RSE,
33
- projectName: effectiveProjectName,
34
- projectAuthor: effectiveAuthorName,
35
- projectDescription: packageData.description ?? UNKNOWN_VALUE,
36
- version: packageData.version ?? "0.1.0",
37
- projectLicense: packageData.license ?? "MIT",
38
- projectState: "creating",
39
- projectRepository: typeof packageData.repository === "string" ? packageData.repository : packageData.repository?.url ?? DEFAULT_DOMAIN,
40
- projectDomain: effectiveProjectName === rseName ? cliDomainDocs : DEFAULT_DOMAIN,
41
- projectGitService: "github",
42
- projectDeployService: "vercel",
43
- repoBranch: "main",
44
- projectFramework: detectedProjectFramework ?? UNKNOWN_VALUE,
45
- projectPackageManager: detectedPkgManager.packageManager,
46
- projectRuntime: ["node", "deno", "bun"].includes(runtimeInfo?.name ?? "") ? runtimeInfo?.name : "node",
47
- codeStyle: {
48
- ...DEFAULT_CONFIG_RSE.codeStyle,
49
- lineWidth: biomeConfig?.lineWidth ?? 80,
50
- indentSize: biomeConfig?.indentWidth ?? 2,
51
- tabWidth: biomeConfig?.indentWidth ?? 2
52
- }
53
- };
54
- }
55
- export async function generateDefaultRulesForProject(projectPath, isDev) {
56
- const projectCategory = await detectProjectFramework(projectPath);
57
- const packageJsonPath = path.join(projectPath, "package.json");
58
- let packageJson = {};
59
- if (await fs.pathExists(packageJsonPath)) {
60
- try {
61
- packageJson = safeDestr(await fs.readFile(packageJsonPath, "utf-8"));
62
- } catch {
63
- }
64
- }
65
- const rules = await getDefaultRseConfig(projectPath, isDev);
66
- if (!projectCategory) {
67
- rules.features = {
68
- ...DEFAULT_CONFIG_RSE.features,
69
- language: ["typescript"],
70
- themes: ["default"]
71
- };
72
- rules.preferredLibraries = {
73
- ...DEFAULT_CONFIG_RSE.preferredLibraries,
74
- databaseLibrary: "drizzle",
75
- authentication: "better-auth"
76
- };
77
- return rules;
78
- }
79
- const deps = {
80
- ...packageJson?.dependencies ?? {},
81
- ...packageJson?.devDependencies ?? {}
82
- };
83
- const hasPrismaFile = await fs.pathExists(path.join(projectPath, "prisma/schema.prisma"));
84
- const hasDrizzleFile = await fs.pathExists(path.join(projectPath, "drizzle.config.ts"));
85
- const hasNextAuthDir = await fs.pathExists(
86
- path.join(projectPath, "src/app/api/auth/[...nextauth]")
87
- );
88
- const hasBetterAuthFile = await fs.pathExists(
89
- path.join(projectPath, "src/app/api/auth/[...all]/route.ts")
90
- );
91
- const hasShadcnUi = await fs.pathExists(path.join(projectPath, "components/ui"));
92
- const hasClerk = "@clerk/nextjs" in deps;
93
- const hasBetterAuth = "better-auth" in deps && hasBetterAuthFile;
94
- const hasAuth0 = "@auth0/nextjs-auth0" in deps;
95
- const hasSupabase = "@supabase/supabase-js" in deps;
96
- const hasPrisma = "@prisma/client" in deps || hasPrismaFile;
97
- const hasDrizzle = "drizzle-orm" in deps || hasDrizzleFile;
98
- const hasZustand = "zustand" in deps;
99
- const hasJotai = "jotai" in deps;
100
- const hasRedux = "@reduxjs/toolkit" in deps || "redux" in deps;
101
- const hasReactHookForm = "react-hook-form" in deps;
102
- const hasFormik = "formik" in deps;
103
- const hasTailwind = "tailwindcss" in deps;
104
- const hasStyledComponents = "styled-components" in deps;
105
- const hasCssModules = packageJson?.dependencies && Object.keys(deps).some((key) => key.includes("css-loader") || key.includes("css-modules"));
106
- const hasSass = "sass" in deps || "node-sass" in deps;
107
- const _hasChakraUi = "@chakra-ui/react" in deps;
108
- const _hasMaterialUi = "@mui/material" in deps;
109
- const _hasBunTest = packageJson?.scripts && Object.values(packageJson.scripts).some(
110
- (script) => script && typeof script === "string" && script.includes("bun test")
111
- );
112
- const _hasVitest = "vitest" in deps;
113
- const hasJest = "jest" in deps;
114
- const _hasPlaywright = "@playwright/test" in deps;
115
- const _hasCypress = "cypress" in deps;
116
- const hasHono = "hono" in deps;
117
- const hasTrpc = "@trpc/server" in deps;
118
- const hasGraphql = "graphql" in deps || "apollo-server" in deps;
119
- const hasRest = await fs.pathExists(path.join(projectPath, "src/api")) || await fs.pathExists(path.join(projectPath, "src/app/api"));
120
- const hasPg = "pg" in deps || "@neondatabase/serverless" in deps;
121
- const hasMysql = "mysql" in deps || "mysql2" in deps;
122
- const hasSqlite = "sqlite" in deps || "sqlite3" in deps || "better-sqlite3" in deps;
123
- const hasMongo = "mongodb" in deps || "mongoose" in deps;
124
- const hasZod = "zod" in deps;
125
- const hasTypebox = "@sinclair/typebox" in deps;
126
- const hasValibot = "valibot" in deps;
127
- rules.features = await detectFeatures(projectPath, packageJson);
128
- if (!rules.preferredLibraries) {
129
- rules.preferredLibraries = { ...DEFAULT_CONFIG_RSE.preferredLibraries };
130
- }
131
- if (hasDrizzle) {
132
- rules.preferredLibraries.databaseLibrary = "drizzle";
133
- } else if (hasPrisma) {
134
- rules.preferredLibraries.databaseLibrary = "prisma";
135
- } else if (hasSupabase) {
136
- rules.preferredLibraries.databaseLibrary = "supabase";
137
- }
138
- if (hasDrizzleFile) {
139
- const drizzleConfigPath = path.join(projectPath, "drizzle.config.ts");
140
- const content = await fs.readFile(drizzleConfigPath, "utf-8");
141
- if (content.includes("postgres")) {
142
- rules.preferredLibraries.databaseProvider = "pg";
143
- } else if (content.includes("sqlite")) {
144
- rules.preferredLibraries.databaseProvider = "sqlite";
145
- } else if (content.includes("mysql")) {
146
- rules.preferredLibraries.databaseProvider = "mysql";
147
- }
148
- } else if (hasPg) {
149
- rules.preferredLibraries.databaseProvider = "pg";
150
- } else if (hasMysql) {
151
- rules.preferredLibraries.databaseProvider = "mysql";
152
- } else if (hasSqlite) {
153
- rules.preferredLibraries.databaseProvider = "sqlite";
154
- } else if (hasMongo) {
155
- rules.preferredLibraries.databaseProvider = "mongodb";
156
- }
157
- if (hasNextAuthDir) {
158
- rules.preferredLibraries.authentication = "next-auth";
159
- } else if (hasClerk) {
160
- rules.preferredLibraries.authentication = "clerk";
161
- } else if (hasBetterAuth) {
162
- rules.preferredLibraries.authentication = "better-auth";
163
- } else if (hasAuth0) {
164
- rules.preferredLibraries.authentication = "auth0";
165
- } else if (hasSupabase) {
166
- rules.preferredLibraries.authentication = "supabase-auth";
167
- }
168
- if (hasZustand) {
169
- rules.preferredLibraries.stateManagement = "zustand";
170
- } else if (hasJotai) {
171
- rules.preferredLibraries.stateManagement = "jotai";
172
- } else if (hasRedux) {
173
- rules.preferredLibraries.stateManagement = "redux-toolkit";
174
- }
175
- if (hasReactHookForm) {
176
- rules.preferredLibraries.formManagement = "react-hook-form";
177
- rules.preferredLibraries.forms = "react-hook-form";
178
- } else if (hasFormik) {
179
- rules.preferredLibraries.formManagement = "formik";
180
- }
181
- if (hasTailwind) {
182
- rules.preferredLibraries.styling = "tailwind";
183
- } else if (hasStyledComponents) {
184
- rules.preferredLibraries.styling = "styled-components";
185
- } else if (hasCssModules) {
186
- rules.preferredLibraries.styling = "css-modules";
187
- } else if (hasSass) {
188
- rules.preferredLibraries.styling = "sass";
189
- }
190
- if (hasShadcnUi) {
191
- rules.preferredLibraries.uiComponents = "shadcn-ui";
192
- } else if (_hasChakraUi) {
193
- rules.preferredLibraries.uiComponents = "chakra-ui";
194
- } else if (_hasMaterialUi) {
195
- rules.preferredLibraries.uiComponents = "material-ui";
196
- }
197
- if (_hasBunTest) {
198
- rules.preferredLibraries.testing = "bun";
199
- } else if (_hasVitest) {
200
- rules.preferredLibraries.testing = "vitest";
201
- } else if (hasJest) {
202
- rules.preferredLibraries.testing = "jest";
203
- } else if (_hasPlaywright) {
204
- rules.preferredLibraries.testing = "playwright";
205
- } else if (_hasCypress) {
206
- rules.preferredLibraries.testing = "cypress";
207
- }
208
- if (hasHono) {
209
- rules.preferredLibraries.api = "hono";
210
- } else if (hasTrpc) {
211
- rules.preferredLibraries.api = "trpc";
212
- } else if (hasGraphql) {
213
- rules.preferredLibraries.api = "graphql";
214
- } else if (hasRest) {
215
- rules.preferredLibraries.api = "rest";
216
- }
217
- if (hasZod) {
218
- rules.preferredLibraries.validation = "zod";
219
- } else if (hasTypebox) {
220
- rules.preferredLibraries.validation = "typebox";
221
- } else if (hasValibot) {
222
- rules.preferredLibraries.validation = "valibot";
223
- }
224
- return rules;
225
- }
@@ -1,3 +0,0 @@
1
- import type { ProjectFramework, RseConfig } from "./rse-types";
2
- export declare const DEFAULT_CONFIG_RSE: RseConfig;
3
- export declare const PROJECT_FRAMEWORK_FILES: Record<ProjectFramework, string[]>;
@@ -1,155 +0,0 @@
1
- import { isBunPM, runtimeInfo } from "@reliverse/runtime";
2
- import { DEFAULT_DOMAIN, RSE_SCHEMA_URL, UNKNOWN_VALUE } from "./rse-consts.js";
3
- export const DEFAULT_CONFIG_RSE = {
4
- $schema: RSE_SCHEMA_URL,
5
- projectName: UNKNOWN_VALUE,
6
- projectAuthor: UNKNOWN_VALUE,
7
- projectDescription: UNKNOWN_VALUE,
8
- version: "0.1.0",
9
- projectLicense: "MIT",
10
- projectState: "creating",
11
- projectRepository: DEFAULT_DOMAIN,
12
- projectDomain: DEFAULT_DOMAIN,
13
- projectCategory: UNKNOWN_VALUE,
14
- projectSubcategory: UNKNOWN_VALUE,
15
- projectTemplate: UNKNOWN_VALUE,
16
- projectTemplateDate: UNKNOWN_VALUE,
17
- projectArchitecture: UNKNOWN_VALUE,
18
- repoPrivacy: UNKNOWN_VALUE,
19
- projectGitService: "github",
20
- projectDeployService: "vercel",
21
- repoBranch: "main",
22
- projectFramework: "nextjs",
23
- projectPackageManager: await isBunPM() ? "bun" : "npm",
24
- projectRuntime: ["node", "deno", "bun"].includes(runtimeInfo?.name ?? "") ? runtimeInfo?.name : "node",
25
- preferredLibraries: {
26
- stateManagement: UNKNOWN_VALUE,
27
- formManagement: UNKNOWN_VALUE,
28
- styling: UNKNOWN_VALUE,
29
- uiComponents: UNKNOWN_VALUE,
30
- testing: UNKNOWN_VALUE,
31
- authentication: UNKNOWN_VALUE,
32
- databaseLibrary: UNKNOWN_VALUE,
33
- databaseProvider: UNKNOWN_VALUE,
34
- api: UNKNOWN_VALUE,
35
- linting: UNKNOWN_VALUE,
36
- formatting: UNKNOWN_VALUE,
37
- payment: UNKNOWN_VALUE,
38
- analytics: UNKNOWN_VALUE,
39
- monitoring: UNKNOWN_VALUE,
40
- logging: UNKNOWN_VALUE,
41
- forms: UNKNOWN_VALUE,
42
- notifications: UNKNOWN_VALUE,
43
- search: UNKNOWN_VALUE,
44
- uploads: UNKNOWN_VALUE,
45
- validation: UNKNOWN_VALUE,
46
- documentation: UNKNOWN_VALUE,
47
- icons: UNKNOWN_VALUE,
48
- mail: UNKNOWN_VALUE,
49
- cache: UNKNOWN_VALUE,
50
- storage: UNKNOWN_VALUE,
51
- cdn: UNKNOWN_VALUE,
52
- cms: UNKNOWN_VALUE,
53
- i18n: UNKNOWN_VALUE,
54
- seo: UNKNOWN_VALUE,
55
- motion: UNKNOWN_VALUE,
56
- charts: UNKNOWN_VALUE,
57
- dates: UNKNOWN_VALUE,
58
- markdown: UNKNOWN_VALUE,
59
- security: UNKNOWN_VALUE,
60
- routing: UNKNOWN_VALUE
61
- },
62
- monorepo: {
63
- type: "none",
64
- packages: [],
65
- sharedPackages: []
66
- },
67
- ignoreDependencies: [],
68
- customRules: {},
69
- features: {
70
- i18n: false,
71
- analytics: false,
72
- themeMode: "dark-light",
73
- authentication: true,
74
- api: true,
75
- database: true,
76
- testing: false,
77
- docker: false,
78
- ci: false,
79
- commands: [],
80
- webview: [],
81
- language: [],
82
- themes: []
83
- },
84
- codeStyle: {
85
- dontRemoveComments: true,
86
- shouldAddComments: true,
87
- typeOrInterface: "type",
88
- importOrRequire: "import",
89
- quoteMark: "double",
90
- semicolons: true,
91
- lineWidth: 80,
92
- indentStyle: "space",
93
- indentSize: 2,
94
- importSymbol: "~",
95
- trailingComma: "all",
96
- bracketSpacing: true,
97
- arrowParens: "always",
98
- tabWidth: 2,
99
- jsToTs: false,
100
- cjsToEsm: false,
101
- modernize: {
102
- replaceFs: false,
103
- replacePath: false,
104
- replaceHttp: false,
105
- replaceProcess: false,
106
- replaceConsole: false,
107
- replaceEvents: false
108
- }
109
- },
110
- multipleRepoCloneMode: false,
111
- customUserFocusedRepos: [],
112
- customDevsFocusedRepos: [],
113
- hideRepoSuggestions: false,
114
- customReposOnNewProject: false,
115
- envComposerOpenBrowser: true,
116
- skipPromptsUseAutoBehavior: false,
117
- deployBehavior: "prompt",
118
- depsBehavior: "prompt",
119
- gitBehavior: "prompt",
120
- i18nBehavior: "prompt",
121
- scriptsBehavior: "prompt",
122
- existingRepoBehavior: "prompt",
123
- relinterConfirm: "promptOnce"
124
- };
125
- export const PROJECT_FRAMEWORK_FILES = {
126
- unknown: [],
127
- nextjs: ["next.config.js", "next.config.ts", "next.config.mjs"],
128
- vite: ["vite.config.js", "vite.config.ts", "react.config.js"],
129
- svelte: ["svelte.config.js", "svelte.config.ts"],
130
- remix: ["remix.config.js", "remix.config.ts"],
131
- astro: ["astro.config.js", "astro.config.ts", "astro.config.mjs"],
132
- nuxt: ["nuxt.config.js", "nuxt.config.ts"],
133
- solid: ["solid.config.js", "solid.config.ts"],
134
- qwik: ["qwik.config.js", "qwik.config.ts"],
135
- "react-native": ["App.js", "App.tsx", "App.ts"],
136
- expo: ["app.json", "app.config.js"],
137
- capacitor: ["capacitor.config.ts", "capacitor.config.json"],
138
- ionic: ["ionic.config.json"],
139
- electron: ["electron.config.js", "electron.config.ts"],
140
- tauri: ["tauri.conf.json"],
141
- neutralino: ["neutralino.config.json"],
142
- rempts: ["package.json:@reliverse/rempts"],
143
- citty: ["package.json:citty"],
144
- commander: ["package.json:commander"],
145
- cac: ["package.json:cac"],
146
- meow: ["package.json:meow"],
147
- yargs: ["package.json:yargs"],
148
- vscode: ["vscode.config.js", "vscode.config.ts"],
149
- webextension: ["manifest.json"],
150
- "browser-extension": ["manifest.json"],
151
- "npm-jsr": ["jsr.json", "jsr.jsonc"],
152
- lynx: ["App.tsx", "App.css"],
153
- vue: ["vue.config.js", "vite.config.ts"],
154
- wxt: ["wxt.config.js", "wxt.config.ts"]
155
- };