@reliverse/dler 1.7.42 → 1.7.44

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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # 🛋️ dler (prev. relidler) • build/publish/improve ts/js libs/cli/apps
1
+ # 🧬 dler (prev. relidler) • build/publish/improve ts/js libs/cli/apps
2
2
 
3
3
  [sponsor](https://github.com/sponsors/blefnk) — [discord](https://discord.gg/pb8ukbwpsj) — [github](https://github.com/reliverse/dler) — [npm](https://npmjs.com/@reliverse/dler)
4
4
 
@@ -1,4 +1,4 @@
1
- import path, { convertImportsAliasToRelative } from "@reliverse/pathkit";
1
+ import path from "@reliverse/pathkit";
2
2
  import fs from "@reliverse/relifso";
3
3
  import { relinka } from "@reliverse/relinka";
4
4
  import { runCmd } from "@reliverse/rempts";
@@ -9,49 +9,74 @@ import { applyMagicSpells } from "../../libs/sdk/sdk-impl/magic/ms-apply.js";
9
9
  import { resolveAllCrossLibs } from "../../libs/sdk/sdk-impl/utils/resolve-cross-libs.js";
10
10
  import { PROJECT_ROOT } from "../../libs/sdk/sdk-impl/utils/utils-consts.js";
11
11
  import { directoryExists, executeDlerHooks } from "./ppb-utils.js";
12
- const DIST_DIRECTORIES = ["dist-npm", "dist-jsr"];
13
12
  const ALIAS_TO_REPLACE = "~";
14
- const createPostBuildToolRunner = () => ({
15
- "dler-check": {
16
- name: "Dler Check",
17
- async run() {
18
- const checkCmd = await getCheckCmd();
19
- await runCmd(checkCmd, ["--no-exit", "--no-progress"]);
20
- }
13
+ export async function dlerPostBuild(isDev, debugDontCopyNonBuildFiles) {
14
+ relinka("info", "\u2014 \u2014 \u2014 dlerPostBuild \u2014 \u2014 \u2014");
15
+ const config = await getConfigDler();
16
+ await resolveAllCrossLibs(
17
+ ALIAS_TO_REPLACE,
18
+ ["npm", "jsr"],
19
+ config.buildPreExtensions,
20
+ config.buildTemplatesDir
21
+ );
22
+ if (!debugDontCopyNonBuildFiles) {
23
+ await wrapper_CopyNonBuildFiles(config);
21
24
  }
22
- });
23
- async function processDistDirectory(dir, alias, config) {
24
- try {
25
- const binDir = path.join(dir, "bin");
26
- if (await directoryExists(binDir)) {
27
- const files = await glob("**/*", {
28
- cwd: binDir,
29
- onlyFiles: true,
30
- // Exclude any directory named 'templates' at any depth
31
- ignore: [`**/${config.buildTemplatesDir}/**`, `**/*/${config.buildTemplatesDir}/**`]
32
- });
33
- const filesToProcess = files.filter((file) => {
34
- const ext = path.extname(file).slice(1);
35
- return config.buildPreExtensions.includes(ext);
36
- });
37
- for (const file of filesToProcess) {
38
- const filePath = path.join(binDir, file);
39
- await convertImportsAliasToRelative({
40
- targetDir: path.dirname(filePath),
41
- aliasToReplace: alias,
42
- pathExtFilter: "js-ts-none"
43
- });
44
- }
25
+ if (isDev) {
26
+ await applyMagicSpells(["dist-jsr", "dist-npm", "dist-libs"]);
27
+ }
28
+ await executeDlerHooks(config?.hooksAfterBuild ?? [], "post-build");
29
+ if (config?.runAfterBuild?.length) {
30
+ const tools = createPostBuildToolRunner();
31
+ const availableTools = config.runAfterBuild.filter((toolName) => toolName in tools).map((toolName) => ({ toolName, ...tools[toolName] }));
32
+ for (const { name, run } of availableTools) {
33
+ relinka("log", `Running ${name}...`);
34
+ await run();
45
35
  }
46
- } catch (error) {
47
- const errorMessage = error instanceof Error ? error.message : String(error);
48
- throw error;
36
+ }
37
+ const distJsrPath = path.join(PROJECT_ROOT, config.distJsrDirName);
38
+ if (await directoryExists(distJsrPath)) {
39
+ await compareFileStructures(path.join(PROJECT_ROOT, config.coreEntrySrcDir), distJsrPath);
49
40
  }
50
41
  }
51
- async function processDistDirectories(config) {
52
- for (const dir of DIST_DIRECTORIES) {
53
- relinka("log", `[processDistDirectory] ${dir}`);
54
- await processDistDirectory(dir, ALIAS_TO_REPLACE, config);
42
+ export async function wrapper_CopyNonBuildFiles(config) {
43
+ if (config.commonPubRegistry === "npm" || config.commonPubRegistry === "npm-jsr") {
44
+ await copyNonBuildFiles(
45
+ path.join(PROJECT_ROOT, config.coreEntrySrcDir),
46
+ path.join(PROJECT_ROOT, config.distNpmDirName),
47
+ config.buildPreExtensions,
48
+ config.buildTemplatesDir
49
+ );
50
+ }
51
+ if (config.commonPubRegistry === "jsr" || config.commonPubRegistry === "npm-jsr") {
52
+ await copyNonBuildFiles(
53
+ path.join(PROJECT_ROOT, config.coreEntrySrcDir),
54
+ path.join(PROJECT_ROOT, config.distJsrDirName),
55
+ config.buildPreExtensions,
56
+ config.buildTemplatesDir
57
+ );
58
+ }
59
+ if (config.libsActMode === "libs-only" || config.libsActMode === "main-and-libs") {
60
+ for (const [_, libConfig] of Object.entries(config.libsList)) {
61
+ const srcPath = path.join(PROJECT_ROOT, config.libsDirSrc, libConfig.libDirName);
62
+ const distPath = path.join(PROJECT_ROOT, config.libsDirDist, libConfig.libDirName);
63
+ if (libConfig.libPubRegistry === "npm" || libConfig.libPubRegistry === "npm-jsr") {
64
+ await copyNonBuildFiles(
65
+ srcPath,
66
+ path.join(distPath, "npm"),
67
+ config.buildPreExtensions,
68
+ config.buildTemplatesDir
69
+ );
70
+ }
71
+ if (libConfig.libPubRegistry === "jsr" || libConfig.libPubRegistry === "npm-jsr") {
72
+ await copyNonBuildFiles(
73
+ srcPath,
74
+ path.join(distPath, "jsr"),
75
+ config.buildPreExtensions,
76
+ config.buildTemplatesDir
77
+ );
78
+ }
79
+ }
55
80
  }
56
81
  }
57
82
  async function copyNonBuildFiles(srcDir, distDir, preExtensions, templatesDir) {
@@ -129,73 +154,12 @@ async function compareFileStructures(srcDir, distDir) {
129
154
  throw error;
130
155
  }
131
156
  }
132
- export async function dlerPostBuild(isDev, debugDontCopyNonBuildFiles) {
133
- relinka("info", "\u2014 \u2014 \u2014 dlerPostBuild \u2014 \u2014 \u2014");
134
- const config = await getConfigDler();
135
- await resolveAllCrossLibs(
136
- ALIAS_TO_REPLACE,
137
- ["npm", "jsr"],
138
- config.buildPreExtensions,
139
- config.buildTemplatesDir
140
- );
141
- if (!debugDontCopyNonBuildFiles) {
142
- await wrapper_CopyNonBuildFiles(config);
143
- }
144
- if (isDev) {
145
- await applyMagicSpells(["dist-jsr", "dist-npm", "dist-libs"]);
146
- }
147
- await processDistDirectories(config);
148
- await executeDlerHooks(config?.hooksAfterBuild ?? [], "post-build");
149
- if (config?.runAfterBuild?.length) {
150
- const tools = createPostBuildToolRunner();
151
- const availableTools = config.runAfterBuild.filter((toolName) => toolName in tools).map((toolName) => ({ toolName, ...tools[toolName] }));
152
- for (const { name, run } of availableTools) {
153
- relinka("log", `Running ${name}...`);
154
- await run();
155
- }
156
- }
157
- const distJsrPath = path.join(PROJECT_ROOT, config.distJsrDirName);
158
- if (await directoryExists(distJsrPath)) {
159
- await compareFileStructures(path.join(PROJECT_ROOT, config.coreEntrySrcDir), distJsrPath);
160
- }
161
- }
162
- export async function wrapper_CopyNonBuildFiles(config) {
163
- if (config.commonPubRegistry === "npm" || config.commonPubRegistry === "npm-jsr") {
164
- await copyNonBuildFiles(
165
- path.join(PROJECT_ROOT, config.coreEntrySrcDir),
166
- path.join(PROJECT_ROOT, config.distNpmDirName),
167
- config.buildPreExtensions,
168
- config.buildTemplatesDir
169
- );
170
- }
171
- if (config.commonPubRegistry === "jsr" || config.commonPubRegistry === "npm-jsr") {
172
- await copyNonBuildFiles(
173
- path.join(PROJECT_ROOT, config.coreEntrySrcDir),
174
- path.join(PROJECT_ROOT, config.distJsrDirName),
175
- config.buildPreExtensions,
176
- config.buildTemplatesDir
177
- );
178
- }
179
- if (config.libsActMode === "libs-only" || config.libsActMode === "main-and-libs") {
180
- for (const [_, libConfig] of Object.entries(config.libsList)) {
181
- const srcPath = path.join(PROJECT_ROOT, config.libsDirSrc, libConfig.libDirName);
182
- const distPath = path.join(PROJECT_ROOT, config.libsDirDist, libConfig.libDirName);
183
- if (libConfig.libPubRegistry === "npm" || libConfig.libPubRegistry === "npm-jsr") {
184
- await copyNonBuildFiles(
185
- srcPath,
186
- path.join(distPath, "npm"),
187
- config.buildPreExtensions,
188
- config.buildTemplatesDir
189
- );
190
- }
191
- if (libConfig.libPubRegistry === "jsr" || libConfig.libPubRegistry === "npm-jsr") {
192
- await copyNonBuildFiles(
193
- srcPath,
194
- path.join(distPath, "jsr"),
195
- config.buildPreExtensions,
196
- config.buildTemplatesDir
197
- );
198
- }
157
+ const createPostBuildToolRunner = () => ({
158
+ "dler-check": {
159
+ name: "Dler Check",
160
+ async run() {
161
+ const checkCmd = await getCheckCmd();
162
+ await runCmd(checkCmd, ["--no-exit", "--no-progress"]);
199
163
  }
200
164
  }
201
- }
165
+ });
@@ -291,9 +291,11 @@ export type Templates = Record<string, Template>;
291
291
  const mod = [
292
292
  ...aggregatedImports,
293
293
  "",
294
- `export const ${WL}_TEMPLATES = {`,
294
+ `const ${WL}_TEMPLATES_OBJ = {`,
295
295
  ...aggregatedEntries,
296
- "} as const;",
296
+ "};",
297
+ "",
298
+ `export const ${WL}_TEMPLATES = ${WL}_TEMPLATES_OBJ as const;`,
297
299
  "",
298
300
  `export type ${WL}_TEMPLATE_NAMES = keyof typeof ${WL}_TEMPLATES;`,
299
301
  "",
@@ -10,9 +10,9 @@ 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" | "yarn" | "pnpm" | undefined;
13
+ projectPackageManager?: "npm" | "bun" | "pnpm" | "yarn" | undefined;
14
14
  projectState?: "created" | "creating" | undefined;
15
- projectCategory?: "cli" | "unknown" | "website" | "vscode" | "browser" | "library" | "mobile" | undefined;
15
+ projectCategory?: "browser" | "cli" | "unknown" | "website" | "vscode" | "library" | "mobile" | undefined;
16
16
  projectSubcategory?: "unknown" | "e-commerce" | "tool" | undefined;
17
17
  projectFramework?: "rempts" | "npm-jsr" | "unknown" | "vscode" | "nextjs" | "vite" | "svelte" | "remix" | "astro" | "nuxt" | "solid" | "qwik" | "vue" | "wxt" | "lynx" | "react-native" | "expo" | "capacitor" | "ionic" | "electron" | "tauri" | "neutralino" | "citty" | "commander" | "cac" | "meow" | "yargs" | "webextension" | "browser-extension" | undefined;
18
18
  projectTemplate?: "unknown" | "blefnk/relivator-nextjs-template" | "blefnk/relivator-docker-template" | "blefnk/next-react-ts-src-minimal" | "blefnk/all-in-one-nextjs-template" | "blefnk/create-t3-app" | "blefnk/create-next-app" | "blefnk/astro-starlight-template" | "blefnk/versator-nextjs-template" | "blefnk/relivator-lynxjs-template" | "blefnk/relivator-react-native-template" | "reliverse/template-browser-extension" | "microsoft/vscode-extension-samples" | "microsoft/vscode-extension-template" | "rsetarter-template" | "blefnk/deno-cli-tutorial" | undefined;
@@ -37,7 +37,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
37
37
  i18n?: "unknown" | "next-intl" | undefined;
38
38
  analytics?: "unknown" | "vercel" | undefined;
39
39
  authentication?: "unknown" | "better-auth" | "clerk" | "next-auth" | "supabase-auth" | "auth0" | undefined;
40
- api?: "rest" | "unknown" | "hono" | "trpc" | "graphql" | undefined;
40
+ api?: "unknown" | "hono" | "trpc" | "graphql" | "rest" | undefined;
41
41
  testing?: "bun" | "unknown" | "vitest" | "jest" | "playwright" | "cypress" | undefined;
42
42
  stateManagement?: "unknown" | "zustand" | "jotai" | "redux-toolkit" | undefined;
43
43
  formManagement?: "unknown" | "react-hook-form" | "formik" | 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" | "all" | "es5" | undefined;
78
+ trailingComma?: "none" | "es5" | "all" | 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" | "pnpm" | "turborepo" | "nx" | undefined;
99
+ type?: "none" | "bun" | "turborepo" | "nx" | "pnpm" | 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.42";
2
+ const version = "1.7.44";
3
3
  export async function showStartPrompt(isDev) {
4
4
  await startPrompt({
5
5
  titleColor: "inverse",
@@ -81,7 +81,6 @@ export async function applyMagicSpells(targets, options = {}) {
81
81
  const srcRoot = path.resolve(process.cwd(), "src");
82
82
  const sourceFilesWithDirectives = await scanSourceForMagicDirectives(srcRoot, options);
83
83
  if (sourceFilesWithDirectives.length === 0) {
84
- if (DEBUG_MODE) relinka("log", "[spells] No source files with magic directives found");
85
84
  return;
86
85
  }
87
86
  if (DEBUG_MODE) {
@@ -207,9 +206,6 @@ async function processCustomTarget(outputDir, options = {}) {
207
206
  return result;
208
207
  }
209
208
  async function scanSourceForMagicDirectives(srcRoot, options = {}) {
210
- if (DEBUG_MODE) {
211
- relinka("log", `[spells] \u21D2 scanning src: ${srcRoot}`);
212
- }
213
209
  const sourceFilesWithDirectives = [];
214
210
  try {
215
211
  for await (const filePath of walkDirectoryTree(srcRoot)) {
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.42",
56
+ "version": "1.7.44",
57
57
  "keywords": [
58
58
  "reliverse",
59
59
  "cli",