@pubinfo/cli 2.0.11 → 2.0.12

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,5 +1,5 @@
1
- import { runVite } from "./vite-2ZoC2y-j.js";
2
- import { setup_default } from "./setup-BfQIjxIL.js";
1
+ import { runVite } from "./vite-CW2jPBQF.js";
2
+ import { setup_default } from "./setup-BDZqkMSk.js";
3
3
  import { defineCommand, runMain } from "citty";
4
4
 
5
5
  //#region src/commands/build.ts
@@ -1,5 +1,5 @@
1
- import { runVite } from "./vite-2ZoC2y-j.js";
2
- import { setup_default } from "./setup-BfQIjxIL.js";
1
+ import { runVite } from "./vite-CW2jPBQF.js";
2
+ import { setup_default } from "./setup-BDZqkMSk.js";
3
3
  import { defineCommand, runMain } from "citty";
4
4
 
5
5
  //#region src/commands/dev.ts
@@ -17,8 +17,7 @@ function toPreserveAspectRatio(aspect) {
17
17
  return `xMidYMid ${aspect}`;
18
18
  }
19
19
  async function processFile(file, opts) {
20
- const raw = await fs.readFile(file, "utf8");
21
- const $ = load(raw, { xmlMode: true });
20
+ const $ = load(await fs.readFile(file, "utf8"), { xmlMode: true });
22
21
  const $svg = $("svg").first();
23
22
  if ($svg.length === 0) {
24
23
  logger.warn(`[skip] Not an <svg> root: ${file}`);
@@ -122,8 +121,7 @@ var icon_default = defineCommand({
122
121
  }
123
122
  let outDir = ctx.args.outDir ? path.resolve(String(ctx.args.outDir)) : void 0;
124
123
  if (!inplace && !outDir) outDir = path.resolve(base, `svg-${size}`);
125
- const patterns = [path.join(base, pattern).replace(/\\/g, "/")];
126
- const files = await globby(patterns, {
124
+ const files = await globby([path.join(base, pattern).replace(/\\/g, "/")], {
127
125
  cwd: base,
128
126
  gitignore,
129
127
  absolute: true,
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.11";
7
+ var version = "2.0.12";
8
8
  var description = "CLI for Pubinfo";
9
9
  var exports = { ".": "./bin/pubinfo.mjs" };
10
10
  var types = "./dist/index.d.ts";
@@ -50,12 +50,12 @@ var package_default = {
50
50
  //#region src/commands/index.ts
51
51
  const _rDefault = (r) => r.default || r;
52
52
  const commands = {
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),
53
+ dev: () => import("./dev-DoKGeFp8.js").then(_rDefault),
54
+ build: () => import("./build-CbpG5BeV.js").then(_rDefault),
55
+ preview: () => import("./preview-BE4TJBlB.js").then(_rDefault),
56
+ setup: () => import("./setup-CefOMeQA.js").then(_rDefault),
57
57
  commit: () => import("./commit-DmeFnmwn.js").then(_rDefault),
58
- icon: () => import("./icon-Dj1r6tp1.js").then(_rDefault),
58
+ icon: () => import("./icon-Dp4dXbYT.js").then(_rDefault),
59
59
  upgrade: () => import("./upgrade-BnDm_Nce.js").then(_rDefault)
60
60
  };
61
61
 
@@ -1,4 +1,4 @@
1
- import { runVite } from "./vite-2ZoC2y-j.js";
1
+ import { runVite } from "./vite-CW2jPBQF.js";
2
2
  import { defineCommand } from "citty";
3
3
 
4
4
  //#region src/commands/preview.ts
@@ -82,8 +82,7 @@ const command = defineCommand({
82
82
  description: "初始化配置"
83
83
  },
84
84
  async run() {
85
- const cwd = resolve(".");
86
- const pubinfoDir = resolve(cwd, ".pubinfo");
85
+ const pubinfoDir = resolve(resolve("."), ".pubinfo");
87
86
  if (!existsSync(pubinfoDir)) await mkdir(pubinfoDir, { recursive: true });
88
87
  writeTsconfig(resolve(pubinfoDir, "tsconfig.app.json"));
89
88
  }
@@ -0,0 +1,3 @@
1
+ import { setup_default } from "./setup-BDZqkMSk.js";
2
+
3
+ export { setup_default as default };
@@ -5,15 +5,14 @@ import { execa } from "execa";
5
5
 
6
6
  //#region src/utils/vite.ts
7
7
  async function writeViteConfig(targetPath, configFile) {
8
- const content = `
8
+ await writeFile(targetPath, `
9
9
  /* eslint-disable */
10
10
  /* prettier-ignore */
11
11
  // Generated by pubinfo
12
12
  import pubinfoConfig from '${configFile}';
13
13
 
14
14
  export default pubinfoConfig.vite
15
- `.trim();
16
- await writeFile(targetPath, content);
15
+ `.trim());
17
16
  }
18
17
  function extractConfigPath(userArgs, defaultConfig = "pubinfo.config.ts") {
19
18
  const configIndex = userArgs.findIndex((arg) => arg === "--config");
@@ -27,16 +26,13 @@ function extractConfigPath(userArgs, defaultConfig = "pubinfo.config.ts") {
27
26
  async function runVite(command, userArgs) {
28
27
  const pubinfoDir = resolve(cwd(), ".pubinfo");
29
28
  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 = [
29
+ await writeViteConfig(viteConfig, relative(pubinfoDir, extractConfigPath(userArgs)).replace(/\\/g, "/"));
30
+ await execa("vite", [
34
31
  command,
35
32
  "--config",
36
33
  viteConfig,
37
34
  ...userArgs
38
- ];
39
- await execa("vite", viteArgs, { stdio: "inherit" });
35
+ ], { stdio: "inherit" });
40
36
  }
41
37
 
42
38
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/cli",
3
3
  "type": "module",
4
- "version": "2.0.11",
4
+ "version": "2.0.12",
5
5
  "description": "CLI for Pubinfo",
6
6
  "exports": {
7
7
  ".": "./bin/pubinfo.mjs"
@@ -18,7 +18,7 @@
18
18
  "node": "^20.19.0 || >=22.12.0"
19
19
  },
20
20
  "peerDependencies": {
21
- "@pubinfo/vite": "2.0.11"
21
+ "@pubinfo/vite": "2.0.12"
22
22
  },
23
23
  "dependencies": {
24
24
  "cheerio": "^1.1.2",
@@ -26,12 +26,12 @@
26
26
  "execa": "^9.6.0",
27
27
  "globby": "^14.1.0",
28
28
  "pkg-types": "^2.3.0",
29
- "@pubinfo/commitlint": "2.0.11",
30
- "@pubinfo/shared": "2.0.11"
29
+ "@pubinfo/commitlint": "2.0.12",
30
+ "@pubinfo/shared": "2.0.12"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^24.0.10",
34
- "@pubinfo/vite": "2.0.11"
34
+ "@pubinfo/vite": "2.0.12"
35
35
  },
36
36
  "scripts": {
37
37
  "dev": "tsdown --watch",
@@ -1,3 +0,0 @@
1
- import { setup_default } from "./setup-BfQIjxIL.js";
2
-
3
- export { setup_default as default };