@vited/create 0.0.3 → 0.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.4 - 2026-10-28
4
+
5
+ ### Fixed
6
+
7
+ - Upgrade existing React and React DOM dependencies to React 19 when initializing a Vited project.
8
+
3
9
  ## 0.0.3 - 2026-10-28
4
10
 
5
11
  ### Fixed
package/README.md CHANGED
@@ -38,3 +38,5 @@ The generated project includes `vited.config.ts`, a `docs` directory, and
38
38
  `index.html` is added to the project. Existing package scripts and documentation
39
39
  files are preserved. An existing `vited.config.ts` is not overwritten.
40
40
  If it already exists, `vited-new.config.ts` is created or overwritten for comparison.
41
+ When installing with pnpm, the required `@swc/core` and `esbuild` build scripts
42
+ are approved automatically to comply with pnpm's build-script policy.
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { t as THEMES, n as create, r as installPackages, i as resolvePackageManager } from "./src-Ch1B-4Rg.mjs";
1
+ export { t as THEMES, n as create, r as installPackages, i as resolvePackageManager } from "./src-BWiFwqr3.mjs";
@@ -32,7 +32,7 @@ const resources = {
32
32
  invalidPackageManagerType: "Invalid package.json: packageManager must be a string in {{path}}",
33
33
  unsupportedPackageManager: "Unsupported package manager in {{path}}: {{packageManager}}",
34
34
  multipleLockfiles: "Multiple package manager lockfiles found in {{path}}. Set packageManager in package.json.",
35
- installFailed: "{{packageManager}} install exited with code {{code}}",
35
+ commandFailed: "{{command}} exited with code {{code}}",
36
36
  projectNotDirectory: "Project path is not a directory: {{path}}",
37
37
  docsNotDirectory: "Cannot create documentation: {{path}} is not a directory.",
38
38
  invalidPackageJson: "Invalid package.json: expected a JSON object in {{path}}",
@@ -67,7 +67,7 @@ const resources = {
67
67
  invalidPackageManagerType: "package.json 配置无效:{{path}} 中的 packageManager 必须是字符串",
68
68
  unsupportedPackageManager: "{{path}} 中配置了不支持的包管理器:{{packageManager}}",
69
69
  multipleLockfiles: "{{path}} 中存在多个包管理器锁文件,请在 package.json 中设置 packageManager。",
70
- installFailed: "{{packageManager}} install 退出,代码为 {{code}}",
70
+ commandFailed: "{{command}} 退出,代码为 {{code}}",
71
71
  projectNotDirectory: "项目路径不是目录:{{path}}",
72
72
  docsNotDirectory: "无法创建文档:{{path}} 不是目录。",
73
73
  invalidPackageJson: "package.json 无效:{{path}} 应为 JSON 对象",
@@ -99,12 +99,12 @@ function t(key, options) {
99
99
  }
100
100
  // src/index.ts
101
101
  const THEMES = ["@vited/theme-mantine"];
102
+ const defaultReactVersion = "^19.3.1";
103
+ const reactPackages = ["react", "react-dom"];
102
104
  const vitedPackages = {
103
105
  "@vited/cli": "^0.1.0",
104
106
  "@vited/core": "^0.1.0",
105
- "@vited/theme-mantine": "^0.1.0",
106
- react: "^19.3.1",
107
- "react-dom": "^19.3.1",
107
+ "@vited/theme-mantine": "^0.2.0",
108
108
  vite: "^8.3.5"
109
109
  };
110
110
  const packageManagerLockfiles = {
@@ -166,18 +166,28 @@ async function create({ directory, theme, packageManager, install }) {
166
166
  };
167
167
  }
168
168
  async function installPackages(projectPath, packageManager) {
169
+ if (packageManager === "pnpm") await runPackageCommand("pnpm", [
170
+ "approve-builds",
171
+ "@swc/core",
172
+ "esbuild"
173
+ ], projectPath);
174
+ await runPackageCommand(packageManager, ["install"], projectPath);
175
+ }
176
+ async function runPackageCommand(packageManager, args, projectPath) {
177
+ const command = [packageManager, ...args].join(" ");
178
+ const createCommandError = (code) => new Error(t("errors.commandFailed", {
179
+ command,
180
+ code: code === null ? "unknown" : code
181
+ }));
169
182
  await new Promise((resolve, reject) => {
170
- const child = spawn(packageManager, ["install"], {
183
+ const child = spawn(packageManager, args, {
171
184
  cwd: projectPath,
172
185
  stdio: "inherit"
173
186
  });
174
187
  child.once("error", reject);
175
188
  child.once("close", (code) => {
176
189
  if (code === 0) resolve();
177
- else reject(new Error(t("errors.installFailed", {
178
- packageManager,
179
- code: code === null ? "unknown" : code
180
- })));
190
+ else reject(createCommandError(code));
181
191
  });
182
192
  });
183
193
  }
@@ -244,6 +254,12 @@ function addVitedConfiguration(packageJson, projectPath, theme) {
244
254
  if (name === "@vited/theme-mantine" && theme !== name) continue;
245
255
  if (dependencies[name] === void 0 && devDependencies[name] === void 0) devDependencies[name] = version;
246
256
  }
257
+ const reactTarget = reactPackages.some((name) => dependencies[name] !== void 0) ? dependencies : devDependencies;
258
+ const reactOther = reactTarget === dependencies ? devDependencies : dependencies;
259
+ for (const name of reactPackages) {
260
+ reactTarget[name] = defaultReactVersion;
261
+ delete reactOther[name];
262
+ }
247
263
  packageJson["devDependencies"] = devDependencies;
248
264
  }
249
265
  function getRecord(value, name) {
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { a as LANGUAGES, c as t, i as resolvePackageManager, n as create, o as isLanguage, s as setLanguage, t as THEMES } from "./src-Ch1B-4Rg.mjs";
2
+ import { a as LANGUAGES, c as t, i as resolvePackageManager, n as create, o as isLanguage, s as setLanguage, t as THEMES } from "./src-BWiFwqr3.mjs";
3
3
  import process from "node:process";
4
4
  import console from "node:console";
5
5
  import { Command, Option } from "commander";
6
6
  import { cancel, confirm, intro, isCancel, outro, select, text } from "@clack/prompts";
7
7
  // package.json
8
- var version = "0.0.3";
8
+ var version = "0.0.4";
9
9
  // src/interactive.ts
10
10
  async function runInteractive() {
11
11
  if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error(t("interactive.terminalRequired"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vited/create",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Create and initialize Vited documentation projects",
5
5
  "keywords": [
6
6
  "cli",
@@ -53,7 +53,7 @@
53
53
  "@types/node": "^20.5.8",
54
54
  "@vited/cli": "^0.1.0",
55
55
  "@vited/core": "^0.1.0",
56
- "@vited/theme-mantine": "^0.1.0",
56
+ "@vited/theme-mantine": "^0.2.0",
57
57
  "husky": "^9.1.7",
58
58
  "lint-staged": "^17.6.0",
59
59
  "oxfmt": "^0.75.0",