@shark-pepper/create-app 1.0.4 → 1.0.5

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/README.md CHANGED
@@ -1,28 +1,27 @@
1
1
  # 🦈 @shark-pepper/create-app
2
2
 
3
- > 🚀 一键创建现代化前端项目的脚手架工具。
4
- > 支持 React + TypeScript + Webpack + ESLint + Prettier + Jest 等主流配置。
3
+ > 🚀 A scaffolding tool for creating modern front-end projects.
4
+ > It supports mainstream configurations such as React, TypeScript, Webpack, ESLint, Prettier, and Jest.
5
5
 
6
6
  ---
7
7
 
8
- ## ✨ 特性
8
+ ## ✨ Characteristic
9
9
 
10
- - 🧱 内置多种模板(React、Vue)
11
- - ⚙️ 默认集成 ESLint、Prettier、Husky、Commitlint 等规范工具
12
- - 🧪 支持 Jest 单元测试
10
+ - ⚙️ By default, it integrates specification tools such as ESLint, Prettier, Husky, and Commitlint.
11
+ - 🧪 Supports Jest unit testing
13
12
 
14
13
  ---
15
14
 
16
- ## 📦 快速开始
15
+ ## 📦 Quick Start
17
16
 
18
- ### 使用 npx(推荐)
17
+ ### Use npx (recommended)
19
18
 
20
19
  ```bash
21
20
  npx @shark-pepper/create-app my-project
22
21
 
23
22
  ```
24
23
 
25
- ### 或全局安装
24
+ ### Or install globally
26
25
 
27
26
  ```bash
28
27
  npm install -g @shark-pepper/create-app
@@ -35,7 +35,10 @@ const installCmd = hasPnpm() ? "pnpm install" : "npm install";
35
35
  function getTemplatePath(templateName) {
36
36
  const templatePath = path.resolve(__dirname, "../templates", templateName);
37
37
  if (!fs.existsSync(templatePath)) {
38
- console.error(symbols.error, chalk.red(`模板不存在: ${templatePath}`));
38
+ console.error(
39
+ symbols.error,
40
+ chalk.red(`Template does not exist: ${templatePath}`)
41
+ );
39
42
  process.exit(1);
40
43
  }
41
44
  return templatePath;
@@ -57,16 +60,19 @@ async function copyTemplate(src, dest) {
57
60
  return true;
58
61
  },
59
62
  });
60
- console.log(symbols.success, chalk.green("✅ 模板文件复制完成"));
63
+ console.log(
64
+ symbols.success,
65
+ chalk.green("✅ Template file copy completed")
66
+ );
61
67
  } catch (err) {
62
- console.error(symbols.error, chalk.red("模板复制失败"), err);
68
+ console.error(symbols.error, chalk.red("Template copy failed"), err);
63
69
  process.exit(1);
64
70
  }
65
71
  }
66
72
 
67
73
  // Husky + lint-staged 配置
68
74
  function setupHusky(projectPath) {
69
- console.log(chalk.blue("⚙️ 配置 Husky + lint-staged ..."));
75
+ console.log(chalk.blue("⚙️ Configure Husky + lint-staged ..."));
70
76
 
71
77
  try {
72
78
  // 执行 husky install
@@ -85,15 +91,18 @@ function setupHusky(projectPath) {
85
91
  );
86
92
  }
87
93
 
88
- console.log(symbols.success, chalk.green("✅ Husky + lint-staged 已配置"));
94
+ console.log(
95
+ symbols.success,
96
+ chalk.green("✅ Husky + lint-staged is configured.")
97
+ );
89
98
  } catch (err) {
90
- console.error(symbols.error, chalk.red("Husky 配置失败"), err);
99
+ console.error(symbols.error, chalk.red("Husky configuration failed."), err);
91
100
  }
92
101
  }
93
102
 
94
103
  // Jest 配置
95
104
  function setupJest(projectPath) {
96
- console.log(chalk.blue("⚙️ 配置 Jest 测试环境..."));
105
+ console.log(chalk.blue("⚙️ Configuring the Jest testing environment..."));
97
106
 
98
107
  try {
99
108
  // 安装依赖
@@ -156,9 +165,12 @@ module.exports = {
156
165
  const fileMock = `module.exports = 'test-file-stub';\n`;
157
166
  fs.writeFileSync(path.join(mocksDir, "fileMock.js"), fileMock, "utf-8");
158
167
 
159
- console.log(symbols.success, chalk.green("✅ Jest 配置完成"));
168
+ console.log(
169
+ symbols.success,
170
+ chalk.green("✅ Jest configuration complete")
171
+ );
160
172
  } catch (err) {
161
- console.error(symbols.error, chalk.red("Jest 配置失败"), err);
173
+ console.error(symbols.error, chalk.red("Jest configuration failed."), err);
162
174
  }
163
175
  }
164
176
 
@@ -170,32 +182,32 @@ async function run() {
170
182
  {
171
183
  type: "input",
172
184
  name: "projectName",
173
- message: "请输入项目名称:",
185
+ message: "Project Name: ",
174
186
  default: "my-app",
175
187
  when: () => !projectNameArg,
176
188
  },
177
189
  {
178
190
  type: "input",
179
191
  name: "version",
180
- message: "请输入项目版本号:",
192
+ message: "Version: ",
181
193
  default: "1.0.0",
182
194
  },
183
195
  {
184
196
  type: "input",
185
197
  name: "description",
186
- message: "请输入项目描述:",
187
- default: "A project created by create-app-cli",
198
+ message: "Description: ",
199
+ default: "A project created by @shark-pepper/create-app",
188
200
  },
189
201
  {
190
202
  type: "list",
191
203
  name: "template",
192
- message: "请选择项目模板:",
193
- choices: ["react-app", "vue-app"],
204
+ message: "Select a project template: ",
205
+ choices: ["react-app"],
194
206
  },
195
207
  {
196
208
  type: "confirm",
197
209
  name: "useJest",
198
- message: "是否生成基于 Jest 的单元测试配置?",
210
+ message: "Need to generate a Jest-based unit test configuration",
199
211
  default: true,
200
212
  },
201
213
  ]);
@@ -205,12 +217,15 @@ async function run() {
205
217
 
206
218
  const projectPath = path.join(process.cwd(), projectName);
207
219
  if (fs.existsSync(projectPath)) {
208
- console.log(symbols.error, chalk.red(`目录 ${projectName} 已存在!`));
220
+ console.log(
221
+ symbols.error,
222
+ chalk.red(`The directory ${projectName} already exists!`)
223
+ );
209
224
  process.exit(1);
210
225
  }
211
226
 
212
227
  fs.mkdirSync(projectPath);
213
- console.log(symbols.info, chalk.blue("📁 创建项目目录中..."));
228
+ console.log(symbols.info, chalk.blue("📁 Create a project directory..."));
214
229
 
215
230
  // 复制模板
216
231
  const templatePath = getTemplatePath(template);
@@ -226,12 +241,19 @@ async function run() {
226
241
  pkgData.description = description;
227
242
  fs.writeFileSync(pkgPath, JSON.stringify(pkgData, null, 2), "utf-8");
228
243
  fs.unlinkSync(basePkgPath);
229
- console.log(symbols.success, chalk.green("✅ 已生成 package.json"));
244
+ console.log(
245
+ symbols.success,
246
+ chalk.green("✅ package.json has been generated")
247
+ );
230
248
  }
231
249
 
232
250
  // 安装依赖
233
251
  console.log(
234
- chalk.yellow(`📦 正在使用 ${installCmd.split(" ")[0]} 安装依赖...`)
252
+ chalk.yellow(
253
+ `📦 Dependencies are being installed using ${
254
+ installCmd.split(" ")[0]
255
+ }...`
256
+ )
235
257
  );
236
258
  execSync(installCmd, { cwd: projectPath, stdio: "inherit" });
237
259
 
@@ -243,13 +265,13 @@ async function run() {
243
265
 
244
266
  console.log(
245
267
  symbols.success,
246
- chalk.green(`🎉 项目 ${projectName} 创建成功!`)
268
+ chalk.green(`🎉 Project ${projectName} created successfully!`)
247
269
  );
248
- console.log(chalk.cyan(`👉 运行项目:`));
270
+ console.log(chalk.cyan(`👉 Run the project:`));
249
271
  console.log(chalk.white(` cd ${projectName}`));
250
272
  console.log(chalk.white(` npm start`));
251
273
  } catch (err) {
252
- console.error(symbols.error, chalk.red("创建项目失败!"), err);
274
+ console.error(symbols.error, chalk.red("Project creation failed!"), err);
253
275
  }
254
276
  }
255
277
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shark-pepper/create-app",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -0,0 +1,17 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "useBuiltIns": "usage",
7
+ "corejs": "3",
8
+ "targets": {
9
+ "chrome": "58",
10
+ "ie": "11"
11
+ }
12
+ }
13
+ ],
14
+ "@babel/preset-react",
15
+ "@babel/preset-typescript"
16
+ ]
17
+ }
@@ -4,8 +4,8 @@
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "start": "webpack serve --open --mode development",
8
- "build": "webpack --mode production",
7
+ "start": "webpack serve --open --mode development --config webpack/webpack.dev.js",
8
+ "build": "webpack --mode production --config webpack/webpack.prod.js",
9
9
  "prepare": "husky install",
10
10
  "test": "echo \"Error: no test specified\" && exit 1"
11
11
  },
@@ -14,19 +14,28 @@
14
14
  "license": "ISC",
15
15
  "packageManager": "pnpm@10.18.1",
16
16
  "dependencies": {
17
- "normalize.css": "^8.0.1",
18
17
  "react": "^19.2.0",
19
18
  "react-dom": "^19.2.0",
20
19
  "react-router-dom": "^7.9.5"
21
20
  },
22
21
  "devDependencies": {
22
+ "@babel/core": "^7.28.5",
23
+ "@babel/preset-env": "^7.28.5",
24
+ "@babel/preset-react": "^7.28.5",
25
+ "@babel/preset-typescript": "^7.28.5",
26
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.6.2",
27
+ "@types/css-modules": "^1.0.5",
23
28
  "@types/react": "^19.2.2",
24
29
  "@types/react-dom": "^19.2.2",
25
30
  "@types/react-router-dom": "^5.3.3",
26
31
  "@typescript-eslint/eslint-plugin": "^8.46.2",
27
32
  "@typescript-eslint/parser": "^8.46.2",
33
+ "babel-loader": "^10.0.0",
34
+ "core-js": "^3.47.0",
28
35
  "cspell": "^9.2.2",
29
36
  "css-loader": "^7.1.2",
37
+ "esbuild": "^0.27.0",
38
+ "esbuild-loader": "^4.4.0",
30
39
  "eslint": "^9.38.0",
31
40
  "eslint-webpack-plugin": "^5.0.2",
32
41
  "fork-ts-checker-webpack-plugin": "^9.1.0",
@@ -36,22 +45,18 @@
36
45
  "mini-css-extract-plugin": "^2.9.4",
37
46
  "postcss-loader": "^8.2.0",
38
47
  "prettier": "^3.6.2",
48
+ "react-refresh": "^0.18.0",
39
49
  "sass": "^1.93.3",
40
50
  "sass-loader": "^16.0.6",
41
51
  "style-loader": "^4.0.0",
42
- "ts-loader": "^9.5.4",
43
52
  "typescript": "^5.9.3",
44
53
  "webpack": "^5.102.1",
45
54
  "webpack-cli": "^6.0.1",
46
- "webpack-dev-server": "^5.2.2"
55
+ "webpack-dev-server": "^5.2.2",
56
+ "webpack-merge": "^6.0.1"
47
57
  },
48
58
  "lint-staged": {
49
- "*.{ts,tsx,js,jsx}": [
50
- "eslint --fix",
51
- "prettier --write"
52
- ],
53
- "*.{css,scss,less,json,md}": [
54
- "prettier --write"
55
- ]
59
+ "*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write"],
60
+ "*.{css,scss,less,json,md}": ["prettier --write"]
56
61
  }
57
62
  }