@reliverse/dler 1.7.146 → 1.7.148

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 (56) hide show
  1. package/LICENSES +0 -1
  2. package/bin/impl/auth/generators/auth-config.js +2 -6
  3. package/bin/impl/auth/impl/init.d.ts +2 -2
  4. package/bin/impl/auth/utils/generate-secret.js +1 -3
  5. package/bin/impl/build/impl.d.ts +1 -1
  6. package/bin/impl/config/constants.d.ts +1 -1
  7. package/bin/impl/config/constants.js +1 -1
  8. package/bin/impl/config/create.js +1 -1
  9. package/bin/impl/config/def-utils.js +3 -3
  10. package/bin/impl/config/detect.js +1 -7
  11. package/bin/impl/config/gen-cfg.js +1 -3
  12. package/bin/impl/config/prepare.js +2 -2
  13. package/bin/impl/db/messages.js +1 -3
  14. package/bin/impl/init/mm-deprecated/drizzle/manageDrizzleSchema.js +1 -1
  15. package/bin/impl/init/mm-deprecated/drizzle/manageDrizzleSchemaUtils.js +3 -3
  16. package/bin/impl/init/mm-deprecated/feature-add.js +2 -2
  17. package/bin/impl/init/mm-deprecated/feature-rm.js +5 -5
  18. package/bin/impl/init/use-template/cp-impl.js +2 -2
  19. package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-config.js +4 -4
  20. package/bin/impl/init/use-template/cp-modules/git-deploy-prompts/vercel/vercel-deploy.js +8 -8
  21. package/bin/impl/inject/inject-impl-mod.js +12 -20
  22. package/bin/impl/migrate/codemods/anything-bun.js +2 -6
  23. package/bin/impl/monorepo/cache-mod.d.ts +29 -0
  24. package/bin/impl/monorepo/cache-mod.js +61 -0
  25. package/bin/impl/monorepo/commands-mod.d.ts +24 -0
  26. package/bin/impl/monorepo/commands-mod.js +159 -0
  27. package/bin/impl/monorepo/graph-mod.d.ts +29 -0
  28. package/bin/impl/monorepo/graph-mod.js +106 -0
  29. package/bin/impl/monorepo/mod.d.ts +5 -0
  30. package/bin/impl/monorepo/mod.js +5 -0
  31. package/bin/impl/monorepo/monorepo-mod.d.ts +26 -0
  32. package/bin/impl/monorepo/monorepo-mod.js +152 -0
  33. package/bin/impl/providers/better-t-stack/packed/addons.js +1 -1
  34. package/bin/impl/providers/better-t-stack/packed/api.js +2 -2
  35. package/bin/impl/providers/better-t-stack/packed/auth.js +3 -3
  36. package/bin/impl/providers/better-t-stack/packed/backend.js +1 -1
  37. package/bin/impl/providers/better-t-stack/packed/examples.js +3 -3
  38. package/bin/impl/providers/better-t-stack/types.d.ts +6 -6
  39. package/bin/impl/providers/reliverse-stack/rs-impl.d.ts +2 -2
  40. package/bin/impl/pub/impl.d.ts +1 -1
  41. package/bin/impl/remdn/mod.js +7 -15
  42. package/bin/impl/rules/reliverse/missing-deps/parser.js +1 -3
  43. package/bin/impl/schema/mod.js +4 -3
  44. package/bin/impl/split/impl.js +1 -3
  45. package/bin/impl/toolbox/toolbox-vercel.js +8 -8
  46. package/bin/impl/transform/transform-impl-mod.js +7 -13
  47. package/bin/impl/utils/agg/agg-3.js +2 -2
  48. package/bin/impl/utils/downloading/downloadI18nFiles.js +4 -4
  49. package/bin/impl/utils/exec/exec-stream.js +3 -5
  50. package/bin/impl/utils/handlers/promptPackageJsonScripts.js +3 -1
  51. package/bin/impl/utils/replacements/reps-impl.js +6 -2
  52. package/bin/mod.d.ts +4 -0
  53. package/bin/mod.js +21 -0
  54. package/package.json +1 -1
  55. package/bin/impl/cross/mod.d.ts +0 -1
  56. package/bin/impl/cross/mod.js +0 -27
package/LICENSES CHANGED
@@ -18,6 +18,5 @@ Some parts of this project are based on and significantly adapt:
18
18
  - https://github.com/better-auth/better-auth/tree/e9bc7fc – MIT © Bereket Engida (Bekacru)
19
19
  - https://github.com/AmanVarshney01/create-better-t-stack/tree/0d7aa43 – MIT © Aman Varshney (AmanVarshney01)
20
20
  - https://github.com/unjs/mkdist/tree/a7f029d – MIT © Pooya Parsa (pi0), Daniel Roe (danielroe)
21
- - https://github.com/aklinker1/buildc/tree/54de387 – MIT © Aaron Klinker (aklinker1)
22
21
  - https://github.com/moxystudio/node-cross-spawn/tree/77cd97f – MIT © MOXY
23
22
  - https://github.com/tinylibs/tinyexec/tree/daa2945 – MIT © Tinylibs
@@ -10,9 +10,7 @@ export async function generateAuthConfig({
10
10
  START_OF_PLUGINS: {
11
11
  type: "regex",
12
12
  regex: /betterAuth\([\w\W]*plugins:[\W]*\[()/m,
13
- getIndex: ({ matchIndex, match }) => {
14
- return matchIndex + match[0].length;
15
- }
13
+ getIndex: ({ matchIndex, match }) => matchIndex + match[0].length
16
14
  }
17
15
  };
18
16
  const common_indexes = {
@@ -32,9 +30,7 @@ export async function generateAuthConfig({
32
30
  START_OF_BETTERAUTH: {
33
31
  type: "regex",
34
32
  regex: /betterAuth\({()/m,
35
- getIndex: ({ matchIndex }) => {
36
- return matchIndex + "betterAuth({".length;
37
- }
33
+ getIndex: ({ matchIndex }) => matchIndex + "betterAuth({".length
38
34
  }
39
35
  };
40
36
  const config_generation = {
@@ -146,8 +146,8 @@ export declare const optionsSchema: z.ZodObject<{
146
146
  cwd: z.ZodString;
147
147
  config: z.ZodOptional<z.ZodString>;
148
148
  database: z.ZodOptional<z.ZodEnum<{
149
- mysql: "mysql";
150
149
  sqlite: "sqlite";
150
+ mysql: "mysql";
151
151
  mongodb: "mongodb";
152
152
  postgres: "postgres";
153
153
  mssql: "mssql";
@@ -165,7 +165,7 @@ export declare const optionsSchema: z.ZodObject<{
165
165
  }, z.core.$strip>;
166
166
  export declare const outroText = "\uD83E\uDD73 All Done, Happy Hacking!";
167
167
  export declare function getLatestNpmVersion(packageName: string): Promise<string>;
168
- export declare function getPackageManager(): Promise<"bun" | "npm" | "pnpm" | "yarn">;
168
+ export declare function getPackageManager(): Promise<"npm" | "yarn" | "pnpm" | "bun">;
169
169
  export declare function getEnvFiles(cwd: string): Promise<string[]>;
170
170
  export declare function updateEnvs({ envs, files, isCommented, }: {
171
171
  /**
@@ -1,4 +1,2 @@
1
1
  import Crypto from "crypto";
2
- export const generateSecretHash = () => {
3
- return Crypto.randomBytes(32).toString("hex");
4
- };
2
+ export const generateSecretHash = () => Crypto.randomBytes(32).toString("hex");
@@ -3,7 +3,7 @@ import type { PerfTimer } from "../types/mod.js";
3
3
  /**
4
4
  * Main entry point for the rse build process.
5
5
  * Handles building for both main project and libraries.
6
- * @see `src-ts/impl/pub/impl.ts` for pub main function implementation.
6
+ * @see `src/impl/pub/impl.ts` for pub main function implementation.
7
7
  */
8
8
  export declare function dlerBuild({ flow, timer, isDev, config, debugOnlyCopyNonBuildFiles, debugDontCopyNonBuildFiles, disableOwnSpinner, }: {
9
9
  flow: "build" | "pub";
@@ -1,5 +1,5 @@
1
1
  export declare const PROJECT_ROOT: string;
2
- export declare const cliVersion = "1.7.146";
2
+ export declare const cliVersion = "1.7.148";
3
3
  export declare const cliName = "@reliverse/rse";
4
4
  export declare const rseName = "@reliverse/rse";
5
5
  export declare const dlerName = "@reliverse/dler";
@@ -1,7 +1,7 @@
1
1
  import os from "node:os";
2
2
  import path from "@reliverse/pathkit";
3
3
  export const PROJECT_ROOT = path.resolve(process.cwd());
4
- const version = "1.7.146";
4
+ const version = "1.7.148";
5
5
  export const cliVersion = version;
6
6
  export const cliName = "@reliverse/rse";
7
7
  export const rseName = "@reliverse/rse";
@@ -82,7 +82,7 @@ export async function writeReliverseConfig(configPath, config, isDev, skipInstal
82
82
  const pkgRaw = await fs.readFile(pkgPath, "utf8");
83
83
  const pkg = JSON.parse(pkgRaw);
84
84
  if (pkg.name === "@reliverse/dler") {
85
- defineImport = "./src-ts/mod.ts";
85
+ defineImport = "./src/mod.ts";
86
86
  } else {
87
87
  const hasDler = Boolean(
88
88
  pkg.dependencies && pkg.dependencies["@reliverse/dler"] || pkg.devDependencies && pkg.devDependencies["@reliverse/dler"]
@@ -83,10 +83,10 @@ export async function generateDefaultRulesForProject(projectPath, isDev) {
83
83
  const hasPrismaFile = await fs.pathExists(path.join(projectPath, "prisma/schema.prisma"));
84
84
  const hasDrizzleFile = await fs.pathExists(path.join(projectPath, "drizzle.config.ts"));
85
85
  const hasNextAuthDir = await fs.pathExists(
86
- path.join(projectPath, "src-ts/impl/api/auth/[...nextauth]")
86
+ path.join(projectPath, "src/impl/api/auth/[...nextauth]")
87
87
  );
88
88
  const hasBetterAuthFile = await fs.pathExists(
89
- path.join(projectPath, "src-ts/impl/api/auth/[...all]/route.ts")
89
+ path.join(projectPath, "src/impl/api/auth/[...all]/route.ts")
90
90
  );
91
91
  const hasShadcnUi = await fs.pathExists(path.join(projectPath, "components/ui"));
92
92
  const hasClerk = "@clerk/nextjs" in deps;
@@ -116,7 +116,7 @@ export async function generateDefaultRulesForProject(projectPath, isDev) {
116
116
  const hasHono = "hono" in deps;
117
117
  const hasTrpc = "@trpc/server" in deps;
118
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-ts/impl/api"));
119
+ const hasRest = await fs.pathExists(path.join(projectPath, "src/api")) || await fs.pathExists(path.join(projectPath, "src/impl/api"));
120
120
  const hasPg = "pg" in deps || "@neondatabase/serverless" in deps;
121
121
  const hasMysql = "mysql" in deps || "mysql2" in deps;
122
122
  const hasSqlite = "sqlite" in deps || "sqlite3" in deps || "better-sqlite3" in deps;
@@ -190,7 +190,7 @@ export async function detectFeatures(projectPath, packageJson) {
190
190
  const hasHono = "hono" in deps;
191
191
  const hasTrpc = "@trpc/server" in deps;
192
192
  const hasGraphql = "graphql" in deps || "apollo-server" in deps;
193
- const hasRest = await fs.pathExists(path.join(projectPath, "src/api")) || await fs.pathExists(path.join(projectPath, "src-ts/impl/api"));
193
+ const hasRest = await fs.pathExists(path.join(projectPath, "src/api")) || await fs.pathExists(path.join(projectPath, "src/impl/api"));
194
194
  const hasEslint = "eslint" in deps;
195
195
  const hasBiome = "@biomejs/biome" in deps;
196
196
  const hasStripe = "stripe" in deps || "@stripe/stripe-js" in deps;
@@ -223,12 +223,6 @@ export async function detectFeatures(projectPath, packageJson) {
223
223
  if ("python" in deps || await fs.pathExists(path.join(projectPath, "requirements.txt"))) {
224
224
  languages.push("python");
225
225
  }
226
- if (await fs.pathExists(path.join(projectPath, "go.mod"))) {
227
- languages.push("go");
228
- }
229
- if (await fs.pathExists(path.join(projectPath, "Cargo.toml"))) {
230
- languages.push("rust");
231
- }
232
226
  const themes = ["default"];
233
227
  if (hasTailwind) {
234
228
  themes.push("tailwind");
@@ -82,9 +82,7 @@ async function generateVSCodeSettings(projectPath, overwrite) {
82
82
  }
83
83
  export async function generateConfigFiles(projectPath, overwrite, projectName, deployService, primaryDomain, frontendUsername, enableI18n, isDev, filesToGenerate = []) {
84
84
  try {
85
- const shouldGenerateFile = (filename) => {
86
- return filesToGenerate.length === 0 || filesToGenerate.includes(filename);
87
- };
85
+ const shouldGenerateFile = (filename) => filesToGenerate.length === 0 || filesToGenerate.includes(filename);
88
86
  const cleanDomain = primaryDomain.replace(/^https?:\/\//, "").replace(/\/.*$/, "");
89
87
  const finalFrontendUsername = isDev && frontendUsername === "blefnk" ? "reliverse" : frontendUsername;
90
88
  const configInfo = await getReliverseConfigPath(projectPath, isDev, false);
@@ -82,7 +82,7 @@ async function ensureGitignoreEntries(cwd) {
82
82
  }
83
83
  }
84
84
  function getCoreEntrySrcDir(isDev) {
85
- return isDev ? "src-ts" : "src";
85
+ return isDev ? "src" : "src";
86
86
  }
87
87
  function generateJsoncConfig(isDev, pkgDescription) {
88
88
  const schemaUrl = `${rseOrg}/schema.json`;
@@ -780,7 +780,7 @@ function getBumpFilter(isDev) {
780
780
  return isDev ? `[
781
781
  "package.json",
782
782
  "reliverse.ts",
783
- "src-ts/rse.ts",
783
+ "src/rse.ts",
784
784
  ]` : `["package.json", "reliverse.ts"]`;
785
785
  }
786
786
  function getPublishArtifacts(isDev) {
@@ -54,9 +54,7 @@ export const randomAdContent = [
54
54
  "Got a cool saas\u2022tool\u2022lib\u2022etc? This spot can be yours! \u2192 blefnk@gmail.com",
55
55
  `Resend: "Railway is a game changer for us" \u2192 https://railway.com?referralCode=sATgpf`
56
56
  ];
57
- export const getRandomAd = () => {
58
- return randomAdContent[Math.floor(Math.random() * randomAdContent.length)];
59
- };
57
+ export const getRandomAd = () => randomAdContent[Math.floor(Math.random() * randomAdContent.length)];
60
58
  export const ad = getRandomAd();
61
59
  export const premium = re.bold(
62
60
  "No ads, more power \u2014 get Reliverse subscription: https://github.com/sponsors/blefnk"
@@ -11,7 +11,7 @@ import {
11
11
  setupDrizzle
12
12
  } from "./manageDrizzleSchemaUtils.js";
13
13
  export async function manageDrizzleSchema(cwd, isDev) {
14
- const singleSchemaDir = isDev ? path.join(cwd, "src-ts/impl/db") : path.join(cwd, "src/db");
14
+ const singleSchemaDir = isDev ? path.join(cwd, "src/impl/db") : path.join(cwd, "src/db");
15
15
  const multiSchemaDir = path.join(singleSchemaDir, "schema");
16
16
  let provider = await detectDatabaseProvider(cwd);
17
17
  if (!provider) {
@@ -84,7 +84,7 @@ export async function addNewTable(cwd, useMultipleFiles, provider) {
84
84
  return "Table name is required";
85
85
  }
86
86
  if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(value)) {
87
- return "Table name must start with a letter and contain only letters, numbers, and underscores";
87
+ return "Table name must start with a letter and contain only letters, numbers, and undesrcores";
88
88
  }
89
89
  return true;
90
90
  }
@@ -99,7 +99,7 @@ export async function addNewTable(cwd, useMultipleFiles, provider) {
99
99
  return "Column name is required";
100
100
  }
101
101
  if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(value)) {
102
- return "Column name must start with a letter and contain only letters, numbers, and underscores";
102
+ return "Column name must start with a letter and contain only letters, numbers, and undesrcores";
103
103
  }
104
104
  return true;
105
105
  }
@@ -243,7 +243,7 @@ export async function renameTable(cwd, useMultipleFiles, provider) {
243
243
  return "Table name is required";
244
244
  }
245
245
  if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(value)) {
246
- return "Table name must start with a letter and contain only letters, numbers, and underscores";
246
+ return "Table name must start with a letter and contain only letters, numbers, and undesrcores";
247
247
  }
248
248
  if (tables.includes(value)) {
249
249
  return "A table with this name already exists";
@@ -347,7 +347,7 @@ export const INTEGRATION_CONFIGS = {
347
347
  } = authClient;`
348
348
  },
349
349
  {
350
- path: "src-ts/impl/auth/sign-in/page.tsx",
350
+ path: "src/impl/auth/sign-in/page.tsx",
351
351
  content: `"use client";
352
352
  import { useState } from "react";
353
353
  import { authClient } from "@/lib/auth-client";
@@ -430,7 +430,7 @@ export const INTEGRATION_CONFIGS = {
430
430
  }`
431
431
  },
432
432
  {
433
- path: "src-ts/impl/auth/error/page.tsx",
433
+ path: "src/impl/auth/error/page.tsx",
434
434
  content: `"use client";
435
435
  import { useSearchParams } from "next/navigation";
436
436
  export default function AuthErrorPage() {
@@ -29,11 +29,11 @@ export const REMOVAL_CONFIGS = {
29
29
  files: [
30
30
  "src/lib/auth.ts",
31
31
  "src/lib/auth-client.ts",
32
- "src-ts/impl/api/auth/[...nextauth]/route.ts",
33
- "src-ts/impl/api/auth/[...all]/route.ts",
32
+ "src/impl/api/auth/[...nextauth]/route.ts",
33
+ "src/impl/api/auth/[...all]/route.ts",
34
34
  "middleware.ts"
35
35
  ],
36
- directories: ["src-ts/impl/api/auth"],
36
+ directories: ["src/impl/api/auth"],
37
37
  scripts: ["db:generate", "db:migrate"],
38
38
  envVars: [
39
39
  "NEXTAUTH_SECRET",
@@ -54,8 +54,8 @@ export const REMOVAL_CONFIGS = {
54
54
  name: "Payments",
55
55
  dependencies: ["stripe", "@polar-sh/sdk"],
56
56
  devDependencies: [],
57
- files: ["src/lib/stripe.ts", "src-ts/impl/api/stripe/webhook/route.ts"],
58
- directories: ["src-ts/impl/api/stripe"],
57
+ files: ["src/lib/stripe.ts", "src/impl/api/stripe/webhook/route.ts"],
58
+ directories: ["src/impl/api/stripe"],
59
59
  scripts: [],
60
60
  envVars: ["STRIPE_SECRET_KEY", "STRIPE_WEBHOOK_SECRET", "STRIPE_PRICE_ID", "POLAR_TOKEN"]
61
61
  },
@@ -35,7 +35,7 @@ async function ensureUniqueProjectName(initialName, isDev, cwd, skipPrompts) {
35
35
  validate: (value) => {
36
36
  if (!value) return "Project name cannot be empty";
37
37
  if (!/^[a-z0-9-_]+$/i.test(value)) {
38
- return "Project name can only contain letters, numbers, hyphens, and underscores";
38
+ return "Project name can only contain letters, numbers, hyphens, and undesrcores";
39
39
  }
40
40
  return true;
41
41
  }
@@ -70,7 +70,7 @@ export async function initializeProjectConfig(projectName, _memory, config, skip
70
70
  };
71
71
  }
72
72
  export async function setupI18nSupport(projectPath, config) {
73
- const i18nFolderExists = await fs.pathExists(path.join(projectPath, "src-ts/impl/[locale]")) || await fs.pathExists(path.join(projectPath, "src-ts/impl/[lang]"));
73
+ const i18nFolderExists = await fs.pathExists(path.join(projectPath, "src/impl/[locale]")) || await fs.pathExists(path.join(projectPath, "src/impl/[lang]"));
74
74
  if (i18nFolderExists) {
75
75
  relinka("verbose", "i18n is already enabled in the template. No changes needed.");
76
76
  return true;
@@ -5,14 +5,14 @@ import { experimental } from "../../../../../utils/badgeNotifiers.js";
5
5
  import { withRateLimit } from "./vercel-api.js";
6
6
  export async function updateProject(vercelInstance, projectId, config, teamId, teamSlug) {
7
7
  try {
8
- const res = await withRateLimit(async () => {
9
- return await projectsUpdateProject(vercelInstance, {
8
+ const res = await withRateLimit(
9
+ async () => await projectsUpdateProject(vercelInstance, {
10
10
  idOrName: projectId,
11
11
  teamId,
12
12
  slug: teamSlug,
13
13
  requestBody: config
14
- });
15
- });
14
+ })
15
+ );
16
16
  if (!res.ok) {
17
17
  throw res.error;
18
18
  }
@@ -71,8 +71,8 @@ export async function createInitialVercelDeployment(githubInstance, vercelInstan
71
71
  } catch (error) {
72
72
  throw new Error(`Failed to fetch GitHub repository numeric ID. ${error}`);
73
73
  }
74
- const deploymentRes = await withRateLimit(async () => {
75
- return await deploymentsCreateDeployment(vercelInstance, {
74
+ const deploymentRes = await withRateLimit(
75
+ async () => await deploymentsCreateDeployment(vercelInstance, {
76
76
  teamId,
77
77
  slug,
78
78
  requestBody: {
@@ -86,8 +86,8 @@ export async function createInitialVercelDeployment(githubInstance, vercelInstan
86
86
  sha: commitSha
87
87
  }
88
88
  }
89
- });
90
- });
89
+ })
90
+ );
91
91
  if (!deploymentRes.ok) throw deploymentRes.error;
92
92
  const deployment = deploymentRes.value;
93
93
  if (!deployment?.id || !deployment.readyState || !deployment.url) {
@@ -111,13 +111,13 @@ export async function createInitialVercelDeployment(githubInstance, vercelInstan
111
111
  selectedOptions.includes("monitoring")
112
112
  );
113
113
  await new Promise((resolve) => setTimeout(resolve, 5e3));
114
- const depRes = await withRateLimit(async () => {
115
- return await deploymentsGetDeployment(vercelInstance, {
114
+ const depRes = await withRateLimit(
115
+ async () => await deploymentsGetDeployment(vercelInstance, {
116
116
  idOrUrl: deployment.id,
117
117
  teamId,
118
118
  slug
119
- });
120
- });
119
+ })
120
+ );
121
121
  if (!depRes.ok) throw depRes.error;
122
122
  status = depRes.value.readyState;
123
123
  const now = Date.now();
@@ -691,26 +691,18 @@ export const validateMultipleInjections = (injections, based = "1-based") => {
691
691
  }
692
692
  return errors;
693
693
  };
694
- export const previewInjection = async (injection, options = {}) => {
695
- return injectAtLocation(injection, { ...options, writeToFile: false });
696
- };
697
- export const previewMultipleInjections = async (injections, options = {}) => {
698
- return injectMultiple(injections, { ...options, writeToFile: false });
699
- };
700
- export const previewRevert = async (injection, options = {}) => {
701
- return injectAtLocation(injection, {
702
- ...options,
703
- writeToFile: false,
704
- revert: true
705
- });
706
- };
707
- export const previewMultipleReverts = async (injections, options = {}) => {
708
- return injectMultiple(injections, {
709
- ...options,
710
- writeToFile: false,
711
- revert: true
712
- });
713
- };
694
+ export const previewInjection = async (injection, options = {}) => injectAtLocation(injection, { ...options, writeToFile: false });
695
+ export const previewMultipleInjections = async (injections, options = {}) => injectMultiple(injections, { ...options, writeToFile: false });
696
+ export const previewRevert = async (injection, options = {}) => injectAtLocation(injection, {
697
+ ...options,
698
+ writeToFile: false,
699
+ revert: true
700
+ });
701
+ export const previewMultipleReverts = async (injections, options = {}) => injectMultiple(injections, {
702
+ ...options,
703
+ writeToFile: false,
704
+ revert: true
705
+ });
714
706
  export default {
715
707
  injectAtLocation,
716
708
  injectMultiple,
@@ -373,8 +373,7 @@ ${transformedContent}`;
373
373
  changes
374
374
  };
375
375
  };
376
- const generateBunConfig = (analysis) => {
377
- return `# Bun configuration file
376
+ const generateBunConfig = (analysis) => `# Bun configuration file
378
377
  [install]
379
378
  cache = true
380
379
  auto = "bun"
@@ -393,9 +392,7 @@ ${analysis.hasTypeScript ? `
393
392
  compilerOptions = "tsconfig.json"
394
393
  ` : ""}
395
394
  `;
396
- };
397
- const generateDockerfile = (analysis) => {
398
- return `# Use Bun's official image
395
+ const generateDockerfile = (analysis) => `# Use Bun's official image
399
396
  FROM oven/bun:1 as base
400
397
  WORKDIR /usr/src/app
401
398
  # Install dependencies
@@ -409,7 +406,6 @@ ${analysis.scripts.build ? "RUN bun run build" : ""}
409
406
  EXPOSE 3000
410
407
  CMD ["bun", "start"]
411
408
  `;
412
- };
413
409
  const createBackup = async (projectRoot) => {
414
410
  const backupDir = join(projectRoot, ".bun-migration-backup");
415
411
  if (!existsSync(backupDir)) {
@@ -0,0 +1,29 @@
1
+ import type { Monorepo, Package } from "./monorepo-mod";
2
+ export interface CacheResult {
3
+ packageHash: string;
4
+ fileHashes: string;
5
+ }
6
+ /**
7
+ * Hash a package based on its files and configuration
8
+ */
9
+ export declare function hashPackage(pkg: Package): Promise<CacheResult>;
10
+ /**
11
+ * Get the cache directory for a package
12
+ */
13
+ export declare function getPackageCacheDir(monorepo: Monorepo, pkg: Package, packageHash: string): string;
14
+ /**
15
+ * Check if a package cache exists and is valid
16
+ */
17
+ export declare function isPackageCached(monorepo: Monorepo, pkg: Package, packageHash: string): Promise<boolean>;
18
+ /**
19
+ * Restore package from cache
20
+ */
21
+ export declare function restorePackageCache(monorepo: Monorepo, pkg: Package, packageHash: string): Promise<void>;
22
+ /**
23
+ * Cache package build output
24
+ */
25
+ export declare function cachePackageOutput(monorepo: Monorepo, pkg: Package, packageHash: string): Promise<void>;
26
+ /**
27
+ * Clean the entire cache directory
28
+ */
29
+ export declare function cleanCache(monorepo: Monorepo): Promise<void>;
@@ -0,0 +1,61 @@
1
+ import { createHash } from "node:crypto";
2
+ import path from "@reliverse/pathkit";
3
+ import fs from "@reliverse/relifso";
4
+ import { relinka } from "@reliverse/relinka";
5
+ import { globby } from "globby";
6
+ export async function hashPackage(pkg) {
7
+ const files = await globby(pkg.config.include, {
8
+ cwd: pkg.dir,
9
+ ignore: pkg.config.exclude,
10
+ absolute: true
11
+ });
12
+ files.sort();
13
+ const fileHashes = files.filter((file) => fs.statSync(file).isFile()).map((file) => {
14
+ const hash = hashFile(file);
15
+ const relativePath = path.relative(pkg.dir, file);
16
+ return `${hash}-${relativePath}`;
17
+ }).join("\n");
18
+ const packageHash = createHash("md5").update(fileHashes).digest("hex");
19
+ return {
20
+ packageHash,
21
+ fileHashes
22
+ };
23
+ }
24
+ function hashFile(filePath) {
25
+ const content = fs.readFileSync(filePath);
26
+ return createHash("md5").update(content).digest("hex");
27
+ }
28
+ export function getPackageCacheDir(monorepo, pkg, packageHash) {
29
+ return path.join(monorepo.root, ".cache", pkg.name, packageHash);
30
+ }
31
+ export async function isPackageCached(monorepo, pkg, packageHash) {
32
+ const cacheDir = getPackageCacheDir(monorepo, pkg, packageHash);
33
+ return await fs.pathExists(cacheDir);
34
+ }
35
+ export async function restorePackageCache(monorepo, pkg, packageHash) {
36
+ const cacheDir = getPackageCacheDir(monorepo, pkg, packageHash);
37
+ const outDir = path.join(pkg.dir, pkg.config.outDir);
38
+ if (!await fs.pathExists(cacheDir)) {
39
+ throw new Error(`Cache directory not found: ${cacheDir}`);
40
+ }
41
+ await fs.ensureDir(outDir);
42
+ await fs.copy(cacheDir, outDir, { overwrite: true });
43
+ }
44
+ export async function cachePackageOutput(monorepo, pkg, packageHash) {
45
+ const cacheDir = getPackageCacheDir(monorepo, pkg, packageHash);
46
+ const outDir = path.join(pkg.dir, pkg.config.outDir);
47
+ if (!await fs.pathExists(outDir)) {
48
+ throw new Error(`Output directory not found: ${outDir}`);
49
+ }
50
+ await fs.ensureDir(cacheDir);
51
+ await fs.copy(outDir, cacheDir, { overwrite: true });
52
+ }
53
+ export async function cleanCache(monorepo) {
54
+ const cacheDir = path.join(monorepo.root, ".cache");
55
+ if (await fs.pathExists(cacheDir)) {
56
+ await fs.remove(cacheDir);
57
+ relinka("log", `Cache cleaned: ${cacheDir}`);
58
+ } else {
59
+ relinka("log", "No cache directory found");
60
+ }
61
+ }
@@ -0,0 +1,24 @@
1
+ export interface MonorepoContext {
2
+ isDebug: boolean;
3
+ cmdArgs: string[];
4
+ }
5
+ /**
6
+ * Build command - builds dependencies and runs the command
7
+ */
8
+ export declare function buildCommand(ctx: MonorepoContext): Promise<void>;
9
+ /**
10
+ * Deps command - builds dependencies only
11
+ */
12
+ export declare function depsCommand(ctx: MonorepoContext): Promise<void>;
13
+ /**
14
+ * All command - builds all packages in the monorepo
15
+ */
16
+ export declare function allCommand(ctx: MonorepoContext): Promise<void>;
17
+ /**
18
+ * Graph command - prints the dependency graph
19
+ */
20
+ export declare function graphCommand(ctx: MonorepoContext): Promise<void>;
21
+ /**
22
+ * Clean command - deletes the build cache
23
+ */
24
+ export declare function cleanCommand(ctx: MonorepoContext): Promise<void>;