@reliverse/dler 1.7.44 → 1.7.45

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.
@@ -24,7 +24,8 @@ export async function dlerBuild(isDev, config, debugOnlyCopyNonBuildFiles, debug
24
24
  effectiveConfig.distNpmDirName,
25
25
  effectiveConfig.distJsrDirName,
26
26
  effectiveConfig.libsDirDist,
27
- effectiveConfig.libsList
27
+ effectiveConfig.libsList,
28
+ "dist-tmp"
28
29
  );
29
30
  if (debugOnlyCopyNonBuildFiles) {
30
31
  if (debugDontCopyNonBuildFiles) {
@@ -35,7 +35,8 @@ export async function dlerPostBuild(isDev, debugDontCopyNonBuildFiles) {
35
35
  }
36
36
  }
37
37
  const distJsrPath = path.join(PROJECT_ROOT, config.distJsrDirName);
38
- if (await directoryExists(distJsrPath)) {
38
+ const distJsrBinPath = path.join(distJsrPath, "bin");
39
+ if (await directoryExists(distJsrPath) && await directoryExists(distJsrBinPath)) {
39
40
  await compareFileStructures(path.join(PROJECT_ROOT, config.coreEntrySrcDir), distJsrPath);
40
41
  }
41
42
  }
@@ -105,30 +105,29 @@ export default defineCommand({
105
105
  try {
106
106
  await fs.access(path.join(outDir, typesFile));
107
107
  } catch {
108
- const typesContent = `export type FileContent = string | Record<string, unknown>;
109
- export type FileType = "text" | "json" | "binary";
110
- export type FileMetadata = {
108
+ const typesContent = `export interface FileContent extends string | Record<string, unknown> {}
109
+ export interface FileMetadata {
111
110
  updatedAt?: string;
112
111
  updatedHash?: string;
113
- };
114
- export type TemplatesFileContent = {
112
+ }
113
+ export interface TemplatesFileContent {
115
114
  content: FileContent;
116
- type: FileType;
115
+ type: "text" | "json" | "binary";
117
116
  hasError?: boolean;
118
117
  jsonComments?: Record<number, string>;
119
118
  binaryHash?: string;
120
119
  metadata?: FileMetadata;
121
- };
122
- export type TemplateConfig = {
120
+ }
121
+ export interface TemplateConfig {
123
122
  files: Record<string, TemplatesFileContent>;
124
- };
125
- export type Template = {
123
+ }
124
+ export interface Template {
126
125
  name: string;
127
126
  description: string;
128
127
  config: TemplateConfig;
129
128
  updatedAt?: string;
130
- };
131
- export type Templates = Record<string, Template>;
129
+ }
130
+ export interface Templates extends Record<string, Template> {}
132
131
  `;
133
132
  await fs.writeFile(path.join(outDir, typesFile), typesContent);
134
133
  }
@@ -250,7 +249,7 @@ export type Templates = Record<string, Template>;
250
249
  ).split("\n").map((line, i) => {
251
250
  if (i === 0) return line;
252
251
  return " " + line.replace(/"([a-zA-Z0-9_]+)":/g, "$1:");
253
- }).join("\n").replace(/}$/m, "},");
252
+ }).join("\n").replace(/},?\s*$/, "},");
254
253
  code.push(` content: ${jsonStr}${sat},`);
255
254
  code.push(' type: "json",');
256
255
  }
@@ -10,7 +10,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
10
10
  projectDomain?: string | undefined;
11
11
  projectGitService?: "none" | "github" | "gitlab" | "bitbucket" | undefined;
12
12
  projectDeployService?: "none" | "vercel" | "netlify" | "railway" | "deno" | undefined;
13
- projectPackageManager?: "npm" | "bun" | "pnpm" | "yarn" | undefined;
13
+ projectPackageManager?: "npm" | "bun" | "yarn" | "pnpm" | undefined;
14
14
  projectState?: "created" | "creating" | undefined;
15
15
  projectCategory?: "browser" | "cli" | "unknown" | "website" | "vscode" | "library" | "mobile" | undefined;
16
16
  projectSubcategory?: "unknown" | "e-commerce" | "tool" | undefined;
@@ -34,10 +34,11 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
34
34
  } | undefined;
35
35
  preferredLibraries?: {
36
36
  search?: "unknown" | "algolia" | undefined;
37
+ cdn?: "unknown" | "cloudflare" | undefined;
37
38
  i18n?: "unknown" | "next-intl" | undefined;
38
39
  analytics?: "unknown" | "vercel" | undefined;
39
40
  authentication?: "unknown" | "better-auth" | "clerk" | "next-auth" | "supabase-auth" | "auth0" | undefined;
40
- api?: "unknown" | "hono" | "trpc" | "graphql" | "rest" | undefined;
41
+ api?: "rest" | "unknown" | "hono" | "trpc" | "graphql" | undefined;
41
42
  testing?: "bun" | "unknown" | "vitest" | "jest" | "playwright" | "cypress" | undefined;
42
43
  stateManagement?: "unknown" | "zustand" | "jotai" | "redux-toolkit" | undefined;
43
44
  formManagement?: "unknown" | "react-hook-form" | "formik" | undefined;
@@ -59,7 +60,6 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
59
60
  mail?: "unknown" | "resend" | undefined;
60
61
  cache?: "unknown" | "redis" | undefined;
61
62
  storage?: "unknown" | "cloudflare" | undefined;
62
- cdn?: "unknown" | "cloudflare" | undefined;
63
63
  cms?: "unknown" | "contentlayer" | undefined;
64
64
  seo?: "unknown" | "next-seo" | undefined;
65
65
  motion?: "unknown" | "framer" | undefined;
@@ -75,7 +75,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
75
75
  indentStyle?: "space" | "tab" | undefined;
76
76
  quoteMark?: "single" | "double" | undefined;
77
77
  semicolons?: boolean | undefined;
78
- trailingComma?: "none" | "es5" | "all" | undefined;
78
+ trailingComma?: "none" | "all" | "es5" | undefined;
79
79
  bracketSpacing?: boolean | undefined;
80
80
  arrowParens?: "always" | "avoid" | undefined;
81
81
  tabWidth?: number | undefined;
@@ -96,7 +96,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
96
96
  importSymbol?: string | undefined;
97
97
  } | undefined;
98
98
  monorepo?: {
99
- type?: "none" | "bun" | "turborepo" | "nx" | "pnpm" | undefined;
99
+ type?: "none" | "bun" | "pnpm" | "turborepo" | "nx" | undefined;
100
100
  packages?: string[] | undefined;
101
101
  sharedPackages?: string[] | undefined;
102
102
  } | undefined;
@@ -1,5 +1,5 @@
1
1
  import { endPrompt, startPrompt } from "@reliverse/rempts";
2
- const version = "1.7.44";
2
+ const version = "1.7.45";
3
3
  export async function showStartPrompt(isDev) {
4
4
  await startPrompt({
5
5
  titleColor: "inverse",
@@ -24,53 +24,67 @@ function validateTargets(targets, customOutputPaths) {
24
24
  const outputDirs = /* @__PURE__ */ new Set();
25
25
  const specificLibs = /* @__PURE__ */ new Set();
26
26
  const customTargets = /* @__PURE__ */ new Set();
27
+ const validTargets = [];
27
28
  const allOutputPaths = { ...DEFAULT_OUTPUT_PATHS, ...customOutputPaths };
28
29
  for (const target of targets) {
29
30
  const [outputDir, lib] = target.split("/");
30
31
  if (!outputDir) {
31
- throw new Error(`Invalid output target: ${target}`);
32
+ relinka("warn", `Skipping invalid output target: ${target}`);
33
+ continue;
32
34
  }
33
35
  const outputPath = allOutputPaths[outputDir] || outputDir;
34
36
  const fullPath = path.isAbsolute(outputPath) ? outputPath : path.join(process.cwd(), outputPath);
35
37
  if (!fs.existsSync(fullPath)) {
36
- throw new Error(`Output directory does not exist: ${outputPath}`);
38
+ relinka("warn", `Skipping non-existent output directory: ${outputPath}`);
39
+ continue;
37
40
  }
38
41
  const isCustomTarget = !["dist-npm", "dist-jsr", "dist-libs"].includes(outputDir);
39
42
  if (isCustomTarget) {
40
43
  if (customTargets.has(outputDir)) {
41
- throw new Error(`Duplicate custom target: ${outputDir}`);
44
+ relinka("warn", `Skipping duplicate custom target: ${outputDir}`);
45
+ continue;
42
46
  }
43
47
  customTargets.add(outputDir);
48
+ validTargets.push(target);
44
49
  continue;
45
50
  }
46
51
  if (outputDir === "dist-libs") {
47
52
  if (lib) {
48
53
  if (specificLibs.has(lib)) {
49
- throw new Error(`Duplicate library target: ${target}`);
54
+ relinka("warn", `Skipping duplicate library target: ${target}`);
55
+ continue;
50
56
  }
51
57
  specificLibs.add(lib);
52
58
  } else {
53
59
  if (outputDirs.has("dist-libs") || specificLibs.size > 0) {
54
- throw new Error("Cannot mix 'dist-libs' with specific library targets");
60
+ relinka("warn", "Skipping 'dist-libs' as it conflicts with specific library targets");
61
+ continue;
55
62
  }
56
63
  outputDirs.add("dist-libs");
57
64
  }
58
65
  } else {
59
66
  if (outputDirs.has(outputDir)) {
60
- throw new Error(`Duplicate output target: ${outputDir}`);
67
+ relinka("warn", `Skipping duplicate output target: ${outputDir}`);
68
+ continue;
61
69
  }
62
70
  outputDirs.add(outputDir);
63
71
  }
72
+ validTargets.push(target);
64
73
  }
74
+ return validTargets;
65
75
  }
66
76
  export async function applyMagicSpells(targets, options = {}) {
67
77
  const result = {
68
78
  processedFiles: []
69
79
  };
70
80
  try {
71
- validateTargets(targets, options.customOutputPaths);
81
+ const validTargets = validateTargets(targets, options.customOutputPaths);
82
+ if (validTargets.length === 0) {
83
+ relinka("warn", "No valid targets found to process");
84
+ return result;
85
+ }
72
86
  await pMap(
73
- targets,
87
+ validTargets,
74
88
  async (target) => {
75
89
  const [outputDir, lib] = target.split("/");
76
90
  if (outputDir && !["dist-npm", "dist-jsr", "dist-libs"].includes(outputDir)) {
@@ -2,7 +2,7 @@ import type { LibConfig } from "../config/types.js";
2
2
  /**
3
3
  * Recursively removes any existing distribution folders.
4
4
  */
5
- export declare function removeDistFolders(distNpmDirName: string, distJsrDirName: string, libsDirDist: string, libsList: Record<string, LibConfig>): Promise<boolean>;
5
+ export declare function removeDistFolders(distNpmDirName: string, distJsrDirName: string, libsDirDist: string, libsList: Record<string, LibConfig>, distTmpDirName?: string): Promise<boolean>;
6
6
  /**
7
7
  * Removes logInternal and relinka "internal" calls from TypeScript/JavaScript files
8
8
  * @param targetDir Directory to process recursively
@@ -3,10 +3,13 @@ import fs from "@reliverse/relifso";
3
3
  import { relinka } from "@reliverse/relinka";
4
4
  import pMap from "p-map";
5
5
  import { CONCURRENCY_DEFAULT, PROJECT_ROOT } from "./utils-consts.js";
6
- export async function removeDistFolders(distNpmDirName, distJsrDirName, libsDirDist, libsList) {
6
+ export async function removeDistFolders(distNpmDirName, distJsrDirName, libsDirDist, libsList, distTmpDirName = "") {
7
7
  const foldersToRemove = [];
8
+ foldersToRemove.push(distTmpDirName);
8
9
  foldersToRemove.push(distNpmDirName);
9
- foldersToRemove.push(distJsrDirName);
10
+ if (distJsrDirName) {
11
+ foldersToRemove.push(distJsrDirName);
12
+ }
10
13
  if (libsList && Object.keys(libsList).length > 0) {
11
14
  foldersToRemove.push(libsDirDist);
12
15
  }
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  "license": "MIT",
54
54
  "name": "@reliverse/dler",
55
55
  "type": "module",
56
- "version": "1.7.44",
56
+ "version": "1.7.45",
57
57
  "keywords": [
58
58
  "reliverse",
59
59
  "cli",