create-golden 1.4.3 → 1.4.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.
Files changed (2) hide show
  1. package/index.js +16 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -141,7 +141,7 @@ function saveToken(token) {
141
141
 
142
142
  function updateGitignore(projectRoot) {
143
143
  const gitignorePath = path.join(projectRoot, '.gitignore');
144
- const ignoreRule = '.cursorrules';
144
+ const ignoreRules = ['.cursorrules', '代码规范.md', 'AGENTS.md'];
145
145
 
146
146
  try {
147
147
  let gitignoreContent = '';
@@ -149,16 +149,24 @@ function updateGitignore(projectRoot) {
149
149
  gitignoreContent = fs.readFileSync(gitignorePath, 'utf8');
150
150
  }
151
151
 
152
- // 检查是否已经包含 .cursorrules
153
152
  const lines = gitignoreContent.split('\n');
154
- const hasCursorrules = lines.some(line => line.trim() === ignoreRule);
153
+ let hasChanges = false;
155
154
 
156
- if (!hasCursorrules) {
157
- // 如果文件不为空且最后一行不是空行,添加换行
158
- if (gitignoreContent && !gitignoreContent.endsWith('\n')) {
159
- gitignoreContent += '\n';
155
+ // 检查并添加每个忽略规则
156
+ for (const ignoreRule of ignoreRules) {
157
+ const hasRule = lines.some(line => line.trim() === ignoreRule);
158
+
159
+ if (!hasRule) {
160
+ // 如果文件不为空且最后一行不是空行,添加换行
161
+ if (gitignoreContent && !gitignoreContent.endsWith('\n')) {
162
+ gitignoreContent += '\n';
163
+ }
164
+ gitignoreContent += ignoreRule + '\n';
165
+ hasChanges = true;
160
166
  }
161
- gitignoreContent += ignoreRule + '\n';
167
+ }
168
+
169
+ if (hasChanges) {
162
170
  fs.writeFileSync(gitignorePath, gitignoreContent, 'utf8');
163
171
  }
164
172
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-golden",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "Create a new golden-template project from the latest GitHub repository (requires GITHUB_TOKEN)",
5
5
  "main": "index.js",
6
6
  "bin": {