create-tengits-app 1.1.4 → 1.1.6

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.
Files changed (3) hide show
  1. package/.gitignore +28 -0
  2. package/bin/cli.js +26 -0
  3. package/package.json +3 -2
package/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # dependencies
4
+ **/node_modules
5
+ # roadhog-api-doc ignore
6
+ /src/utils/request-temp.js
7
+ _roadhog-api-doc
8
+
9
+ # production
10
+ **/dist*
11
+ **/build*
12
+
13
+ # misc
14
+ .DS_Store
15
+ npm-debug.log*
16
+ yarn-error.log
17
+
18
+ /coverage
19
+ .idea
20
+ yarn.lock
21
+ package-lock.json
22
+ *bak
23
+
24
+ # visual studio code
25
+ .history
26
+ dist.rar
27
+ dist.zip
28
+ /.claude
package/bin/cli.js CHANGED
@@ -249,6 +249,32 @@ const createProject = async () => {
249
249
  }
250
250
  });
251
251
 
252
+ // 强制确保 .gitignore 存在(兼容 npm 发包可能遗漏的情况)
253
+ const targetGitignore = path.join(targetDir, '.gitignore');
254
+ if (!fs.existsSync(targetGitignore)) {
255
+ const candidates = [
256
+ path.join(templateDir, '.gitignore'),
257
+ path.join(templateDir, 'gitignore'), // 若采用 CRA 风格存储为 gitignore
258
+ ];
259
+ let copied = false;
260
+ for (const cand of candidates) {
261
+ if (fs.existsSync(cand)) {
262
+ try {
263
+ fs.copyFileSync(cand, targetGitignore);
264
+ copied = true;
265
+ console.log('✅ 已生成 .gitignore');
266
+ break;
267
+ } catch (_) {}
268
+ }
269
+ }
270
+
271
+ if (!copied) {
272
+ const defaultContent = `# dependencies\n**/node_modules\n\n# production\n**/dist*\n**/build*\n\n# misc\n.DS_Store\nnpm-debug.log*\nyarn-error.log\n\n/coverage\n.idea\nyarn.lock\npackage-lock.json\n*bak\n\n# editor history\n.history\n\n# archives\ndist.rar\ndist.zip\n\n# other\n/.claude\n`;
273
+ fs.writeFileSync(targetGitignore, defaultContent, { encoding: 'utf8' });
274
+ console.log('✅ 已创建默认 .gitignore');
275
+ }
276
+ }
277
+
252
278
  // 根据项目类型复制 packages 目录
253
279
  const packagesSrcDir = path.join(templateDir, 'packages');
254
280
  const packagesDestDir = path.join(targetDir, 'packages');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tengits-app",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "🚀 快速创建基于 React + Rsbuild + TypeScript + Tailwind CSS + Antd 的现代前端项目脚手架",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -34,7 +34,8 @@
34
34
  "*.yaml",
35
35
  "*.md",
36
36
  "*.mjs",
37
- "*.d.ts"
37
+ "*.d.ts",
38
+ ".gitignore"
38
39
  ],
39
40
  "scripts": {
40
41
  "start": "pnpm --filter main start",