@pubinfo/cli 2.0.8-beta.3 → 2.0.9
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/dist/build-BSUTEG7Y.js +18 -0
- package/dist/{commit-DOMxp7V0.js → commit-DmeFnmwn.js} +8 -8
- package/dist/dev-_h1c8fxx.js +18 -0
- package/dist/{icon-DWczAqmo.js → icon-Dj1r6tp1.js} +6 -5
- package/dist/index.js +11 -10
- package/dist/preview-B_d3buVV.js +16 -0
- package/dist/{setup-DivXUi8w.js → setup-BfQIjxIL.js} +2 -2
- package/dist/setup-DxwIdV4-.js +3 -0
- package/dist/{upgrade-CIZMqC7-.js → upgrade-BnDm_Nce.js} +8 -4
- package/dist/vite-2ZoC2y-j.js +43 -0
- package/package.json +6 -5
- package/dist/build-CE20dL_r.js +0 -45
- package/dist/dev-Dyuh6pCj.js +0 -50
- package/dist/preview-W9XnXXss.js +0 -43
- package/dist/setup-CYXOtkPr.js +0 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { runVite } from "./vite-2ZoC2y-j.js";
|
|
2
|
+
import { setup_default } from "./setup-BfQIjxIL.js";
|
|
3
|
+
import { defineCommand, runMain } from "citty";
|
|
4
|
+
|
|
5
|
+
//#region src/commands/build.ts
|
|
6
|
+
var build_default = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "build",
|
|
9
|
+
description: "构建应用"
|
|
10
|
+
},
|
|
11
|
+
async run({ rawArgs }) {
|
|
12
|
+
await runMain(setup_default);
|
|
13
|
+
await runVite("build", rawArgs);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { build_default as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
1
|
import process from "node:process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
3
|
|
|
4
4
|
//#region src/commands/commit.ts
|
|
5
5
|
/**
|
|
6
6
|
* `pubinfo commit` 子命令:
|
|
7
|
-
* 统一封装项目级提交体验,复用
|
|
7
|
+
* 统一封装项目级提交体验,复用 `@pubinfo/commitlint` 的核心能力。
|
|
8
8
|
* 功能概述:
|
|
9
9
|
* 1. 交互式生成符合规范的提交信息(中文 + 可选 emoji)。
|
|
10
10
|
* 2. 支持 `--edit` 供 commit-msg 钩子调用,读取临时文件并执行 lint。
|
|
@@ -34,17 +34,17 @@ var commit_default = {
|
|
|
34
34
|
}
|
|
35
35
|
const commitlintEnabled = await isCommitlintEnabled();
|
|
36
36
|
if (args.init) {
|
|
37
|
-
const cwd = process.cwd();
|
|
37
|
+
const cwd$1 = process.cwd();
|
|
38
38
|
if (!commitlintEnabled) {
|
|
39
|
-
const removedDefault = runSimpleGitHooks("pubinfo-commit", cwd, false);
|
|
40
|
-
const removedCli = runSimpleGitHooks("pubinfo commit", cwd, false);
|
|
41
|
-
const disabledHooks = configureGitHooksPath(false, cwd);
|
|
39
|
+
const removedDefault = runSimpleGitHooks("pubinfo-commit", cwd$1, false);
|
|
40
|
+
const removedCli = runSimpleGitHooks("pubinfo commit", cwd$1, false);
|
|
41
|
+
const disabledHooks = configureGitHooksPath(false, cwd$1);
|
|
42
42
|
if (removedDefault || removedCli || disabledHooks) console.log("[pubinfo commit] 检测到 pubinfo.config 中已关闭 commitlint,已停用 git hooks。");
|
|
43
43
|
else console.log("[pubinfo commit] 检测到 pubinfo.config 中已关闭 commitlint,跳过初始化。");
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
configureGitHooksPath(true, cwd);
|
|
47
|
-
const pubinfoDir = `${cwd}/.pubinfo`;
|
|
46
|
+
configureGitHooksPath(true, cwd$1);
|
|
47
|
+
const pubinfoDir = `${cwd$1}/.pubinfo`;
|
|
48
48
|
if (!fs.existsSync(pubinfoDir)) fs.mkdirSync(pubinfoDir);
|
|
49
49
|
const gitMessageStatus = createGitMessage();
|
|
50
50
|
const czConfigStatus = createCzConfig(pubinfoDir);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { runVite } from "./vite-2ZoC2y-j.js";
|
|
2
|
+
import { setup_default } from "./setup-BfQIjxIL.js";
|
|
3
|
+
import { defineCommand, runMain } from "citty";
|
|
4
|
+
|
|
5
|
+
//#region src/commands/dev.ts
|
|
6
|
+
var dev_default = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "dev",
|
|
9
|
+
description: "启动应用"
|
|
10
|
+
},
|
|
11
|
+
async run({ rawArgs }) {
|
|
12
|
+
await runMain(setup_default);
|
|
13
|
+
await runVite("dev", rawArgs);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { dev_default as default };
|
|
@@ -2,6 +2,7 @@ import { defineCommand } from "citty";
|
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
|
+
import { logger } from "@pubinfo/shared";
|
|
5
6
|
import { load } from "cheerio";
|
|
6
7
|
import { globby } from "globby";
|
|
7
8
|
|
|
@@ -20,7 +21,7 @@ async function processFile(file, opts) {
|
|
|
20
21
|
const $ = load(raw, { xmlMode: true });
|
|
21
22
|
const $svg = $("svg").first();
|
|
22
23
|
if ($svg.length === 0) {
|
|
23
|
-
|
|
24
|
+
logger.warn(`[skip] Not an <svg> root: ${file}`);
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
27
|
const origW = parseNumberLike($svg.attr("width"));
|
|
@@ -41,7 +42,7 @@ async function processFile(file, opts) {
|
|
|
41
42
|
} else {
|
|
42
43
|
vbW = 24;
|
|
43
44
|
vbH = 24;
|
|
44
|
-
|
|
45
|
+
logger.warn(`[warn] ${file} 无有效 viewBox/width/height,兜底为 24x24`);
|
|
45
46
|
}
|
|
46
47
|
$svg.attr("width", String(opts.size));
|
|
47
48
|
$svg.attr("height", String(opts.size));
|
|
@@ -51,7 +52,7 @@ async function processFile(file, opts) {
|
|
|
51
52
|
const targetPath = opts.inplace ? file : path.join(opts.outDir, path.relative(path.resolve(opts.baseDir), file));
|
|
52
53
|
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
|
53
54
|
await fs.writeFile(targetPath, output, "utf8");
|
|
54
|
-
|
|
55
|
+
logger.log(`[ok] ${path.relative(process.cwd(), targetPath)}`);
|
|
55
56
|
}
|
|
56
57
|
var icon_default = defineCommand({
|
|
57
58
|
meta: {
|
|
@@ -131,7 +132,7 @@ var icon_default = defineCommand({
|
|
|
131
132
|
ignore: extraIgnores
|
|
132
133
|
});
|
|
133
134
|
if (!files.length) {
|
|
134
|
-
|
|
135
|
+
logger.warn(`No SVG matched: ${pattern} (dir: ${base})`);
|
|
135
136
|
return;
|
|
136
137
|
}
|
|
137
138
|
if (!inplace && outDir) await fs.mkdir(outDir, { recursive: true });
|
|
@@ -144,7 +145,7 @@ var icon_default = defineCommand({
|
|
|
144
145
|
outDir
|
|
145
146
|
});
|
|
146
147
|
} catch (e) {
|
|
147
|
-
|
|
148
|
+
logger.error(`[error] ${file}: ${e.message}`);
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
});
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
//#region package.json
|
|
5
5
|
var name = "@pubinfo/cli";
|
|
6
6
|
var type = "module";
|
|
7
|
-
var version = "2.0.
|
|
7
|
+
var version = "2.0.9";
|
|
8
8
|
var description = "CLI for Pubinfo";
|
|
9
9
|
var exports = { ".": "./bin/pubinfo.mjs" };
|
|
10
10
|
var types = "./dist/index.d.ts";
|
|
@@ -19,11 +19,12 @@ var scripts = {
|
|
|
19
19
|
var peerDependencies = { "@pubinfo/vite": "workspace:*" };
|
|
20
20
|
var dependencies = {
|
|
21
21
|
"@pubinfo/commitlint": "workspace:*",
|
|
22
|
+
"@pubinfo/shared": "workspace:*",
|
|
22
23
|
"cheerio": "catalog:node",
|
|
23
24
|
"citty": "catalog:node",
|
|
25
|
+
"execa": "catalog:node",
|
|
24
26
|
"globby": "catalog:node",
|
|
25
|
-
"pkg-types": "catalog:node"
|
|
26
|
-
"unconfig": "catalog:node"
|
|
27
|
+
"pkg-types": "catalog:node"
|
|
27
28
|
};
|
|
28
29
|
var devDependencies = {
|
|
29
30
|
"@pubinfo/vite": "workspace:*",
|
|
@@ -49,13 +50,13 @@ var package_default = {
|
|
|
49
50
|
//#region src/commands/index.ts
|
|
50
51
|
const _rDefault = (r) => r.default || r;
|
|
51
52
|
const commands = {
|
|
52
|
-
dev: () => import("./dev-
|
|
53
|
-
build: () => import("./build-
|
|
54
|
-
preview: () => import("./preview-
|
|
55
|
-
setup: () => import("./setup-
|
|
56
|
-
commit: () => import("./commit-
|
|
57
|
-
icon: () => import("./icon-
|
|
58
|
-
upgrade: () => import("./upgrade-
|
|
53
|
+
dev: () => import("./dev-_h1c8fxx.js").then(_rDefault),
|
|
54
|
+
build: () => import("./build-BSUTEG7Y.js").then(_rDefault),
|
|
55
|
+
preview: () => import("./preview-B_d3buVV.js").then(_rDefault),
|
|
56
|
+
setup: () => import("./setup-DxwIdV4-.js").then(_rDefault),
|
|
57
|
+
commit: () => import("./commit-DmeFnmwn.js").then(_rDefault),
|
|
58
|
+
icon: () => import("./icon-Dj1r6tp1.js").then(_rDefault),
|
|
59
|
+
upgrade: () => import("./upgrade-BnDm_Nce.js").then(_rDefault)
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
//#endregion
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { runVite } from "./vite-2ZoC2y-j.js";
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/preview.ts
|
|
5
|
+
var preview_default = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "preview",
|
|
8
|
+
description: "预览构建的应用"
|
|
9
|
+
},
|
|
10
|
+
async run({ rawArgs }) {
|
|
11
|
+
await runVite("preview", rawArgs);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { preview_default as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { defineCommand } from "citty";
|
|
3
|
-
import { existsSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
3
|
import { mkdir } from "node:fs/promises";
|
|
5
4
|
import { join, resolve } from "node:path";
|
|
5
|
+
import { existsSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
|
|
7
7
|
//#region src/utils/tsconfig.ts
|
|
8
8
|
function writeTsconfig(filePath) {
|
|
@@ -85,7 +85,7 @@ const command = defineCommand({
|
|
|
85
85
|
const cwd = resolve(".");
|
|
86
86
|
const pubinfoDir = resolve(cwd, ".pubinfo");
|
|
87
87
|
if (!existsSync(pubinfoDir)) await mkdir(pubinfoDir, { recursive: true });
|
|
88
|
-
writeTsconfig(resolve(
|
|
88
|
+
writeTsconfig(resolve(pubinfoDir, "tsconfig.app.json"));
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
var setup_default = command;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
|
+
import { logger } from "@pubinfo/shared";
|
|
2
3
|
import { execSync } from "node:child_process";
|
|
3
4
|
import { readPackageJSON } from "pkg-types";
|
|
4
5
|
|
|
@@ -15,14 +16,17 @@ const command = defineCommand({
|
|
|
15
16
|
...pkg.devDependencies,
|
|
16
17
|
...pkg.peerDependencies
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
+
function isPubinfoRelated(name) {
|
|
20
|
+
return name === "pubinfo" || name.startsWith("@pubinfo/module-");
|
|
21
|
+
}
|
|
22
|
+
const pubinfoDeps = Object.keys(deps).filter(isPubinfoRelated);
|
|
19
23
|
if (!pubinfoDeps.length) {
|
|
20
|
-
|
|
24
|
+
logger.log("No pubinfo-related dependencies found.");
|
|
21
25
|
return;
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
logger.log(`Upgrading: ${pubinfoDeps.join(", ")}`);
|
|
24
28
|
const cmd = `pnpm up ${pubinfoDeps.join(" ")} --latest`;
|
|
25
|
-
|
|
29
|
+
logger.log(`Running: ${cmd}`);
|
|
26
30
|
execSync(cmd, { stdio: "inherit" });
|
|
27
31
|
}
|
|
28
32
|
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import { relative, resolve } from "node:path";
|
|
3
|
+
import { cwd } from "node:process";
|
|
4
|
+
import { execa } from "execa";
|
|
5
|
+
|
|
6
|
+
//#region src/utils/vite.ts
|
|
7
|
+
async function writeViteConfig(targetPath, configFile) {
|
|
8
|
+
const content = `
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
/* prettier-ignore */
|
|
11
|
+
// Generated by pubinfo
|
|
12
|
+
import pubinfoConfig from '${configFile}';
|
|
13
|
+
|
|
14
|
+
export default pubinfoConfig.vite
|
|
15
|
+
`.trim();
|
|
16
|
+
await writeFile(targetPath, content);
|
|
17
|
+
}
|
|
18
|
+
function extractConfigPath(userArgs, defaultConfig = "pubinfo.config.ts") {
|
|
19
|
+
const configIndex = userArgs.findIndex((arg) => arg === "--config");
|
|
20
|
+
if (configIndex !== -1 && userArgs[configIndex + 1]) {
|
|
21
|
+
const configPath = resolve(cwd(), userArgs[configIndex + 1]);
|
|
22
|
+
userArgs.splice(configIndex, 2);
|
|
23
|
+
return configPath;
|
|
24
|
+
}
|
|
25
|
+
return resolve(cwd(), defaultConfig);
|
|
26
|
+
}
|
|
27
|
+
async function runVite(command, userArgs) {
|
|
28
|
+
const pubinfoDir = resolve(cwd(), ".pubinfo");
|
|
29
|
+
const viteConfig = resolve(pubinfoDir, "vite.config.ts");
|
|
30
|
+
const userConfigFile = extractConfigPath(userArgs);
|
|
31
|
+
const importPath = relative(pubinfoDir, userConfigFile).replace(/\\/g, "/");
|
|
32
|
+
await writeViteConfig(viteConfig, importPath);
|
|
33
|
+
const viteArgs = [
|
|
34
|
+
command,
|
|
35
|
+
"--config",
|
|
36
|
+
viteConfig,
|
|
37
|
+
...userArgs
|
|
38
|
+
];
|
|
39
|
+
await execa("vite", viteArgs, { stdio: "inherit" });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { runVite };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.9",
|
|
5
5
|
"description": "CLI for Pubinfo",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./bin/pubinfo.mjs"
|
|
@@ -18,19 +18,20 @@
|
|
|
18
18
|
"node": "^20.19.0 || >=22.12.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@pubinfo/vite": "2.0.
|
|
21
|
+
"@pubinfo/vite": "2.0.9"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"cheerio": "^1.1.2",
|
|
25
25
|
"citty": "^0.1.6",
|
|
26
|
+
"execa": "^9.6.0",
|
|
26
27
|
"globby": "^14.1.0",
|
|
27
28
|
"pkg-types": "^2.3.0",
|
|
28
|
-
"
|
|
29
|
-
"@pubinfo/
|
|
29
|
+
"@pubinfo/commitlint": "2.0.9",
|
|
30
|
+
"@pubinfo/shared": "2.0.9"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/node": "^24.0.10",
|
|
33
|
-
"@pubinfo/vite": "2.0.
|
|
34
|
+
"@pubinfo/vite": "2.0.9"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
37
|
"dev": "tsdown --watch",
|
package/dist/build-CE20dL_r.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { setup_default } from "./setup-DivXUi8w.js";
|
|
2
|
-
import { defineCommand, runMain } from "citty";
|
|
3
|
-
import { build, mergeConfig } from "@pubinfo/vite";
|
|
4
|
-
import { loadConfig } from "unconfig";
|
|
5
|
-
|
|
6
|
-
//#region src/commands/build.ts
|
|
7
|
-
const command = defineCommand({
|
|
8
|
-
meta: {
|
|
9
|
-
name: "build",
|
|
10
|
-
description: "构建应用"
|
|
11
|
-
},
|
|
12
|
-
args: {
|
|
13
|
-
watch: {
|
|
14
|
-
type: "boolean",
|
|
15
|
-
alias: "w"
|
|
16
|
-
},
|
|
17
|
-
mode: {
|
|
18
|
-
type: "string",
|
|
19
|
-
alias: "m"
|
|
20
|
-
},
|
|
21
|
-
config: {
|
|
22
|
-
type: "string",
|
|
23
|
-
alias: "c"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
async run({ args }) {
|
|
27
|
-
await runMain(setup_default);
|
|
28
|
-
const { config } = await loadConfig({
|
|
29
|
-
sources: [{ files: args.config || "pubinfo.config" }],
|
|
30
|
-
merge: false
|
|
31
|
-
});
|
|
32
|
-
const inlineConfig = typeof config.vite === "function" ? config.vite({
|
|
33
|
-
mode: "production",
|
|
34
|
-
command: "build"
|
|
35
|
-
}) : config.vite;
|
|
36
|
-
await build(mergeConfig(inlineConfig ?? {}, {
|
|
37
|
-
mode: args.mode,
|
|
38
|
-
build: { watch: args.watch ? {} : null }
|
|
39
|
-
}));
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var build_default = command;
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { build_default as default };
|
package/dist/dev-Dyuh6pCj.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { setup_default } from "./setup-DivXUi8w.js";
|
|
2
|
-
import { defineCommand, runMain } from "citty";
|
|
3
|
-
import { createServer, mergeConfig } from "@pubinfo/vite";
|
|
4
|
-
import { loadConfig } from "unconfig";
|
|
5
|
-
|
|
6
|
-
//#region src/commands/dev.ts
|
|
7
|
-
const command = defineCommand({
|
|
8
|
-
meta: {
|
|
9
|
-
name: "dev",
|
|
10
|
-
description: "启动应用"
|
|
11
|
-
},
|
|
12
|
-
args: {
|
|
13
|
-
host: { type: "string" },
|
|
14
|
-
port: { type: "string" },
|
|
15
|
-
mode: {
|
|
16
|
-
type: "string",
|
|
17
|
-
alias: "m"
|
|
18
|
-
},
|
|
19
|
-
config: {
|
|
20
|
-
type: "string",
|
|
21
|
-
alias: "c"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
async run({ args }) {
|
|
25
|
-
await runMain(setup_default);
|
|
26
|
-
const { config } = await loadConfig({
|
|
27
|
-
sources: [{ files: args.config || "pubinfo.config" }],
|
|
28
|
-
merge: false
|
|
29
|
-
});
|
|
30
|
-
const inlineConfig = typeof config.vite === "function" ? config.vite({
|
|
31
|
-
mode: "development",
|
|
32
|
-
command: "serve"
|
|
33
|
-
}) : config.vite;
|
|
34
|
-
const server = await createServer(mergeConfig(inlineConfig ?? {}, {
|
|
35
|
-
server: {
|
|
36
|
-
host: args.host,
|
|
37
|
-
port: args.port ? Number(args.port) : void 0
|
|
38
|
-
},
|
|
39
|
-
mode: args.mode,
|
|
40
|
-
configFile: false
|
|
41
|
-
}));
|
|
42
|
-
await server.listen();
|
|
43
|
-
server.printUrls();
|
|
44
|
-
server.bindCLIShortcuts({ print: true });
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
var dev_default = command;
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
50
|
-
export { dev_default as default };
|
package/dist/preview-W9XnXXss.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
import { mergeConfig, preview } from "@pubinfo/vite";
|
|
3
|
-
import { loadConfig } from "unconfig";
|
|
4
|
-
|
|
5
|
-
//#region src/commands/preview.ts
|
|
6
|
-
const command = defineCommand({
|
|
7
|
-
meta: {
|
|
8
|
-
name: "preview",
|
|
9
|
-
description: "预览构建的应用"
|
|
10
|
-
},
|
|
11
|
-
args: {
|
|
12
|
-
host: { type: "string" },
|
|
13
|
-
port: { type: "string" },
|
|
14
|
-
mode: {
|
|
15
|
-
type: "string",
|
|
16
|
-
alias: "m"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
async run({ args }) {
|
|
20
|
-
const { config } = await loadConfig({
|
|
21
|
-
sources: [{ files: "pubinfo.config" }],
|
|
22
|
-
merge: false
|
|
23
|
-
});
|
|
24
|
-
const inlineConfig = typeof config.vite === "function" ? config.vite({
|
|
25
|
-
mode: "production",
|
|
26
|
-
command: "serve"
|
|
27
|
-
}) : config.vite;
|
|
28
|
-
const previewServer = await preview(mergeConfig(inlineConfig ?? {}, {
|
|
29
|
-
preview: {
|
|
30
|
-
host: args.host,
|
|
31
|
-
port: args.port ? Number(args.port) : void 0
|
|
32
|
-
},
|
|
33
|
-
mode: args.mode,
|
|
34
|
-
configFile: false
|
|
35
|
-
}));
|
|
36
|
-
previewServer.printUrls();
|
|
37
|
-
previewServer.bindCLIShortcuts({ print: true });
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
var preview_default = command;
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
export { preview_default as default };
|
package/dist/setup-CYXOtkPr.js
DELETED