@pubinfo/cli 2.0.0-rc.4 → 2.0.0
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-BL7ZjVB5.js → build-CE20dL_r.js} +2 -2
- package/dist/{commit-CkxIeWgN.js → commit-Dae8BYp0.js} +5 -1
- package/dist/{dev-CYJ3T2Hr.js → dev-Dyuh6pCj.js} +2 -2
- package/dist/index.js +11 -8
- package/dist/{preview-IG8wXay6.js → preview-W9XnXXss.js} +1 -1
- package/dist/setup-CYXOtkPr.js +3 -0
- package/dist/{setup-CeXxy5Fk.js → setup-DivXUi8w.js} +2 -3
- package/dist/upgrade-CIZMqC7-.js +32 -0
- package/package.json +8 -5
- package/dist/setup-bq4v7xFD.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setup_default } from "./setup-
|
|
1
|
+
import { setup_default } from "./setup-DivXUi8w.js";
|
|
2
2
|
import { defineCommand, runMain } from "citty";
|
|
3
3
|
import { build, mergeConfig } from "@pubinfo/vite";
|
|
4
4
|
import { loadConfig } from "unconfig";
|
|
@@ -7,7 +7,7 @@ import { loadConfig } from "unconfig";
|
|
|
7
7
|
const command = defineCommand({
|
|
8
8
|
meta: {
|
|
9
9
|
name: "build",
|
|
10
|
-
description: "
|
|
10
|
+
description: "构建应用"
|
|
11
11
|
},
|
|
12
12
|
args: {
|
|
13
13
|
watch: {
|
|
@@ -27,7 +27,11 @@ var commit_default = {
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
run: async ({ args }) => {
|
|
30
|
-
const { createCzConfig, createGitMessage, runCzConfig, runNpx, runSimpleGitHooks, runGitMessage, lintMessage, runPrompt } = await import("@pubinfo/commitlint");
|
|
30
|
+
const { createCzConfig, createGitMessage, runCzConfig, runNpx, runSimpleGitHooks, runGitMessage, lintMessage, runPrompt, isInsideGitRepo } = await import("@pubinfo/commitlint");
|
|
31
|
+
if (!isInsideGitRepo()) {
|
|
32
|
+
console.error("[pubinfo commit] 未检测到 Git 仓库。请在已初始化的 Git 项目中运行,或执行 `git init` 后重试。");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
31
35
|
if (args.init) {
|
|
32
36
|
const pubinfoDir = `${process.cwd()}/.pubinfo`;
|
|
33
37
|
if (!fs.existsSync(pubinfoDir)) fs.mkdirSync(pubinfoDir);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setup_default } from "./setup-
|
|
1
|
+
import { setup_default } from "./setup-DivXUi8w.js";
|
|
2
2
|
import { defineCommand, runMain } from "citty";
|
|
3
3
|
import { createServer, mergeConfig } from "@pubinfo/vite";
|
|
4
4
|
import { loadConfig } from "unconfig";
|
|
@@ -7,7 +7,7 @@ import { loadConfig } from "unconfig";
|
|
|
7
7
|
const command = defineCommand({
|
|
8
8
|
meta: {
|
|
9
9
|
name: "dev",
|
|
10
|
-
description: "
|
|
10
|
+
description: "启动应用"
|
|
11
11
|
},
|
|
12
12
|
args: {
|
|
13
13
|
host: { type: "string" },
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,13 @@ 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.0
|
|
7
|
+
var version = "2.0.0";
|
|
8
8
|
var description = "CLI for Pubinfo";
|
|
9
9
|
var exports = { ".": "./bin/pubinfo.mjs" };
|
|
10
10
|
var types = "./dist/index.d.ts";
|
|
11
11
|
var bin = { "pubinfo": "./bin/pubinfo.mjs" };
|
|
12
12
|
var files = ["bin", "dist"];
|
|
13
|
+
var engines = { "node": "^20.19.0 || >=22.12.0" };
|
|
13
14
|
var scripts = {
|
|
14
15
|
"dev": "tsdown --watch",
|
|
15
16
|
"build": "tsdown",
|
|
@@ -21,7 +22,7 @@ var dependencies = {
|
|
|
21
22
|
"cheerio": "catalog:node",
|
|
22
23
|
"citty": "catalog:node",
|
|
23
24
|
"globby": "catalog:node",
|
|
24
|
-
"
|
|
25
|
+
"pkg-types": "catalog:node",
|
|
25
26
|
"unconfig": "catalog:node"
|
|
26
27
|
};
|
|
27
28
|
var devDependencies = {
|
|
@@ -37,6 +38,7 @@ var package_default = {
|
|
|
37
38
|
types,
|
|
38
39
|
bin,
|
|
39
40
|
files,
|
|
41
|
+
engines,
|
|
40
42
|
scripts,
|
|
41
43
|
peerDependencies,
|
|
42
44
|
dependencies,
|
|
@@ -47,12 +49,13 @@ var package_default = {
|
|
|
47
49
|
//#region src/commands/index.ts
|
|
48
50
|
const _rDefault = (r) => r.default || r;
|
|
49
51
|
const commands = {
|
|
50
|
-
dev: () => import("./dev-
|
|
51
|
-
build: () => import("./build-
|
|
52
|
-
preview: () => import("./preview-
|
|
53
|
-
setup: () => import("./setup-
|
|
54
|
-
commit: () => import("./commit-
|
|
55
|
-
icon: () => import("./icon-DWczAqmo.js").then(_rDefault)
|
|
52
|
+
dev: () => import("./dev-Dyuh6pCj.js").then(_rDefault),
|
|
53
|
+
build: () => import("./build-CE20dL_r.js").then(_rDefault),
|
|
54
|
+
preview: () => import("./preview-W9XnXXss.js").then(_rDefault),
|
|
55
|
+
setup: () => import("./setup-CYXOtkPr.js").then(_rDefault),
|
|
56
|
+
commit: () => import("./commit-Dae8BYp0.js").then(_rDefault),
|
|
57
|
+
icon: () => import("./icon-DWczAqmo.js").then(_rDefault),
|
|
58
|
+
upgrade: () => import("./upgrade-CIZMqC7-.js").then(_rDefault)
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
//#endregion
|
|
@@ -2,8 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { defineCommand } from "citty";
|
|
3
3
|
import { existsSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { mkdir } from "node:fs/promises";
|
|
5
|
-
import { resolve } from "
|
|
6
|
-
import { join } from "node:path";
|
|
5
|
+
import { join, resolve } from "node:path";
|
|
7
6
|
|
|
8
7
|
//#region src/utils/tsconfig.ts
|
|
9
8
|
function writeTsconfig(filePath) {
|
|
@@ -80,7 +79,7 @@ function writeTsconfig(filePath) {
|
|
|
80
79
|
const command = defineCommand({
|
|
81
80
|
meta: {
|
|
82
81
|
name: "setup",
|
|
83
|
-
description: "
|
|
82
|
+
description: "初始化配置"
|
|
84
83
|
},
|
|
85
84
|
async run() {
|
|
86
85
|
const cwd = resolve(".");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
3
|
+
import { readPackageJSON } from "pkg-types";
|
|
4
|
+
|
|
5
|
+
//#region src/commands/upgrade.ts
|
|
6
|
+
const command = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "upgrade",
|
|
9
|
+
description: "升级依赖版本"
|
|
10
|
+
},
|
|
11
|
+
async run() {
|
|
12
|
+
const pkg = await readPackageJSON();
|
|
13
|
+
const deps = {
|
|
14
|
+
...pkg.dependencies,
|
|
15
|
+
...pkg.devDependencies,
|
|
16
|
+
...pkg.peerDependencies
|
|
17
|
+
};
|
|
18
|
+
const pubinfoDeps = Object.keys(deps).filter((name) => name === "pubinfo" || name.startsWith("@pubinfo/module-"));
|
|
19
|
+
if (!pubinfoDeps.length) {
|
|
20
|
+
console.log("No pubinfo-related dependencies found.");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
console.log(`Upgrading: ${pubinfoDeps.join(", ")}`);
|
|
24
|
+
const cmd = `pnpm up ${pubinfoDeps.join(" ")} --latest`;
|
|
25
|
+
console.log(`Running: ${cmd}`);
|
|
26
|
+
execSync(cmd, { stdio: "inherit" });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var upgrade_default = command;
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { upgrade_default as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "CLI for Pubinfo",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./bin/pubinfo.mjs"
|
|
@@ -14,20 +14,23 @@
|
|
|
14
14
|
"bin",
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
19
|
+
},
|
|
17
20
|
"peerDependencies": {
|
|
18
|
-
"@pubinfo/vite": "2.0.0
|
|
21
|
+
"@pubinfo/vite": "2.0.0"
|
|
19
22
|
},
|
|
20
23
|
"dependencies": {
|
|
21
24
|
"cheerio": "^1.1.2",
|
|
22
25
|
"citty": "^0.1.6",
|
|
23
26
|
"globby": "^14.1.0",
|
|
24
|
-
"
|
|
27
|
+
"pkg-types": "^2.3.0",
|
|
25
28
|
"unconfig": "^7.3.2",
|
|
26
|
-
"@pubinfo/commitlint": "2.0.0
|
|
29
|
+
"@pubinfo/commitlint": "2.0.0"
|
|
27
30
|
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"@types/node": "^24.0.10",
|
|
30
|
-
"@pubinfo/vite": "2.0.0
|
|
33
|
+
"@pubinfo/vite": "2.0.0"
|
|
31
34
|
},
|
|
32
35
|
"scripts": {
|
|
33
36
|
"dev": "tsdown --watch",
|
package/dist/setup-bq4v7xFD.js
DELETED