create-sdd-project 0.9.3 → 0.9.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/lib/upgrade-generator.js +9 -4
- package/package.json +1 -1
package/lib/upgrade-generator.js
CHANGED
|
@@ -239,10 +239,15 @@ function generateUpgrade(config) {
|
|
|
239
239
|
const srcSub = path.join(templateToolDir, sub);
|
|
240
240
|
const destSub = path.join(base, sub);
|
|
241
241
|
if (fs.existsSync(srcSub)) {
|
|
242
|
-
// For .claude/commands, merge
|
|
242
|
+
// For .claude/commands, merge: copy new template files without overwriting user's custom commands
|
|
243
243
|
if (dir === '.claude' && sub === 'commands') {
|
|
244
|
-
// Just ensure directory exists — template only has .gitkeep
|
|
245
244
|
fs.mkdirSync(destSub, { recursive: true });
|
|
245
|
+
for (const file of fs.readdirSync(srcSub)) {
|
|
246
|
+
const destFile = path.join(destSub, file);
|
|
247
|
+
if (!fs.existsSync(destFile)) {
|
|
248
|
+
fs.cpSync(path.join(srcSub, file), destFile);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
246
251
|
} else {
|
|
247
252
|
fs.cpSync(srcSub, destSub, { recursive: true });
|
|
248
253
|
}
|
|
@@ -397,8 +402,8 @@ function generateUpgrade(config) {
|
|
|
397
402
|
const freshLines = new Set(envContent.split('\n').map((l) => l.trim()));
|
|
398
403
|
const customLines = existingEnv.split('\n').filter((line) => {
|
|
399
404
|
const trimmed = line.trim();
|
|
400
|
-
// Keep lines that are not in the fresh version and
|
|
401
|
-
return trimmed.length > 0 && !freshLines.has(trimmed);
|
|
405
|
+
// Keep lines that are not in the fresh version, not empty, and not our own injected header
|
|
406
|
+
return trimmed.length > 0 && !freshLines.has(trimmed) && trimmed !== '# Project-specific variables (preserved from previous version)';
|
|
402
407
|
});
|
|
403
408
|
if (customLines.length > 0) {
|
|
404
409
|
envContent = envContent.trimEnd() + '\n\n# Project-specific variables (preserved from previous version)\n' + customLines.join('\n') + '\n';
|