@reliverse/dler 1.7.59 → 1.7.61
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/LICENSES +3 -0
- package/README.md +12 -7
- package/bin/app/build/prebuild.js +1 -2
- package/bin/app/{copy → fs}/cmd.d.ts +33 -2
- package/bin/app/fs/cmd.js +302 -0
- package/bin/app/x/cmd.d.ts +92 -0
- package/bin/app/x/cmd.js +260 -0
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-create.js +1 -1
- package/bin/libs/cfg/cfg-impl/rse-config/rse-impl/rse-define.d.ts +13 -13
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-library.js +21 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +20 -1
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-enoent.d.ts +15 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-enoent.js +38 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-env.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-env.js +34 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-error.d.ts +7 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-error.js +15 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-escape.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-escape.js +15 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-mod.d.ts +58 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-mod.js +231 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-parse.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-parse.js +56 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-resolve.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-resolve.js +39 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-shebang.d.ts +1 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-shebang.js +14 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-spawn.d.ts +3 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-spawn.js +18 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-stream.d.ts +4 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-stream.js +20 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-types.d.ts +13 -0
- package/bin/libs/sdk/sdk-impl/utils/exec/exec-types.js +9 -0
- package/bin/libs/sdk/sdk-impl/utils/fs-rename.d.ts +2 -0
- package/bin/libs/sdk/sdk-impl/utils/fs-rename.js +108 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-api.d.ts +85 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-api.js +173 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-detect.d.ts +12 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-detect.js +99 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-parse.d.ts +8 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-parse.js +29 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-types.d.ts +43 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-types.js +0 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-utils.d.ts +12 -0
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-utils.js +86 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.js +0 -2
- package/bin/libs/sdk/sdk-mod.d.ts +24 -0
- package/bin/libs/sdk/sdk-mod.js +53 -0
- package/package.json +9 -8
- package/bin/app/copy/cmd.js +0 -186
- package/bin/app/init/cmd.d.ts +0 -29
- package/bin/app/init/cmd.js +0 -82
- package/bin/app/rename/cmd.d.ts +0 -32
- package/bin/app/rename/cmd.js +0 -182
- package/bin/app/rm/cmd.d.ts +0 -13
- package/bin/app/rm/cmd.js +0 -70
- /package/bin/{app → libs/sdk/sdk-impl/utils}/init/init-const.d.ts +0 -0
- /package/bin/{app → libs/sdk/sdk-impl/utils}/init/init-const.js +0 -0
- /package/bin/{app → libs/sdk/sdk-impl/utils}/init/init-impl.d.ts +0 -0
- /package/bin/{app → libs/sdk/sdk-impl/utils}/init/init-impl.js +0 -0
- /package/bin/{app → libs/sdk/sdk-impl/utils}/init/init-tmpl.d.ts +0 -0
- /package/bin/{app → libs/sdk/sdk-impl/utils}/init/init-tmpl.js +0 -0
- /package/bin/{app → libs/sdk/sdk-impl/utils}/init/init-types.d.ts +0 -0
- /package/bin/{app → libs/sdk/sdk-impl/utils}/init/init-types.js +0 -0
package/bin/app/x/cmd.js
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import { relinka } from "@reliverse/relinka";
|
|
3
|
+
import { defineArgs, defineCommand, multiselectPrompt, selectPrompt } from "@reliverse/rempts";
|
|
4
|
+
import { x } from "../../libs/sdk/sdk-impl/utils/exec/exec-mod.js";
|
|
5
|
+
import { FILE_TYPES } from "../../libs/sdk/sdk-impl/utils/init/init-const.js";
|
|
6
|
+
import { initFile, initFiles } from "../../libs/sdk/sdk-impl/utils/init/init-impl.js";
|
|
7
|
+
import {
|
|
8
|
+
addDependency,
|
|
9
|
+
dedupeDependencies,
|
|
10
|
+
updateDependencies,
|
|
11
|
+
installDependencies,
|
|
12
|
+
removeDependency,
|
|
13
|
+
runScript
|
|
14
|
+
} from "../../libs/sdk/sdk-impl/utils/pm/pm-api.js";
|
|
15
|
+
import { detectPackageManager } from "../../libs/sdk/sdk-impl/utils/pm/pm-detect.js";
|
|
16
|
+
export default defineCommand({
|
|
17
|
+
meta: {
|
|
18
|
+
name: "x",
|
|
19
|
+
version: "1.1.0",
|
|
20
|
+
description: "Unified package manager and command executor. Usage example: `dler x install` or `dler x exec --target 'bun run build'`"
|
|
21
|
+
},
|
|
22
|
+
args: defineArgs({
|
|
23
|
+
action: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Action to perform: install, remove, detect, dedupe, run, exec, latest",
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
name: {
|
|
29
|
+
type: "positional",
|
|
30
|
+
description: "Package name or script name",
|
|
31
|
+
required: false
|
|
32
|
+
},
|
|
33
|
+
dev: {
|
|
34
|
+
type: "boolean",
|
|
35
|
+
alias: "D",
|
|
36
|
+
description: "Add as dev dependency"
|
|
37
|
+
},
|
|
38
|
+
global: {
|
|
39
|
+
type: "boolean",
|
|
40
|
+
alias: "g",
|
|
41
|
+
description: "Add globally"
|
|
42
|
+
},
|
|
43
|
+
"frozen-lockfile": {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
description: "Install dependencies with frozen lock file"
|
|
46
|
+
},
|
|
47
|
+
cwd: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Current working directory"
|
|
50
|
+
},
|
|
51
|
+
workspace: {
|
|
52
|
+
type: "boolean",
|
|
53
|
+
description: "Add to workspace"
|
|
54
|
+
},
|
|
55
|
+
silent: {
|
|
56
|
+
type: "boolean",
|
|
57
|
+
description: "Run in silent mode"
|
|
58
|
+
},
|
|
59
|
+
recreateLockFile: {
|
|
60
|
+
type: "boolean",
|
|
61
|
+
description: "Recreate lock file (for dedupe)"
|
|
62
|
+
},
|
|
63
|
+
target: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Command to execute (for exec action)"
|
|
66
|
+
},
|
|
67
|
+
timeout: {
|
|
68
|
+
type: "number",
|
|
69
|
+
description: "Timeout in milliseconds (for exec action)"
|
|
70
|
+
},
|
|
71
|
+
throwOnError: {
|
|
72
|
+
type: "boolean",
|
|
73
|
+
description: "Throw error if command fails",
|
|
74
|
+
default: true
|
|
75
|
+
},
|
|
76
|
+
fileType: {
|
|
77
|
+
type: "string",
|
|
78
|
+
description: "File type to initialize (e.g. 'md:README')"
|
|
79
|
+
},
|
|
80
|
+
destDir: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "Destination directory",
|
|
83
|
+
default: "."
|
|
84
|
+
},
|
|
85
|
+
multiple: {
|
|
86
|
+
type: "boolean",
|
|
87
|
+
description: "Whether to select multiple file types from the library"
|
|
88
|
+
},
|
|
89
|
+
parallel: {
|
|
90
|
+
type: "boolean",
|
|
91
|
+
description: "Run tasks in parallel"
|
|
92
|
+
},
|
|
93
|
+
concurrency: {
|
|
94
|
+
type: "string",
|
|
95
|
+
description: "Concurrency limit if parallel is true",
|
|
96
|
+
default: "4"
|
|
97
|
+
},
|
|
98
|
+
linter: {
|
|
99
|
+
type: "boolean",
|
|
100
|
+
description: "Run latest checks after updating dependencies",
|
|
101
|
+
default: false
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
async run({ args }) {
|
|
105
|
+
const {
|
|
106
|
+
action,
|
|
107
|
+
name,
|
|
108
|
+
target,
|
|
109
|
+
timeout,
|
|
110
|
+
throwOnError,
|
|
111
|
+
fileType,
|
|
112
|
+
destDir,
|
|
113
|
+
multiple,
|
|
114
|
+
parallel,
|
|
115
|
+
concurrency,
|
|
116
|
+
linter,
|
|
117
|
+
...options
|
|
118
|
+
} = args;
|
|
119
|
+
switch (action) {
|
|
120
|
+
case "install":
|
|
121
|
+
case "i":
|
|
122
|
+
case "add":
|
|
123
|
+
await (name ? addDependency(name, options) : installDependencies(options));
|
|
124
|
+
break;
|
|
125
|
+
case "remove":
|
|
126
|
+
case "rm":
|
|
127
|
+
case "uninstall":
|
|
128
|
+
case "un":
|
|
129
|
+
case "delete":
|
|
130
|
+
case "del":
|
|
131
|
+
if (!name) {
|
|
132
|
+
relinka.error("Package name is required for remove action");
|
|
133
|
+
return process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
await removeDependency(name, options);
|
|
136
|
+
break;
|
|
137
|
+
case "detect": {
|
|
138
|
+
const cwd = path.resolve(options.cwd || ".");
|
|
139
|
+
const packageManager = await detectPackageManager(cwd);
|
|
140
|
+
if (packageManager?.warnings) {
|
|
141
|
+
for (const warning of packageManager.warnings) {
|
|
142
|
+
relinka.warn(warning);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!packageManager) {
|
|
146
|
+
relinka.error(`Cannot detect package manager in \`${cwd}\``);
|
|
147
|
+
return process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
relinka.log(
|
|
150
|
+
`Detected package manager in \`${cwd}\`: \`${packageManager.name}@${packageManager.version}\``
|
|
151
|
+
);
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
case "dedupe": {
|
|
155
|
+
await dedupeDependencies(options);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
case "run": {
|
|
159
|
+
if (!name) {
|
|
160
|
+
relinka.error("Script name is required for run action");
|
|
161
|
+
return process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
await runScript(name, options);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case "exec": {
|
|
167
|
+
if (!target) {
|
|
168
|
+
relinka.error("Target command is required for exec action");
|
|
169
|
+
return process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
const commandParts = target.trim().split(/\s+/);
|
|
173
|
+
const command = commandParts[0];
|
|
174
|
+
const commandArgs = commandParts.slice(1);
|
|
175
|
+
if (!command) {
|
|
176
|
+
relinka.error("No command provided");
|
|
177
|
+
return process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
relinka.log(`Executing: ${target}`);
|
|
180
|
+
const result = x(command, commandArgs, {
|
|
181
|
+
nodeOptions: {
|
|
182
|
+
cwd: options.cwd ? path.resolve(options.cwd) : process.cwd(),
|
|
183
|
+
stdio: "inherit"
|
|
184
|
+
// This will pipe stdout/stderr to the parent process
|
|
185
|
+
},
|
|
186
|
+
timeout,
|
|
187
|
+
throwOnError
|
|
188
|
+
});
|
|
189
|
+
const output = await result;
|
|
190
|
+
if (output.exitCode === 0) {
|
|
191
|
+
relinka.success("Command completed successfully");
|
|
192
|
+
} else {
|
|
193
|
+
relinka.warn(`Command exited with code: ${output.exitCode}`);
|
|
194
|
+
if (throwOnError) {
|
|
195
|
+
return process.exit(output.exitCode || 1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
} catch (error) {
|
|
199
|
+
relinka.error(
|
|
200
|
+
`Failed to execute command: ${error instanceof Error ? error.message : String(error)}`
|
|
201
|
+
);
|
|
202
|
+
return process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
case "init": {
|
|
207
|
+
const concurrencyNum = Number(concurrency);
|
|
208
|
+
if (fileType && !FILE_TYPES.find((ft) => ft.type === fileType)) {
|
|
209
|
+
throw new Error(`Invalid file type: ${fileType}`);
|
|
210
|
+
}
|
|
211
|
+
const effectiveFileType = fileType;
|
|
212
|
+
if (multiple) {
|
|
213
|
+
const possibleTypes = FILE_TYPES.map((ft) => ft.type);
|
|
214
|
+
const chosen = await multiselectPrompt({
|
|
215
|
+
title: "Select file types to initialize",
|
|
216
|
+
options: possibleTypes.map((pt) => ({ label: pt, value: pt }))
|
|
217
|
+
});
|
|
218
|
+
if (chosen.length === 0) {
|
|
219
|
+
relinka("log", "No file types selected. Exiting...");
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const requests = chosen.map((ct) => ({
|
|
223
|
+
fileType: ct,
|
|
224
|
+
destDir
|
|
225
|
+
}));
|
|
226
|
+
const results = await initFiles(requests, {
|
|
227
|
+
parallel,
|
|
228
|
+
concurrency: concurrencyNum
|
|
229
|
+
});
|
|
230
|
+
relinka("verbose", `Multiple files result: ${JSON.stringify(results)}`);
|
|
231
|
+
} else {
|
|
232
|
+
let finalFileType = effectiveFileType;
|
|
233
|
+
if (!finalFileType) {
|
|
234
|
+
const possibleTypes = FILE_TYPES.map((ft) => ft.type);
|
|
235
|
+
const picked = await selectPrompt({
|
|
236
|
+
title: "Pick a file type to initialize",
|
|
237
|
+
options: possibleTypes.map((pt) => ({ label: pt, value: pt }))
|
|
238
|
+
});
|
|
239
|
+
finalFileType = picked;
|
|
240
|
+
}
|
|
241
|
+
const result = await initFile({
|
|
242
|
+
fileType: finalFileType,
|
|
243
|
+
destDir
|
|
244
|
+
});
|
|
245
|
+
relinka("verbose", `Single file result: ${JSON.stringify(result)}`);
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
case "latest": {
|
|
250
|
+
await updateDependencies(true, linter, options);
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
default: {
|
|
254
|
+
relinka.error(`Unknown action: ${action}`);
|
|
255
|
+
relinka.log("Available actions: install, remove, detect, dedupe, run, exec");
|
|
256
|
+
return process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
@@ -4,7 +4,7 @@ import { relinka } from "@reliverse/relinka";
|
|
|
4
4
|
import { confirmPrompt } from "@reliverse/rempts";
|
|
5
5
|
import { Value } from "@sinclair/typebox/value";
|
|
6
6
|
import { execaCommand } from "execa";
|
|
7
|
-
import { addDevDependency } from "
|
|
7
|
+
import { addDevDependency } from "../../../../sdk/sdk-impl/utils/pm/pm-api.js";
|
|
8
8
|
import { injectSectionComments } from "./rse-comments.js";
|
|
9
9
|
import { cliDomainDocs } from "./rse-consts.js";
|
|
10
10
|
import { UNKNOWN_VALUE, rseName, DEFAULT_DOMAIN, RSE_SCHEMA_DEV } from "./rse-consts.js";
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import type { RseConfig } from "./rse-types";
|
|
2
2
|
export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
3
|
-
version?: string | undefined;
|
|
4
3
|
$schema?: "./schema.json" | "https://reliverse.org/schema.json" | undefined;
|
|
5
4
|
projectName?: string | undefined;
|
|
6
5
|
projectAuthor?: string | undefined;
|
|
7
6
|
projectDescription?: string | undefined;
|
|
7
|
+
version?: string | undefined;
|
|
8
8
|
projectLicense?: string | undefined;
|
|
9
9
|
projectRepository?: string | undefined;
|
|
10
10
|
projectDomain?: string | undefined;
|
|
11
11
|
projectGitService?: "none" | "github" | "gitlab" | "bitbucket" | undefined;
|
|
12
12
|
projectDeployService?: "none" | "vercel" | "netlify" | "railway" | "deno" | undefined;
|
|
13
|
-
projectPackageManager?: "
|
|
14
|
-
projectState?: "
|
|
13
|
+
projectPackageManager?: "npm" | "bun" | "pnpm" | "yarn" | undefined;
|
|
14
|
+
projectState?: "creating" | "created" | undefined;
|
|
15
15
|
projectCategory?: "browser" | "cli" | "unknown" | "website" | "vscode" | "library" | "mobile" | undefined;
|
|
16
16
|
projectSubcategory?: "unknown" | "e-commerce" | "tool" | undefined;
|
|
17
|
-
projectFramework?: "
|
|
17
|
+
projectFramework?: "rempts" | "npm-jsr" | "vue" | "unknown" | "vscode" | "nextjs" | "vite" | "svelte" | "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?: {
|
|
21
|
+
commands?: string[] | undefined;
|
|
21
22
|
i18n?: boolean | undefined;
|
|
22
23
|
analytics?: boolean | undefined;
|
|
23
24
|
themeMode?: "light" | "dark" | "dark-light" | undefined;
|
|
@@ -27,24 +28,22 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
27
28
|
testing?: boolean | undefined;
|
|
28
29
|
docker?: boolean | undefined;
|
|
29
30
|
ci?: boolean | undefined;
|
|
30
|
-
commands?: string[] | undefined;
|
|
31
31
|
webview?: string[] | undefined;
|
|
32
32
|
language?: string[] | undefined;
|
|
33
33
|
themes?: string[] | undefined;
|
|
34
34
|
} | undefined;
|
|
35
35
|
preferredLibraries?: {
|
|
36
|
-
search?: "unknown" | "algolia" | undefined;
|
|
37
36
|
i18n?: "unknown" | "next-intl" | undefined;
|
|
38
37
|
analytics?: "unknown" | "vercel" | undefined;
|
|
39
38
|
authentication?: "unknown" | "better-auth" | "clerk" | "next-auth" | "supabase-auth" | "auth0" | undefined;
|
|
40
|
-
api?: "
|
|
41
|
-
testing?: "bun" | "
|
|
39
|
+
api?: "unknown" | "hono" | "trpc" | "graphql" | "rest" | undefined;
|
|
40
|
+
testing?: "bun" | "unknown" | "vitest" | "jest" | "playwright" | "cypress" | undefined;
|
|
42
41
|
stateManagement?: "unknown" | "zustand" | "jotai" | "redux-toolkit" | undefined;
|
|
43
42
|
formManagement?: "unknown" | "react-hook-form" | "formik" | undefined;
|
|
44
43
|
styling?: "sass" | "unknown" | "tailwind" | "styled-components" | "css-modules" | undefined;
|
|
45
44
|
uiComponents?: "unknown" | "shadcn-ui" | "chakra-ui" | "material-ui" | undefined;
|
|
46
45
|
databaseLibrary?: "unknown" | "drizzle" | "prisma" | "supabase" | undefined;
|
|
47
|
-
databaseProvider?: "
|
|
46
|
+
databaseProvider?: "unknown" | "pg" | "mysql" | "sqlite" | "mongodb" | undefined;
|
|
48
47
|
linting?: "eslint" | "unknown" | undefined;
|
|
49
48
|
formatting?: "biome" | "unknown" | undefined;
|
|
50
49
|
payment?: "unknown" | "stripe" | undefined;
|
|
@@ -52,12 +51,13 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
52
51
|
logging?: "unknown" | "axiom" | undefined;
|
|
53
52
|
forms?: "unknown" | "react-hook-form" | undefined;
|
|
54
53
|
notifications?: "unknown" | "sonner" | undefined;
|
|
54
|
+
search?: "unknown" | "algolia" | undefined;
|
|
55
55
|
uploads?: "unknown" | "uploadthing" | undefined;
|
|
56
56
|
validation?: "unknown" | "zod" | "typebox" | "valibot" | undefined;
|
|
57
57
|
documentation?: "unknown" | "starlight" | "nextra" | undefined;
|
|
58
58
|
icons?: "unknown" | "lucide" | undefined;
|
|
59
59
|
mail?: "unknown" | "resend" | undefined;
|
|
60
|
-
cache?: "
|
|
60
|
+
cache?: "unknown" | "redis" | undefined;
|
|
61
61
|
storage?: "unknown" | "cloudflare" | undefined;
|
|
62
62
|
cdn?: "unknown" | "cloudflare" | undefined;
|
|
63
63
|
cms?: "unknown" | "contentlayer" | 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?: "unknown" | "next" | "react-router" | "tanstack-router" | undefined;
|
|
71
71
|
} | undefined;
|
|
72
72
|
codeStyle?: {
|
|
73
73
|
lineWidth?: 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?: "mixed" | "import" | "require" | undefined;
|
|
87
87
|
cjsToEsm?: boolean | undefined;
|
|
88
88
|
modernize?: {
|
|
89
89
|
replaceFs?: boolean | undefined;
|
|
@@ -111,7 +111,7 @@ export declare const defineConfigRse: (userConfig?: Partial<RseConfig>) => {
|
|
|
111
111
|
customReposOnNewProject?: boolean | undefined;
|
|
112
112
|
envComposerOpenBrowser?: boolean | undefined;
|
|
113
113
|
repoBranch?: string | undefined;
|
|
114
|
-
repoPrivacy?: "
|
|
114
|
+
repoPrivacy?: "unknown" | "public" | "private" | undefined;
|
|
115
115
|
projectArchitecture?: "unknown" | "fullstack" | "separated" | undefined;
|
|
116
116
|
projectRuntime?: "bun" | "node" | "deno" | undefined;
|
|
117
117
|
skipPromptsUseAutoBehavior?: boolean | undefined;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import fs from "@reliverse/relifso";
|
|
1
2
|
import { relinka } from "@reliverse/relinka";
|
|
2
3
|
import { execaCommand } from "execa";
|
|
3
4
|
import pAll from "p-all";
|
|
4
5
|
import { CONCURRENCY_DEFAULT } from "../utils/utils-consts.js";
|
|
5
6
|
import { withWorkingDirectory } from "../utils/utils-error-cwd.js";
|
|
7
|
+
import { writeFileSafe } from "../utils/utils-fs.js";
|
|
6
8
|
import { pausePerfTimer, resumePerfTimer } from "../utils/utils-perf.js";
|
|
7
9
|
export async function library_publishLibrary(effectivePubRegistry, libName, npmOutDir, jsrOutDir, distJsrDryRun, distJsrFailOnWarn, distJsrAllowDirty, distJsrSlowTypes, isDev, timer) {
|
|
8
10
|
switch (effectivePubRegistry) {
|
|
@@ -51,9 +53,23 @@ export async function library_publishLibrary(effectivePubRegistry, libName, npmO
|
|
|
51
53
|
);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
|
-
async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, distJsrAllowDirty, distJsrSlowTypes, libName,
|
|
56
|
+
async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, distJsrAllowDirty, distJsrSlowTypes, libName, isDev, timer) {
|
|
55
57
|
relinka("verbose", `Starting library_pubToJsr for lib: ${libName}`);
|
|
58
|
+
let bunDirCreated = false;
|
|
59
|
+
const bunDir = "node_modules/bun";
|
|
60
|
+
const bunPkgPath = `${bunDir}/package.json`;
|
|
56
61
|
try {
|
|
62
|
+
if (isDev) {
|
|
63
|
+
if (!await fs.pathExists(bunPkgPath)) {
|
|
64
|
+
await fs.ensureDir(bunDir);
|
|
65
|
+
await writeFileSafe(
|
|
66
|
+
bunPkgPath,
|
|
67
|
+
'{\n "name": "bun"\n}',
|
|
68
|
+
"Create bun package.json for dev publish"
|
|
69
|
+
);
|
|
70
|
+
bunDirCreated = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
57
73
|
if (timer) pausePerfTimer(timer);
|
|
58
74
|
await withWorkingDirectory(libOutDir, async () => {
|
|
59
75
|
relinka("log", `Publishing lib ${libName} to JSR from ${libOutDir}`);
|
|
@@ -77,6 +93,10 @@ async function library_pubToJsr(libOutDir, distJsrDryRun, distJsrFailOnWarn, dis
|
|
|
77
93
|
} catch (error) {
|
|
78
94
|
if (timer) resumePerfTimer(timer);
|
|
79
95
|
throw error;
|
|
96
|
+
} finally {
|
|
97
|
+
if (isDev && bunDirCreated) {
|
|
98
|
+
await fs.remove(bunDir);
|
|
99
|
+
}
|
|
80
100
|
}
|
|
81
101
|
}
|
|
82
102
|
async function library_pubToNpm(libOutDir, distJsrDryRun, _distJsrFailOnWarn, libName, _isDev, timer) {
|
|
@@ -2,7 +2,7 @@ import type { PerfTimer } from "../sdk-types.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Publishes the JSR distribution.
|
|
4
4
|
*/
|
|
5
|
-
export declare function regular_pubToJsr(distJsrDryRun: boolean, distJsrFailOnWarn: boolean,
|
|
5
|
+
export declare function regular_pubToJsr(distJsrDryRun: boolean, distJsrFailOnWarn: boolean, isDev: boolean, commonPubPause: boolean, distJsrDirName: string, distJsrAllowDirty: boolean, distJsrSlowTypes: boolean, timer: PerfTimer): Promise<void>;
|
|
6
6
|
/**
|
|
7
7
|
* Publishes the NPM distribution.
|
|
8
8
|
*/
|
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
2
3
|
import { relinka } from "@reliverse/relinka";
|
|
3
4
|
import { execaCommand } from "execa";
|
|
4
5
|
import { PROJECT_ROOT } from "../utils/utils-consts.js";
|
|
5
6
|
import { withWorkingDirectory } from "../utils/utils-error-cwd.js";
|
|
7
|
+
import { writeFileSafe } from "../utils/utils-fs.js";
|
|
6
8
|
import { pausePerfTimer, resumePerfTimer } from "../utils/utils-perf.js";
|
|
7
|
-
export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn,
|
|
9
|
+
export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, isDev, commonPubPause, distJsrDirName, distJsrAllowDirty, distJsrSlowTypes, timer) {
|
|
8
10
|
try {
|
|
9
11
|
if (!commonPubPause) {
|
|
10
12
|
relinka("log", "Publishing to JSR...");
|
|
11
13
|
const distJsrDirNameResolved = path.resolve(PROJECT_ROOT, distJsrDirName);
|
|
14
|
+
let bunDirCreated = false;
|
|
15
|
+
const bunDir = "node_modules/bun";
|
|
16
|
+
const bunPkgPath = `${bunDir}/package.json`;
|
|
17
|
+
if (isDev) {
|
|
18
|
+
if (!await fs.pathExists(bunPkgPath)) {
|
|
19
|
+
await fs.ensureDir(bunDir);
|
|
20
|
+
await writeFileSafe(
|
|
21
|
+
bunPkgPath,
|
|
22
|
+
'{\n "name": "bun"\n}',
|
|
23
|
+
"Create bun package.json for dev publish"
|
|
24
|
+
);
|
|
25
|
+
bunDirCreated = true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
12
28
|
if (timer) pausePerfTimer(timer);
|
|
13
29
|
await withWorkingDirectory(distJsrDirNameResolved, async () => {
|
|
14
30
|
const command = [
|
|
@@ -25,6 +41,9 @@ export async function regular_pubToJsr(distJsrDryRun, distJsrFailOnWarn, _isDev,
|
|
|
25
41
|
});
|
|
26
42
|
await new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
27
43
|
if (timer) resumePerfTimer(timer);
|
|
44
|
+
if (isDev && bunDirCreated) {
|
|
45
|
+
await fs.remove(bunDir);
|
|
46
|
+
}
|
|
28
47
|
}
|
|
29
48
|
} catch (error) {
|
|
30
49
|
if (timer) resumePerfTimer(timer);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
|
+
import type { ExecParseResult } from "./exec-types.js";
|
|
3
|
+
export declare function notFoundError(original: {
|
|
4
|
+
command: string;
|
|
5
|
+
args: string[];
|
|
6
|
+
}, syscall: string): Error & {
|
|
7
|
+
code: string;
|
|
8
|
+
errno: string;
|
|
9
|
+
syscall: string;
|
|
10
|
+
path: string;
|
|
11
|
+
spawnargs: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare function hookChildProcess(cp: ChildProcess, parsed: ExecParseResult): void;
|
|
14
|
+
export declare function verifyENOENT(status: number | null, parsed: ExecParseResult): Error | null;
|
|
15
|
+
export declare function verifyENOENTSync(status: number | null, parsed: ExecParseResult): Error | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const isWin = process.platform === "win32";
|
|
2
|
+
export function notFoundError(original, syscall) {
|
|
3
|
+
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
4
|
+
code: "ENOENT",
|
|
5
|
+
errno: "ENOENT",
|
|
6
|
+
syscall: `${syscall} ${original.command}`,
|
|
7
|
+
path: original.command,
|
|
8
|
+
spawnargs: original.args
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export function hookChildProcess(cp, parsed) {
|
|
12
|
+
if (!isWin) return;
|
|
13
|
+
const originalEmit = cp.emit;
|
|
14
|
+
cp.emit = (name, ...args) => {
|
|
15
|
+
if (name === "exit") {
|
|
16
|
+
const code = args[0];
|
|
17
|
+
const signal = args[1];
|
|
18
|
+
const err = verifyENOENT(code ?? 0, parsed);
|
|
19
|
+
if (err) {
|
|
20
|
+
return originalEmit.apply(cp, ["error", err]);
|
|
21
|
+
}
|
|
22
|
+
return originalEmit.apply(cp, ["exit", code, signal]);
|
|
23
|
+
}
|
|
24
|
+
return originalEmit.apply(cp, [name, ...args]);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function verifyENOENT(status, parsed) {
|
|
28
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
29
|
+
return notFoundError(parsed.original, "spawn");
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
export function verifyENOENTSync(status, parsed) {
|
|
34
|
+
if (isWin && status === 1 && !parsed.file) {
|
|
35
|
+
return notFoundError(parsed.original, "spawnSync");
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { delimiter as pathDelimiter, resolve as resolvePath, dirname } from "node:path";
|
|
2
|
+
const isPathLikePattern = /^path$/i;
|
|
3
|
+
const defaultEnvPathInfo = { key: "PATH", value: "" };
|
|
4
|
+
function getPathFromEnv(env) {
|
|
5
|
+
for (const key in env) {
|
|
6
|
+
if (!Object.hasOwn(env, key) || !isPathLikePattern.test(key)) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
const value = env[key];
|
|
10
|
+
if (!value) return defaultEnvPathInfo;
|
|
11
|
+
return { key, value };
|
|
12
|
+
}
|
|
13
|
+
return defaultEnvPathInfo;
|
|
14
|
+
}
|
|
15
|
+
function addNodeBinToPath(cwd, path) {
|
|
16
|
+
const parts = path.value.split(pathDelimiter);
|
|
17
|
+
let currentPath = cwd;
|
|
18
|
+
let lastPath;
|
|
19
|
+
do {
|
|
20
|
+
parts.push(resolvePath(currentPath, "node_modules", ".bin"));
|
|
21
|
+
lastPath = currentPath;
|
|
22
|
+
currentPath = dirname(currentPath);
|
|
23
|
+
} while (currentPath !== lastPath);
|
|
24
|
+
return { key: path.key, value: parts.join(pathDelimiter) };
|
|
25
|
+
}
|
|
26
|
+
export function computeEnv(cwd, env) {
|
|
27
|
+
const envWithDefault = {
|
|
28
|
+
...process.env,
|
|
29
|
+
...env
|
|
30
|
+
};
|
|
31
|
+
const envPathInfo = addNodeBinToPath(cwd, getPathFromEnv(envWithDefault));
|
|
32
|
+
envWithDefault[envPathInfo.key] = envPathInfo.value;
|
|
33
|
+
return envWithDefault;
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class NonZeroExitError extends Error {
|
|
2
|
+
result;
|
|
3
|
+
output;
|
|
4
|
+
get exitCode() {
|
|
5
|
+
if (this.result.exitCode !== null) {
|
|
6
|
+
return this.result.exitCode;
|
|
7
|
+
}
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
10
|
+
constructor(result, output) {
|
|
11
|
+
super(`Process exited with non-zero status (${result.exitCode})`);
|
|
12
|
+
this.result = result;
|
|
13
|
+
this.output = output;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
2
|
+
export function escapeCommand(arg) {
|
|
3
|
+
return arg.replace(metaCharsRegExp, "^$1");
|
|
4
|
+
}
|
|
5
|
+
export function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
6
|
+
let result = `${arg}`;
|
|
7
|
+
result = result.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
8
|
+
result = result.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
9
|
+
result = `"${result}"`;
|
|
10
|
+
result = result.replace(metaCharsRegExp, "^$1");
|
|
11
|
+
if (doubleEscapeMetaChars) {
|
|
12
|
+
result = result.replace(metaCharsRegExp, "^$1");
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|