@reliverse/dler 1.7.146 → 1.7.147

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 (55) 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 +5 -5
  39. package/bin/impl/pub/impl.d.ts +1 -1
  40. package/bin/impl/remdn/mod.js +7 -15
  41. package/bin/impl/rules/reliverse/missing-deps/parser.js +1 -3
  42. package/bin/impl/schema/mod.js +4 -3
  43. package/bin/impl/split/impl.js +1 -3
  44. package/bin/impl/toolbox/toolbox-vercel.js +8 -8
  45. package/bin/impl/transform/transform-impl-mod.js +7 -13
  46. package/bin/impl/utils/agg/agg-3.js +2 -2
  47. package/bin/impl/utils/downloading/downloadI18nFiles.js +4 -4
  48. package/bin/impl/utils/exec/exec-stream.js +3 -5
  49. package/bin/impl/utils/handlers/promptPackageJsonScripts.js +3 -1
  50. package/bin/impl/utils/replacements/reps-impl.js +6 -2
  51. package/bin/mod.d.ts +4 -0
  52. package/bin/mod.js +21 -0
  53. package/package.json +1 -1
  54. package/bin/impl/cross/mod.d.ts +0 -1
  55. package/bin/impl/cross/mod.js +0 -27
@@ -338,6 +338,7 @@ export const DEFAULT_CONFIG_RELIVERSE = {
338
338
  }
339
339
  }
340
340
  };
341
- export const defineConfig = (userConfig = {}) => {
342
- return { ...DEFAULT_CONFIG_RELIVERSE, ...userConfig };
343
- };
341
+ export const defineConfig = (userConfig = {}) => ({
342
+ ...DEFAULT_CONFIG_RELIVERSE,
343
+ ...userConfig
344
+ });
@@ -45,9 +45,7 @@ export function splitLargeFunctions(filePath, funcLineThreshold) {
45
45
  const sourceCode = fs.readFileSync(filePath, "utf8");
46
46
  const sourceFile = ts.createSourceFile(filePath, sourceCode, ts.ScriptTarget.ESNext, true);
47
47
  let newSource = sourceCode;
48
- const getLineOfPosition = (pos) => {
49
- return sourceFile.getLineAndCharacterOfPosition(pos).line;
50
- };
48
+ const getLineOfPosition = (pos) => sourceFile.getLineAndCharacterOfPosition(pos).line;
51
49
  const largeFunctions = [];
52
50
  function visit(node) {
53
51
  if (ts.isFunctionDeclaration(node) && node.body) {
@@ -24,13 +24,13 @@ export async function openVercelTools(memory) {
24
24
  }
25
25
  }
26
26
  async function getVercelProjects(vercelInstance, maxItems, team) {
27
- const res = await withRateLimit(async () => {
28
- return await projectsGetProjects(vercelInstance, {
27
+ const res = await withRateLimit(
28
+ async () => await projectsGetProjects(vercelInstance, {
29
29
  teamId: team?.id,
30
30
  slug: team?.slug,
31
31
  limit: maxItems
32
- });
33
- });
32
+ })
33
+ );
34
34
  if (!res.ok) {
35
35
  throw res.error;
36
36
  }
@@ -74,13 +74,13 @@ Intentionally excluded projects: ${protectedNames.join(", ")}` : info;
74
74
  const projectName = projectNames.get(projectId) ?? projectId;
75
75
  try {
76
76
  relinka("verbose", `Deleting project ${projectName}...`);
77
- const res = await withRateLimit(async () => {
78
- return await projectsDeleteProject(vercelInstance, {
77
+ const res = await withRateLimit(
78
+ async () => await projectsDeleteProject(vercelInstance, {
79
79
  idOrName: projectId,
80
80
  teamId: team?.id,
81
81
  slug: team?.slug
82
- });
83
- });
82
+ })
83
+ );
84
84
  if (!res.ok) {
85
85
  throw res.error;
86
86
  }
@@ -62,16 +62,12 @@ export const trim = (transformer, charType) => {
62
62
  ms.trim(charType);
63
63
  return createTransformerFromMagicString(ms, transformer.original);
64
64
  };
65
- export const pipe = (value, ...operations) => {
66
- return operations.reduce((acc, operation) => operation(acc), value);
67
- };
68
- export const wrapWith = (transformer, prefix, suffix) => {
69
- return pipe(
70
- transformer,
71
- (t) => prepend(t, prefix),
72
- (t) => append(t, suffix)
73
- );
74
- };
65
+ export const pipe = (value, ...operations) => operations.reduce((acc, operation) => operation(acc), value);
66
+ export const wrapWith = (transformer, prefix, suffix) => pipe(
67
+ transformer,
68
+ (t) => prepend(t, prefix),
69
+ (t) => append(t, suffix)
70
+ );
75
71
  export const insertAt = (transformer, index, content) => {
76
72
  const ms = transformer._ms.clone();
77
73
  ms.appendLeft(index, content);
@@ -150,9 +146,7 @@ export const createBundle = (sources = []) => {
150
146
  generateMap: (options) => bundle.generateMap(options)
151
147
  };
152
148
  };
153
- export const compose = (...transformers) => {
154
- return (input) => transformers.reduceRight((acc, transformer) => transformer(acc), input);
155
- };
149
+ export const compose = (...transformers) => (input) => transformers.reduceRight((acc, transformer) => transformer(acc), input);
156
150
  export * from "magic-string";
157
151
  export default {
158
152
  createTransformer,
@@ -186,12 +186,12 @@ export function printUsage(isDev) {
186
186
  if (isDev) {
187
187
  relinka(
188
188
  "log",
189
- "bun dev:tools agg --input src-ts/impl --out src-ts/mod.ts --recursive --named --strip src-ts/impl"
189
+ "bun dev:tools agg --input src/impl --out src/mod.ts --recursive --named --strip src/impl"
190
190
  );
191
191
  } else {
192
192
  relinka(
193
193
  "log",
194
- "dler tools --tool agg --input src-ts/libs --out aggregator.ts --recursive --named"
194
+ "dler tools --tool agg --input src/libs --out aggregator.ts --recursive --named"
195
195
  );
196
196
  }
197
197
  }
@@ -3,8 +3,8 @@ import fs, { ensuredir } from "@reliverse/relifso";
3
3
  import { relinka } from "@reliverse/relinka";
4
4
  async function isI18nAlreadySetup(projectPath) {
5
5
  const checkPaths = [
6
- "src-ts/impl/[locale]",
7
- "src-ts/impl/[lang]",
6
+ "src/impl/[locale]",
7
+ "src/impl/[lang]",
8
8
  "src/i18n",
9
9
  "src/locales",
10
10
  "src/translations",
@@ -25,7 +25,7 @@ export async function setupI18nFiles(projectPath) {
25
25
  return;
26
26
  }
27
27
  await ensuredir(projectPath);
28
- const layoutPath = path.join(projectPath, "src-ts/impl/layout.tsx");
28
+ const layoutPath = path.join(projectPath, "src/impl/layout.tsx");
29
29
  if (!await fs.pathExists(layoutPath)) {
30
30
  await ensuredir(path.dirname(layoutPath));
31
31
  const layoutContent = `
@@ -58,7 +58,7 @@ export function generateStaticParams() {
58
58
  await fs.writeFile(layoutPath, layoutContent);
59
59
  relinka("success", "Generated i18n layout file");
60
60
  }
61
- const pagePath = path.join(projectPath, "src-ts/impl/page.tsx");
61
+ const pagePath = path.join(projectPath, "src/impl/page.tsx");
62
62
  if (!await fs.pathExists(pagePath)) {
63
63
  const pageContent = `
64
64
  import { useTranslation } from "../i18n";
@@ -1,9 +1,7 @@
1
1
  import { PassThrough } from "node:stream";
2
- export const waitForEvent = (emitter, name) => {
3
- return new Promise((resolve) => {
4
- emitter.on(name, resolve);
5
- });
6
- };
2
+ export const waitForEvent = (emitter, name) => new Promise((resolve) => {
3
+ emitter.on(name, resolve);
4
+ });
7
5
  export const combineStreams = (streams) => {
8
6
  let streamCount = streams.length;
9
7
  const combined = new PassThrough();
@@ -95,7 +95,9 @@ export async function promptPackageJsonScripts(projectPath, shouldRunDbPush, isP
95
95
  }
96
96
  });
97
97
  if (scriptOptions.length > 0) {
98
- isProjectBootstrapping && msg({ type: "M_BAR" });
98
+ if (isProjectBootstrapping) {
99
+ msg({ type: "M_BAR" });
100
+ }
99
101
  const selectedScripts = await multiselectPrompt({
100
102
  title: "Select detected package.json scripts to run",
101
103
  content: "Choose which setup and maintenance scripts to execute",
@@ -152,7 +152,9 @@ export async function replaceStringsInFiles(projectPath, oldValues, config = {})
152
152
  async function replaceInFile(filePath) {
153
153
  try {
154
154
  if (skipBinaryFiles && await isBinaryFile(filePath)) {
155
- verbose && relinka("verbose", `Skipping binary file: ${filePath}`);
155
+ if (verbose) {
156
+ relinka("verbose", `Skipping binary file: ${filePath}`);
157
+ }
156
158
  return;
157
159
  }
158
160
  const fileContent = await fs.readFile(filePath, "utf8");
@@ -182,7 +184,9 @@ export async function replaceStringsInFiles(projectPath, oldValues, config = {})
182
184
  relinka("verbose", `Updated ${relativePath}:`);
183
185
  changesMade.forEach((c) => relinka("verbose", ` - ${c}`));
184
186
  } else {
185
- relinka("verbose", `Updated strings in ${filePath}`);
187
+ if (verbose) {
188
+ relinka("verbose", `Updated strings in ${filePath}`);
189
+ }
186
190
  }
187
191
  }
188
192
  } catch (error) {
package/bin/mod.d.ts CHANGED
@@ -200,6 +200,10 @@ export { displayMigrationResults, extractDependencies, mergeToCatalog, migrateFr
200
200
  export { migrateModuleResolution, migrateToBundler, migrateToNodeNext, } from "./impl/migrate/codemods/nodenext-bundler";
201
201
  export { migratePathToPathkit } from "./impl/migrate/codemods/path-pathkit";
202
202
  export { migrateReaddirToGlob } from "./impl/migrate/codemods/readdir-glob";
203
+ export { type CacheResult, cachePackageOutput, cleanCache, hashPackage, isPackageCached, restorePackageCache, } from "./impl/monorepo/cache-mod";
204
+ export { allCommand, buildCommand, cleanCommand, depsCommand, graphCommand, type MonorepoContext, } from "./impl/monorepo/commands-mod";
205
+ export { DependencyGraph } from "./impl/monorepo/graph-mod";
206
+ export { createPackageConfig, findMonorepo, getCacheDir, type Monorepo, type Package, type PackageConfig, readPackageJson as readMonorepoPackageJson, } from "./impl/monorepo/monorepo-mod";
203
207
  export type { GenCfg, GenCfgJsonc } from "./impl/mrse/mrse-impl";
204
208
  export { downloadFileFromGitHub, ensureEnvCacheDir, getEnvCacheDir, getEnvCachePath, logVerbose, mrseVerbose, } from "./impl/mrse/mrse-impl";
205
209
  export type { ExistingTemplates, FileContent, } from "./impl/pack/mod";
package/bin/mod.js CHANGED
@@ -499,6 +499,27 @@ export {
499
499
  } from "./impl/migrate/codemods/nodenext-bundler.js";
500
500
  export { migratePathToPathkit } from "./impl/migrate/codemods/path-pathkit.js";
501
501
  export { migrateReaddirToGlob } from "./impl/migrate/codemods/readdir-glob.js";
502
+ export {
503
+ cachePackageOutput,
504
+ cleanCache,
505
+ hashPackage,
506
+ isPackageCached,
507
+ restorePackageCache
508
+ } from "./impl/monorepo/cache-mod.js";
509
+ export {
510
+ allCommand,
511
+ buildCommand,
512
+ cleanCommand,
513
+ depsCommand,
514
+ graphCommand
515
+ } from "./impl/monorepo/commands-mod.js";
516
+ export { DependencyGraph } from "./impl/monorepo/graph-mod.js";
517
+ export {
518
+ createPackageConfig,
519
+ findMonorepo,
520
+ getCacheDir,
521
+ readPackageJson as readMonorepoPackageJson
522
+ } from "./impl/monorepo/monorepo-mod.js";
502
523
  export {
503
524
  downloadFileFromGitHub,
504
525
  ensureEnvCacheDir,
package/package.json CHANGED
@@ -123,7 +123,7 @@
123
123
  "license": "MIT",
124
124
  "name": "@reliverse/dler",
125
125
  "type": "module",
126
- "version": "1.7.146",
126
+ "version": "1.7.147",
127
127
  "author": "reliverse",
128
128
  "bugs": {
129
129
  "email": "blefnk@gmail.com",
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { cliVersion } from "../config/constants.js";
4
- const os = process.platform === "win32" ? "windows" : process.platform;
5
- const ext = os === "windows" ? ".exe" : "";
6
- const arch = process.arch === "arm64" ? "arm64" : "x64";
7
- const binUrl = `https://github.com/reliverse/dler/releases/download/v${cliVersion}/dlerust-${os}-${arch}${ext}`;
8
- const downloadTo = path.resolve("dlerust");
9
- console.log("Downloading binary:", binUrl);
10
- console.log("To:", downloadTo);
11
- const res = await fetch(binUrl);
12
- if (!res.ok) {
13
- console.error(`Failed to download binary: ${res.status} ${res.statusText}`);
14
- process.exit(1);
15
- }
16
- const bin = toBuffer(await res.arrayBuffer());
17
- fs.writeFileSync(downloadTo, bin);
18
- fs.chmodSync(downloadTo, 493);
19
- console.log("Done!");
20
- function toBuffer(arrayBuffer) {
21
- const buffer = Buffer.alloc(arrayBuffer.byteLength);
22
- const view = new Uint8Array(arrayBuffer);
23
- for (let i = 0; i < buffer.length; ++i) {
24
- buffer[i] = view[i] ?? 0;
25
- }
26
- return buffer;
27
- }