@gadmin2n/cli 0.0.95 → 0.0.96
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/actions/update.action.js +19 -15
- package/package.json +2 -2
package/actions/update.action.js
CHANGED
|
@@ -347,12 +347,14 @@ function fetchClaudeContextRepo() {
|
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* Recursively copy every file under `srcDir` into `destDir`, preserving
|
|
350
|
-
* relative structure.
|
|
351
|
-
*
|
|
350
|
+
* relative structure. The remote source is authoritative: existing files in
|
|
351
|
+
* `destDir` are OVERWRITTEN. Files that exist only in `destDir` (instance-only)
|
|
352
|
+
* are left untouched — this is an additive/overwriting sync, never a delete.
|
|
353
|
+
* Returns counts split between newly-added files and overwritten files.
|
|
352
354
|
*/
|
|
353
|
-
function
|
|
355
|
+
function copyTreeOverwrite(srcDir, destDir) {
|
|
354
356
|
let added = 0;
|
|
355
|
-
let
|
|
357
|
+
let updated = 0;
|
|
356
358
|
function walk(rel) {
|
|
357
359
|
const absSrc = path.join(srcDir, rel);
|
|
358
360
|
const entries = fs.readdirSync(absSrc, { withFileTypes: true });
|
|
@@ -364,20 +366,22 @@ function copyTreeNoOverwrite(srcDir, destDir) {
|
|
|
364
366
|
walk(childRel);
|
|
365
367
|
}
|
|
366
368
|
else if (entry.isFile()) {
|
|
367
|
-
|
|
368
|
-
skipped++;
|
|
369
|
-
continue;
|
|
370
|
-
}
|
|
369
|
+
const existed = fs.existsSync(absChildDest);
|
|
371
370
|
fs.mkdirSync(path.dirname(absChildDest), { recursive: true });
|
|
372
371
|
fs.copyFileSync(absChildSrc, absChildDest);
|
|
373
|
-
|
|
372
|
+
if (existed) {
|
|
373
|
+
updated++;
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
added++;
|
|
377
|
+
}
|
|
374
378
|
}
|
|
375
379
|
}
|
|
376
380
|
}
|
|
377
381
|
if (!fs.existsSync(srcDir))
|
|
378
|
-
return { added,
|
|
382
|
+
return { added, updated };
|
|
379
383
|
walk('');
|
|
380
|
-
return { added,
|
|
384
|
+
return { added, updated };
|
|
381
385
|
}
|
|
382
386
|
function syncClaudeContext(instanceDir, dryRun) {
|
|
383
387
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -387,7 +391,7 @@ function syncClaudeContext(instanceDir, dryRun) {
|
|
|
387
391
|
console.info(`${chalk.gray('Source: ')} ${CLAUDE_CONTEXT_REPO} (${CLAUDE_CONTEXT_BRANCH}) :: ${CLAUDE_SOURCE_SUBDIR}/`);
|
|
388
392
|
console.info(`${chalk.gray('Targets:')} ${CLAUDE_TARGET_DIRS.map((d) => `${d}/`).join(', ')}\n`);
|
|
389
393
|
if (dryRun) {
|
|
390
|
-
console.info(chalk.gray('(dry-run mode — would clone the repo and copy
|
|
394
|
+
console.info(chalk.gray('(dry-run mode — would clone the repo and copy remote files into target dirs, overwriting existing files; instance-only files are kept)\n'));
|
|
391
395
|
return;
|
|
392
396
|
}
|
|
393
397
|
const claudeSrc = fetchClaudeContextRepo();
|
|
@@ -397,12 +401,12 @@ function syncClaudeContext(instanceDir, dryRun) {
|
|
|
397
401
|
for (const targetName of CLAUDE_TARGET_DIRS) {
|
|
398
402
|
const destDir = path.join(instanceDir, targetName);
|
|
399
403
|
fs.mkdirSync(destDir, { recursive: true });
|
|
400
|
-
const { added,
|
|
404
|
+
const { added, updated } = copyTreeOverwrite(claudeSrc, destDir);
|
|
401
405
|
const summary = [];
|
|
402
406
|
if (added > 0)
|
|
403
407
|
summary.push(`${added} added`);
|
|
404
|
-
if (
|
|
405
|
-
summary.push(`${
|
|
408
|
+
if (updated > 0)
|
|
409
|
+
summary.push(`${updated} overwritten`);
|
|
406
410
|
if (summary.length === 0)
|
|
407
411
|
summary.push('no files');
|
|
408
412
|
console.info(` ${chalk.cyan(targetName + '/')} ${summary.join(' | ')}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gadmin2n/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.96",
|
|
4
4
|
"description": "Gadmin - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@angular-devkit/core": "13.3.2",
|
|
48
48
|
"@angular-devkit/schematics": "13.3.2",
|
|
49
49
|
"@angular-devkit/schematics-cli": "13.3.2",
|
|
50
|
-
"@gadmin2n/schematics": "^0.0.
|
|
50
|
+
"@gadmin2n/schematics": "^0.0.78",
|
|
51
51
|
"abc": "^0.6.1",
|
|
52
52
|
"chalk": "3.0.0",
|
|
53
53
|
"chokidar": "3.5.3",
|