@reliverse/dler 1.7.42 → 1.7.43
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path
|
|
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
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
+
});
|
|
@@ -10,11 +10,11 @@ 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?: "
|
|
13
|
+
projectPackageManager?: "bun" | "npm" | "yarn" | "pnpm" | undefined;
|
|
14
14
|
projectState?: "created" | "creating" | undefined;
|
|
15
|
-
projectCategory?: "
|
|
15
|
+
projectCategory?: "browser" | "cli" | "unknown" | "website" | "vscode" | "library" | "mobile" | undefined;
|
|
16
16
|
projectSubcategory?: "unknown" | "e-commerce" | "tool" | undefined;
|
|
17
|
-
projectFramework?: "rempts" | "
|
|
17
|
+
projectFramework?: "npm-jsr" | "vue" | "rempts" | "svelte" | "unknown" | "vscode" | "nextjs" | "vite" | "remix" | "astro" | "nuxt" | "solid" | "qwik" | "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;
|
|
19
19
|
projectTemplateDate?: string | undefined;
|
|
20
20
|
features?: {
|
|
@@ -34,17 +34,18 @@ 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
41
|
api?: "rest" | "unknown" | "hono" | "trpc" | "graphql" | undefined;
|
|
41
|
-
testing?: "bun" | "
|
|
42
|
+
testing?: "bun" | "jest" | "vitest" | "unknown" | "playwright" | "cypress" | undefined;
|
|
42
43
|
stateManagement?: "unknown" | "zustand" | "jotai" | "redux-toolkit" | undefined;
|
|
43
44
|
formManagement?: "unknown" | "react-hook-form" | "formik" | undefined;
|
|
44
|
-
styling?: "unknown" | "tailwind" | "styled-components" | "css-modules" |
|
|
45
|
+
styling?: "sass" | "unknown" | "tailwind" | "styled-components" | "css-modules" | undefined;
|
|
45
46
|
uiComponents?: "unknown" | "shadcn-ui" | "chakra-ui" | "material-ui" | undefined;
|
|
46
47
|
databaseLibrary?: "unknown" | "drizzle" | "prisma" | "supabase" | undefined;
|
|
47
|
-
databaseProvider?: "
|
|
48
|
+
databaseProvider?: "pg" | "unknown" | "mysql" | "sqlite" | "mongodb" | undefined;
|
|
48
49
|
linting?: "eslint" | "unknown" | undefined;
|
|
49
50
|
formatting?: "biome" | "unknown" | undefined;
|
|
50
51
|
payment?: "unknown" | "stripe" | undefined;
|
|
@@ -57,9 +58,8 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
57
58
|
documentation?: "unknown" | "starlight" | "nextra" | undefined;
|
|
58
59
|
icons?: "unknown" | "lucide" | undefined;
|
|
59
60
|
mail?: "unknown" | "resend" | undefined;
|
|
60
|
-
cache?: "
|
|
61
|
+
cache?: "redis" | "unknown" | 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;
|
|
@@ -67,7 +67,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
67
67
|
dates?: "unknown" | "dayjs" | undefined;
|
|
68
68
|
markdown?: "unknown" | "mdx" | undefined;
|
|
69
69
|
security?: "unknown" | "auth" | undefined;
|
|
70
|
-
routing?: "
|
|
70
|
+
routing?: "next" | "unknown" | "react-router" | "tanstack-router" | undefined;
|
|
71
71
|
} | undefined;
|
|
72
72
|
codeStyle?: {
|
|
73
73
|
lineWidth?: number | 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?: "
|
|
78
|
+
trailingComma?: "all" | "none" | "es5" | undefined;
|
|
79
79
|
bracketSpacing?: boolean | undefined;
|
|
80
80
|
arrowParens?: "always" | "avoid" | undefined;
|
|
81
81
|
tabWidth?: number | undefined;
|
|
@@ -83,7 +83,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
83
83
|
dontRemoveComments?: boolean | undefined;
|
|
84
84
|
shouldAddComments?: boolean | undefined;
|
|
85
85
|
typeOrInterface?: "type" | "interface" | "mixed" | undefined;
|
|
86
|
-
importOrRequire?: "
|
|
86
|
+
importOrRequire?: "import" | "require" | "mixed" | undefined;
|
|
87
87
|
cjsToEsm?: boolean | undefined;
|
|
88
88
|
modernize?: {
|
|
89
89
|
replaceFs?: boolean | 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?: "
|
|
99
|
+
type?: "bun" | "pnpm" | "none" | "turborepo" | "nx" | undefined;
|
|
100
100
|
packages?: string[] | undefined;
|
|
101
101
|
sharedPackages?: string[] | undefined;
|
|
102
102
|
} | undefined;
|
|
@@ -113,7 +113,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
113
113
|
repoBranch?: string | undefined;
|
|
114
114
|
repoPrivacy?: "unknown" | "public" | "private" | undefined;
|
|
115
115
|
projectArchitecture?: "unknown" | "fullstack" | "separated" | undefined;
|
|
116
|
-
projectRuntime?: "
|
|
116
|
+
projectRuntime?: "bun" | "node" | "deno" | undefined;
|
|
117
117
|
skipPromptsUseAutoBehavior?: boolean | undefined;
|
|
118
118
|
deployBehavior?: "prompt" | "autoYes" | "autoNo" | undefined;
|
|
119
119
|
depsBehavior?: "prompt" | "autoYes" | "autoNo" | undefined;
|
|
@@ -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)) {
|