@shark-pepper/create-app 1.0.2 → 1.0.3

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.
@@ -46,9 +46,18 @@ async function copyTemplate(src, dest) {
46
46
  try {
47
47
  await fse.copy(src, dest, {
48
48
  overwrite: true,
49
- filter: (srcPath) => !srcPath.includes("node_modules"),
49
+ filter: (srcPath) => {
50
+ const relPath = path.relative(src, srcPath);
51
+ if (!relPath) return true; // 根目录
52
+ // 忽略 node_modules 目录和某些隐藏文件
53
+ if (relPath.split(path.sep).includes("node_modules")) return false;
54
+ if (relPath.startsWith(".git")) return false;
55
+ if (relPath.startsWith(".DS_Store")) return false;
56
+
57
+ return true;
58
+ },
50
59
  });
51
- console.log(symbols.success, chalk.green("✅ 模板文件复制完成"));
60
+ console.log(symbols.success, chalk.green("✅ 模板文件复制完成"));
52
61
  } catch (err) {
53
62
  console.error(symbols.error, chalk.red("模板复制失败"), err);
54
63
  process.exit(1);
@@ -76,7 +85,7 @@ function setupHusky(projectPath) {
76
85
  );
77
86
  }
78
87
 
79
- console.log(symbols.success, chalk.green("✅ Husky + lint-staged 已配置"));
88
+ console.log(symbols.success, chalk.green("✅ Husky + lint-staged 已配置"));
80
89
  } catch (err) {
81
90
  console.error(symbols.error, chalk.red("Husky 配置失败"), err);
82
91
  }
@@ -147,7 +156,7 @@ module.exports = {
147
156
  const fileMock = `module.exports = 'test-file-stub';\n`;
148
157
  fs.writeFileSync(path.join(mocksDir, "fileMock.js"), fileMock, "utf-8");
149
158
 
150
- console.log(symbols.success, chalk.green("✅ Jest 配置完成"));
159
+ console.log(symbols.success, chalk.green("✅ Jest 配置完成"));
151
160
  } catch (err) {
152
161
  console.error(symbols.error, chalk.red("Jest 配置失败"), err);
153
162
  }
@@ -201,7 +210,7 @@ async function run() {
201
210
  }
202
211
 
203
212
  fs.mkdirSync(projectPath);
204
- console.log(symbols.info, chalk.blue("📁 创建项目目录中..."));
213
+ console.log(symbols.info, chalk.blue("📁 创建项目目录中..."));
205
214
 
206
215
  // 复制模板
207
216
  const templatePath = getTemplatePath(template);
@@ -217,12 +226,12 @@ async function run() {
217
226
  pkgData.description = description;
218
227
  fs.writeFileSync(pkgPath, JSON.stringify(pkgData, null, 2), "utf-8");
219
228
  fs.unlinkSync(basePkgPath);
220
- console.log(symbols.success, chalk.green("✅ 已生成 package.json"));
229
+ console.log(symbols.success, chalk.green("✅ 已生成 package.json"));
221
230
  }
222
231
 
223
232
  // 安装依赖
224
233
  console.log(
225
- chalk.yellow(`📦 正在使用 ${installCmd.split(" ")[0]} 安装依赖...`)
234
+ chalk.yellow(`📦 正在使用 ${installCmd.split(" ")[0]} 安装依赖...`)
226
235
  );
227
236
  execSync(installCmd, { cwd: projectPath, stdio: "inherit" });
228
237
 
@@ -236,7 +245,7 @@ async function run() {
236
245
  symbols.success,
237
246
  chalk.green(`🎉 项目 ${projectName} 创建成功!`)
238
247
  );
239
- console.log(chalk.cyan(`👉 运行项目:`));
248
+ console.log(chalk.cyan(`👉 运行项目:`));
240
249
  console.log(chalk.white(` cd ${projectName}`));
241
250
  console.log(chalk.white(` npm start`));
242
251
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shark-pepper/create-app",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",