@vited/create 0.0.1 → 0.0.2

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,9 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## 1.0.0 - 2023-09-02
3
+ ## 0.0.2 - 2026-10-28
4
4
 
5
- - Added something
6
- - Changed something
7
- - Fixed something
8
- - Removed something
9
- - Deprecated something
5
+ ### Added
6
+
7
+ - Add English and Chinese localization for CLI help, setup prompts, messages, and generated documentation. The language is detected from the system locale and can be overridden with `--lang`.
8
+
9
+ ## 0.0.1 - 2023-09-02
10
+
11
+ Initial release.
package/README.md CHANGED
@@ -1,48 +1,39 @@
1
- # create
1
+ # @vited/create
2
2
 
3
- ## Install
3
+ Set up Vited documentation in the current project or another project directory.
4
4
 
5
- ### Run directly
5
+ ## Interactive setup
6
6
 
7
- ```bash
8
- npx create
9
- ```
10
-
11
- ### Install on system
7
+ Run without arguments to choose the project directory and theme, and whether to
8
+ install dependencies. The project directory defaults to the current working
9
+ directory, and the package manager is detected automatically:
12
10
 
13
11
  ```bash
14
- npm i -g create
15
- %binName%
12
+ pnpm dlx @vited/create
16
13
  ```
17
14
 
18
- ### Install in project
19
-
20
- ```bash
21
- npm i -D create
22
- ```
15
+ The language follows the system locale (`zh` for Chinese locales, otherwise
16
+ `en`). Override it with `--lang en` or `--lang zh`.
23
17
 
24
- Add script entry:
18
+ ## Command-line setup
25
19
 
26
- ```json
27
- {
28
- "scripts": {
29
- "%binName%": "%binName%"
30
- }
31
- }
20
+ ```bash
21
+ pnpm dlx @vited/create .
22
+ pnpm dlx @vited/create ../my-docs
32
23
  ```
33
24
 
34
- Run:
25
+ The default theme is `@vited/theme-mantine`. The package manager is detected
26
+ from the project configuration or the package manager used to run the command.
27
+ Override it and skip automatic dependency installation with:
35
28
 
36
29
  ```bash
37
- npm run %binName%
30
+ pnpm dlx @vited/create my-docs \
31
+ --theme @vited/theme-mantine \
32
+ --package-manager pnpm \
33
+ --no-install
38
34
  ```
39
35
 
40
- ## Options
41
-
42
- ### `--help`
43
-
44
- Show help
45
-
46
- ### `--version`
47
-
48
- Show version
36
+ The generated project includes `vited.config.ts`, a `docs` directory, and
37
+ `docs:dev` / `docs:build` scripts. `@vited/core` provides the HTML shell, so no
38
+ `index.html` is added to the project. Existing package scripts and documentation
39
+ files are preserved. An existing `vited.config.ts` is not overwritten.
@@ -0,0 +1,17 @@
1
+ export declare const THEMES: readonly ["@vited/theme-mantine"];
2
+ export type Theme = (typeof THEMES)[number];
3
+ export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
4
+ export type ProjectMode = 'create' | 'init';
5
+ export interface CreateOptions {
6
+ directory: string;
7
+ theme: Theme;
8
+ packageManager: PackageManager;
9
+ install: boolean;
10
+ }
11
+ export interface CreateResult {
12
+ projectPath: string;
13
+ mode: ProjectMode;
14
+ }
15
+ export declare function resolvePackageManager(projectPath: string, environment?: NodeJS.ProcessEnv): Promise<PackageManager>;
16
+ export declare function create({ directory, theme, packageManager, install }: CreateOptions): Promise<CreateResult>;
17
+ export declare function installPackages(projectPath: string, packageManager: PackageManager): Promise<void>;
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { t as THEMES, n as create, r as installPackages, i as resolvePackageManager } from "./src-CtHXEots.mjs";
@@ -0,0 +1,304 @@
1
+ import { spawn } from "node:child_process";
2
+ import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import process from "node:process";
5
+ import i18next from "i18next";
6
+ // src/i18n.ts
7
+ const LANGUAGES = ["en", "zh"];
8
+ const resources = {
9
+ en: { translation: {
10
+ cli: {
11
+ description: "Set up Vited documentation in a project directory",
12
+ directory: "Project directory",
13
+ interactive: "Start interactive setup",
14
+ theme: "Theme package",
15
+ packageManager: "Override detected package manager",
16
+ noInstall: "Skip dependency installation",
17
+ language: "Language for prompts and messages",
18
+ showHelp: "Show full help",
19
+ showVersion: "Show version number",
20
+ configured: "Vited documentation configured at {{path}}"
21
+ },
22
+ interactive: {
23
+ terminalRequired: "Interactive mode requires a terminal. Use --help for command-line options.",
24
+ intro: "Set up Vited documentation",
25
+ projectDirectory: "Project directory",
26
+ directoryRequired: "Please enter a directory.",
27
+ chooseTheme: "Choose a theme",
28
+ installDependencies: "Install dependencies now?",
29
+ cancelled: "Setup cancelled."
30
+ },
31
+ errors: {
32
+ invalidPackageManagerType: "Invalid package.json: packageManager must be a string in {{path}}",
33
+ unsupportedPackageManager: "Unsupported package manager in {{path}}: {{packageManager}}",
34
+ multipleLockfiles: "Multiple package manager lockfiles found in {{path}}. Set packageManager in package.json.",
35
+ installFailed: "{{packageManager}} install exited with code {{code}}",
36
+ projectNotDirectory: "Project path is not a directory: {{path}}",
37
+ alreadyConfigured: "Vited is already configured in {{path}}. Remove or rename vited.config.ts before running create again.",
38
+ docsNotDirectory: "Cannot create documentation: {{path}} is not a directory.",
39
+ invalidPackageJson: "Invalid package.json: expected a JSON object in {{path}}",
40
+ invalidPackageJsonSyntax: "Invalid JSON in package.json: {{path}}",
41
+ invalidPackageJsonField: "Invalid package.json: {{field}} must be an object."
42
+ },
43
+ template: { docsWelcome: "Welcome to your Vited documentation site." }
44
+ } },
45
+ zh: { translation: {
46
+ cli: {
47
+ description: "在项目目录中配置 Vited 文档",
48
+ directory: "项目目录",
49
+ interactive: "启动交互式配置",
50
+ theme: "主题包",
51
+ packageManager: "覆盖自动检测到的包管理器",
52
+ noInstall: "跳过依赖安装",
53
+ language: "提示和消息使用的语言",
54
+ showHelp: "显示帮助信息",
55
+ showVersion: "显示版本号",
56
+ configured: "已在 {{path}} 配置 Vited 文档"
57
+ },
58
+ interactive: {
59
+ terminalRequired: "交互模式需要终端。请使用 --help 查看命令行选项。",
60
+ intro: "配置 Vited 文档",
61
+ projectDirectory: "项目目录",
62
+ directoryRequired: "请输入项目目录。",
63
+ chooseTheme: "选择主题",
64
+ installDependencies: "现在安装依赖吗?",
65
+ cancelled: "已取消配置。"
66
+ },
67
+ errors: {
68
+ invalidPackageManagerType: "package.json 配置无效:{{path}} 中的 packageManager 必须是字符串",
69
+ unsupportedPackageManager: "{{path}} 中配置了不支持的包管理器:{{packageManager}}",
70
+ multipleLockfiles: "{{path}} 中存在多个包管理器锁文件,请在 package.json 中设置 packageManager。",
71
+ installFailed: "{{packageManager}} install 退出,代码为 {{code}}",
72
+ projectNotDirectory: "项目路径不是目录:{{path}}",
73
+ alreadyConfigured: "{{path}} 已配置 Vited。请删除或重命名 vited.config.ts 后再运行 create。",
74
+ docsNotDirectory: "无法创建文档:{{path}} 不是目录。",
75
+ invalidPackageJson: "package.json 无效:{{path}} 应为 JSON 对象",
76
+ invalidPackageJsonSyntax: "package.json 中的 JSON 无效:{{path}}",
77
+ invalidPackageJsonField: "package.json 无效:{{field}} 必须是对象。"
78
+ },
79
+ template: { docsWelcome: "欢迎使用 Vited 文档站点。" }
80
+ } }
81
+ };
82
+ const i18n = i18next.createInstance();
83
+ const systemLocale = process.env["LC_ALL"] || process.env["LC_MESSAGES"] || process.env["LANG"] || process.env["LANGUAGE"] || "en";
84
+ await i18n.init({
85
+ lng: languageFromLocale(systemLocale),
86
+ fallbackLng: "en",
87
+ resources,
88
+ interpolation: { escapeValue: false }
89
+ });
90
+ function languageFromLocale(locale) {
91
+ return /^zh(?:[-_.:]|$)/i.test(locale) ? "zh" : "en";
92
+ }
93
+ function isLanguage(value) {
94
+ return LANGUAGES.some((language) => language === value);
95
+ }
96
+ async function setLanguage(language) {
97
+ await i18n.changeLanguage(language);
98
+ }
99
+ function t(key, options) {
100
+ return options === void 0 ? i18n.t(key) : i18n.t(key, options);
101
+ }
102
+ // src/index.ts
103
+ const THEMES = ["@vited/theme-mantine"];
104
+ const vitedPackages = {
105
+ "@vited/cli": "^0.1.0",
106
+ "@vited/core": "^0.1.0",
107
+ "@vited/theme-mantine": "^0.1.0",
108
+ react: "^19.3.1",
109
+ "react-dom": "^19.3.1",
110
+ vite: "^8.3.5"
111
+ };
112
+ const packageManagerLockfiles = {
113
+ "bun.lock": "bun",
114
+ "bun.lockb": "bun",
115
+ "npm-shrinkwrap.json": "npm",
116
+ "package-lock.json": "npm",
117
+ "pnpm-lock.yaml": "pnpm",
118
+ "yarn.lock": "yarn"
119
+ };
120
+ async function resolvePackageManager(projectPath, environment = process.env) {
121
+ const resolvedProjectPath = path.resolve(projectPath);
122
+ const packageJsonPath = path.join(resolvedProjectPath, "package.json");
123
+ let packageJson;
124
+ try {
125
+ packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
126
+ } catch (error) {
127
+ if (isNodeError(error, "ENOENT")) packageJson = void 0;
128
+ else if (error instanceof SyntaxError) throw new SyntaxError(t("errors.invalidPackageJsonSyntax", { path: packageJsonPath }), { cause: error });
129
+ else throw error;
130
+ }
131
+ if (isRecord(packageJson) && packageJson["packageManager"] !== void 0) {
132
+ const configuredPackageManager = packageJson["packageManager"];
133
+ if (typeof configuredPackageManager !== "string") throw new TypeError(t("errors.invalidPackageManagerType", { path: packageJsonPath }));
134
+ const packageManager = getPackageManager(configuredPackageManager);
135
+ if (!packageManager) throw new TypeError(t("errors.unsupportedPackageManager", {
136
+ path: packageJsonPath,
137
+ packageManager: configuredPackageManager
138
+ }));
139
+ return packageManager;
140
+ }
141
+ const lockfileManagers = /* @__PURE__ */ new Set();
142
+ for (const [lockfile, packageManager] of Object.entries(packageManagerLockfiles)) if (await fileExists(path.join(resolvedProjectPath, lockfile))) lockfileManagers.add(packageManager);
143
+ const invokedPackageManager = getPackageManager(environment["npm_config_user_agent"] ?? "") ?? getPackageManager(path.basename(environment["npm_execpath"] ?? "").replace(/\.[^.]+$/, "").replace(/-cli$/, ""));
144
+ if (lockfileManagers.size === 1) return [...lockfileManagers][0];
145
+ if (lockfileManagers.size > 1) {
146
+ if (invokedPackageManager && lockfileManagers.has(invokedPackageManager)) return invokedPackageManager;
147
+ throw new Error(t("errors.multipleLockfiles", { path: projectPath }));
148
+ }
149
+ return invokedPackageManager ?? "pnpm";
150
+ }
151
+ async function create({ directory, theme, packageManager, install }) {
152
+ const projectPath = path.resolve(directory);
153
+ const mode = await validateTarget(projectPath);
154
+ const packageJsonPath = path.join(projectPath, "package.json");
155
+ const packageJson = await readProjectPackageJson(packageJsonPath, projectPath);
156
+ addVitedConfiguration(packageJson, projectPath, theme);
157
+ await mkdir(projectPath, { recursive: true });
158
+ const docsPath = path.join(projectPath, "docs");
159
+ await mkdir(docsPath, { recursive: true });
160
+ await writeFile(packageJsonPath, `${JSON.stringify(packageJson, void 0, 2)}\n`);
161
+ await writeFile(path.join(projectPath, "vited.config.ts"), makeVitedConfig(packageJson, theme), { flag: "wx" });
162
+ await writeIfMissing(path.join(docsPath, "README.md"), makeReadme(packageJson));
163
+ if (install) await installPackages(projectPath, packageManager);
164
+ return {
165
+ projectPath,
166
+ mode
167
+ };
168
+ }
169
+ async function installPackages(projectPath, packageManager) {
170
+ await new Promise((resolve, reject) => {
171
+ const child = spawn(packageManager, ["install"], {
172
+ cwd: projectPath,
173
+ stdio: "inherit"
174
+ });
175
+ child.once("error", reject);
176
+ child.once("close", (code) => {
177
+ if (code === 0) resolve();
178
+ else reject(new Error(t("errors.installFailed", {
179
+ packageManager,
180
+ code: code === null ? "unknown" : code
181
+ })));
182
+ });
183
+ });
184
+ }
185
+ async function validateTarget(projectPath) {
186
+ let projectStat;
187
+ try {
188
+ projectStat = await stat(projectPath);
189
+ } catch (error) {
190
+ if (isNodeError(error, "ENOENT")) return "create";
191
+ throw error;
192
+ }
193
+ if (!projectStat.isDirectory()) throw new Error(t("errors.projectNotDirectory", { path: projectPath }));
194
+ const configPath = path.join(projectPath, "vited.config.ts");
195
+ let configExists = false;
196
+ try {
197
+ await stat(configPath);
198
+ configExists = true;
199
+ } catch (error) {
200
+ if (!isNodeError(error, "ENOENT")) throw error;
201
+ }
202
+ if (configExists) throw new Error(t("errors.alreadyConfigured", { path: projectPath }));
203
+ const docsPath = path.join(projectPath, "docs");
204
+ try {
205
+ if (!(await stat(docsPath)).isDirectory()) throw new Error(t("errors.docsNotDirectory", { path: docsPath }));
206
+ } catch (error) {
207
+ if (!isNodeError(error, "ENOENT")) throw error;
208
+ }
209
+ return "init";
210
+ }
211
+ async function readProjectPackageJson(packageJsonPath, projectPath) {
212
+ try {
213
+ const contents = await readFile(packageJsonPath, "utf8");
214
+ let value;
215
+ try {
216
+ value = JSON.parse(contents);
217
+ } catch (error) {
218
+ if (error instanceof SyntaxError) throw new SyntaxError(t("errors.invalidPackageJsonSyntax", { path: packageJsonPath }), { cause: error });
219
+ throw error;
220
+ }
221
+ if (!isRecord(value)) throw new TypeError(t("errors.invalidPackageJson", { path: packageJsonPath }));
222
+ return value;
223
+ } catch (error) {
224
+ if (isNodeError(error, "ENOENT")) return {
225
+ name: toPackageName(path.basename(projectPath)),
226
+ version: "0.0.0",
227
+ private: true,
228
+ type: "module"
229
+ };
230
+ throw error;
231
+ }
232
+ }
233
+ function addVitedConfiguration(packageJson, projectPath, theme) {
234
+ if (typeof packageJson["name"] !== "string" || packageJson["name"].length === 0) packageJson["name"] = toPackageName(path.basename(projectPath));
235
+ if (packageJson["type"] === void 0) packageJson["type"] = "module";
236
+ const scripts = getRecord(packageJson["scripts"], "scripts");
237
+ scripts["docs:dev"] ??= "vited dev";
238
+ scripts["docs:build"] ??= "vited build";
239
+ packageJson["scripts"] = scripts;
240
+ const dependencies = getRecord(packageJson["dependencies"], "dependencies");
241
+ const devDependencies = getRecord(packageJson["devDependencies"], "devDependencies");
242
+ for (const [name, version] of Object.entries(vitedPackages)) {
243
+ if (name === "@vited/theme-mantine" && theme !== name) continue;
244
+ if (dependencies[name] === void 0 && devDependencies[name] === void 0) devDependencies[name] = version;
245
+ }
246
+ packageJson["devDependencies"] = devDependencies;
247
+ }
248
+ function getRecord(value, name) {
249
+ if (value === void 0) return {};
250
+ if (!isRecord(value)) throw new Error(t("errors.invalidPackageJsonField", { field: name }));
251
+ return value;
252
+ }
253
+ function isRecord(value) {
254
+ return typeof value === "object" && value === Object(value) && !Array.isArray(value);
255
+ }
256
+ function isNodeError(error, code) {
257
+ return error instanceof Error && "code" in error && error.code === code;
258
+ }
259
+ function getPackageManager(value) {
260
+ switch (/^(npm|pnpm|yarn|bun)(?:[@/]|$)/.exec(value)?.[1]) {
261
+ case "npm": return "npm";
262
+ case "pnpm": return "pnpm";
263
+ case "yarn": return "yarn";
264
+ case "bun": return "bun";
265
+ default: return;
266
+ }
267
+ }
268
+ async function fileExists(filePath) {
269
+ try {
270
+ await stat(filePath);
271
+ return true;
272
+ } catch (error) {
273
+ if (isNodeError(error, "ENOENT")) return false;
274
+ throw error;
275
+ }
276
+ }
277
+ function toPackageName(value) {
278
+ return value.toLowerCase().replaceAll(/[^a-z0-9._-]+/g, "-").replaceAll(/^-+|-+$/g, "") || "vited-docs";
279
+ }
280
+ function makeVitedConfig(packageJson, theme) {
281
+ const title = typeof packageJson["name"] === "string" && packageJson["name"].length > 0 ? packageJson["name"] : "Vited documentation";
282
+ return [
283
+ "import { defineConfig } from '@vited/core';",
284
+ "",
285
+ "export default defineConfig({",
286
+ " docs: {",
287
+ ` title: ${JSON.stringify(title)},`,
288
+ ` theme: ${JSON.stringify(theme)},`,
289
+ " },",
290
+ "});",
291
+ ""
292
+ ].join("\n");
293
+ }
294
+ function makeReadme(packageJson) {
295
+ return `# ${typeof packageJson["name"] === "string" && packageJson["name"].length > 0 ? packageJson["name"] : "Vited documentation"}\n\n${t("template.docsWelcome")}\n`;
296
+ }
297
+ async function writeIfMissing(filePath, content) {
298
+ try {
299
+ await writeFile(filePath, content, { flag: "wx" });
300
+ } catch (error) {
301
+ if (!isNodeError(error, "EEXIST")) throw error;
302
+ }
303
+ }
304
+ export { LANGUAGES as a, t as c, resolvePackageManager as i, create as n, isLanguage as o, installPackages as r, setLanguage as s, THEMES as t };
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,92 @@
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-CtHXEots.mjs";
3
+ import process from "node:process";
4
+ import console from "node:console";
5
+ import { Command, Option } from "commander";
6
+ import { cancel, confirm, intro, isCancel, outro, select, text } from "@clack/prompts";
7
+ // package.json
8
+ var version = "0.0.2";
9
+ // src/interactive.ts
10
+ async function runInteractive() {
11
+ if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error(t("interactive.terminalRequired"));
12
+ intro(t("interactive.intro"));
13
+ const defaultDirectory = process.cwd();
14
+ const directory = await text({
15
+ message: t("interactive.projectDirectory"),
16
+ placeholder: defaultDirectory,
17
+ initialValue: defaultDirectory,
18
+ validate(value) {
19
+ if (!value?.trim()) return t("interactive.directoryRequired");
20
+ }
21
+ });
22
+ if (isCancel(directory)) {
23
+ cancel(t("interactive.cancelled"));
24
+ return;
25
+ }
26
+ const packageManager = await resolvePackageManager(directory);
27
+ const theme = await select({
28
+ message: t("interactive.chooseTheme"),
29
+ options: THEMES.map((value) => ({
30
+ value,
31
+ label: value
32
+ }))
33
+ });
34
+ if (isCancel(theme)) {
35
+ cancel(t("interactive.cancelled"));
36
+ return;
37
+ }
38
+ const install = await confirm({
39
+ message: t("interactive.installDependencies"),
40
+ initialValue: true
41
+ });
42
+ if (isCancel(install)) {
43
+ cancel(t("interactive.cancelled"));
44
+ return;
45
+ }
46
+ const result = await create({
47
+ directory,
48
+ theme,
49
+ packageManager,
50
+ install
51
+ });
52
+ outro(t("cli.configured", { path: result.projectPath }));
53
+ }
54
+ // src/vited-create.ts
55
+ function getLanguageArgument(args) {
56
+ const index = args.indexOf("--lang");
57
+ if (index !== -1) return args[index + 1];
58
+ return args.find((argument) => argument.startsWith("--lang="))?.slice(7);
59
+ }
60
+ const requestedLanguage = getLanguageArgument(process.argv.slice(2));
61
+ if (isLanguage(requestedLanguage)) await setLanguage(requestedLanguage);
62
+ const program = new Command("vited-create");
63
+ program.description(t("cli.description")).argument("[directory]", t("cli.directory")).option("-i, --interactive", t("cli.interactive")).addOption(new Option("--theme <package>", t("cli.theme")).choices([...THEMES])).addOption(new Option("--package-manager <manager>", t("cli.packageManager")).choices([
64
+ "pnpm",
65
+ "npm",
66
+ "yarn",
67
+ "bun"
68
+ ])).option("--no-install", t("cli.noInstall")).addOption(new Option("--lang <language>", t("cli.language")).choices([...LANGUAGES])).action(async (directory, options) => {
69
+ const hasOptions = directory !== void 0 || options.theme !== void 0 || options.packageManager !== void 0 || options.install === false;
70
+ if (options.interactive || !hasOptions) {
71
+ await runInteractive();
72
+ return;
73
+ }
74
+ const theme = options.theme ?? THEMES[0];
75
+ const packageManager = options.packageManager ?? await resolvePackageManager(directory ?? ".");
76
+ const result = await create({
77
+ directory: directory ?? ".",
78
+ theme,
79
+ packageManager,
80
+ install: options.install
81
+ });
82
+ console.log(t("cli.configured", { path: result.projectPath }));
83
+ });
84
+ program.helpOption("-h, --help", t("cli.showHelp"));
85
+ program.version(version, "-v, --version", t("cli.showVersion"));
86
+ try {
87
+ await program.parseAsync();
88
+ } catch (error) {
89
+ console.error(error instanceof Error ? error.message : String(error));
90
+ process.exitCode = 1;
91
+ }
92
+ export {};
package/package.json CHANGED
@@ -1,27 +1,29 @@
1
1
  {
2
2
  "name": "@vited/create",
3
- "version": "0.0.1",
4
- "description": "Vited template initialization",
5
- "keywords": [],
3
+ "version": "0.0.2",
4
+ "description": "Create and initialize Vited documentation projects",
5
+ "keywords": [
6
+ "cli",
7
+ "documentation",
8
+ "vited"
9
+ ],
6
10
  "homepage": "https://github.com/vitedjs/create#readme",
7
11
  "bugs": {
8
12
  "url": "https://github.com/vitedjs/create/issues"
9
13
  },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/vitedjs/create.git"
13
- },
14
- "funding": "https://github.com/sponsors/guoyunhe",
15
14
  "license": "MIT",
16
15
  "author": {
17
16
  "name": "Guo Yunhe",
18
- "email": "i@guoyunhe.me"
17
+ "email": "i@guoyunhe.me",
18
+ "url": "https://guoyunhe.me/"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/vitedjs/create.git"
19
23
  },
20
- "main": "dist/index.js",
21
- "module": "dist/index.mjs",
22
- "typings": "dist/index.d.ts",
24
+ "funding": "https://ko-fi.com/guoyunhe",
23
25
  "bin": {
24
- "vited-create": "dist/create.js"
26
+ "vited-create": "./dist/vited-create.mjs"
25
27
  },
26
28
  "files": [
27
29
  "dist",
@@ -29,32 +31,69 @@
29
31
  "LICENSE",
30
32
  "README.md"
31
33
  ],
32
- "prettier": {
33
- "printWidth": 100,
34
- "singleQuote": true
35
- },
36
- "eslintConfig": {
37
- "extends": "@guoyunhe/node-scripts"
38
- },
39
- "jest": {
40
- "preset": "@guoyunhe/node-scripts"
34
+ "type": "module",
35
+ "main": "./dist/index.mjs",
36
+ "types": "./dist/index.d.mts",
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/index.d.mts",
40
+ "import": "./dist/index.mjs"
41
+ }
41
42
  },
42
43
  "dependencies": {
43
- "commander": "^10.0.0"
44
+ "@clack/prompts": "^1.8.1",
45
+ "commander": "^11.0.0",
46
+ "i18next": "^26.5.11"
44
47
  },
45
48
  "devDependencies": {
46
- "@guoyunhe/node-scripts": "^2.2.0",
49
+ "@guoyunhe/editorconfig": "^0.3.0",
50
+ "@guoyunhe/oxfmt-config": "^1.1.0",
47
51
  "@tsconfig/node20": "^20.1.2",
48
- "@tsconfig/strictest": "^2.0.1",
49
- "@types/jest": "^29.5.2",
50
- "@types/node": "^20.3.1",
51
- "typescript": "^5.1.3"
52
+ "@tsconfig/strictest": "^2.0.2",
53
+ "@types/node": "^20.5.8",
54
+ "@vited/cli": "^0.1.0",
55
+ "@vited/core": "^0.1.0",
56
+ "@vited/theme-mantine": "^0.1.0",
57
+ "husky": "^9.1.7",
58
+ "lint-staged": "^17.6.0",
59
+ "oxfmt": "^0.75.0",
60
+ "oxlint": "^1.90.0",
61
+ "oxlint-config-recommended": "^1.1.0",
62
+ "react": "^19.3.1",
63
+ "react-dom": "^19.3.1",
64
+ "tsdown": "^0.23.2",
65
+ "tsx": "^4.23.15",
66
+ "typescript": "^5.2.2",
67
+ "vite": "^8.3.5",
68
+ "vitest": "^5.0.5"
69
+ },
70
+ "lint-staged": {
71
+ "*.{js,mjs,cjs,ts,mts,cts,jsx,tsx,vue}": [
72
+ "oxfmt --write",
73
+ "oxlint --fix"
74
+ ],
75
+ "*.css": "oxfmt --write",
76
+ "*.{json,jsonc,scss,less,htm,html,md,mdx,yaml,yml}": "oxfmt --write"
77
+ },
78
+ "devEngines": {
79
+ "packageManager": {
80
+ "name": "pnpm",
81
+ "version": ">=12.15.0",
82
+ "onFail": "error"
83
+ }
84
+ },
85
+ "engines": {
86
+ "node": "^26.12.1 || ^24.22.1 || ^22.23.4"
52
87
  },
53
88
  "scripts": {
54
- "build": "node-scripts build",
55
- "format": "node-scripts format",
56
- "lint": "node-scripts lint",
57
- "test": "node-scripts test",
58
- "watch": "node-scripts watch"
89
+ "build": "tsdown",
90
+ "dev": "tsx src/vited-create.ts",
91
+ "docs:build": "vited build",
92
+ "docs:dev": "vited dev",
93
+ "format": "oxfmt --write .",
94
+ "format:check": "oxfmt --check .",
95
+ "lint": "oxlint",
96
+ "test": "vitest run",
97
+ "test:watch": "vitest"
59
98
  }
60
99
  }