camelmind 0.2.3 → 0.2.4

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/dist/index.js +24 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -153,6 +153,7 @@ var FRAMEWORK_FILES = [
153
153
  "eslint.config.mjs",
154
154
  "proxy.ts"
155
155
  ];
156
+ var DEFAULT_IGNORED_FILES = ["app/home/page.tsx"];
156
157
  async function walkFiles(dir) {
157
158
  if (!await fs2.pathExists(dir)) return [];
158
159
  const entries = await fs2.readdir(dir, { withFileTypes: true });
@@ -224,6 +225,19 @@ async function plannedTemplateFiles() {
224
225
  files.push(...FRAMEWORK_FILES);
225
226
  return files.sort();
226
227
  }
228
+ function normalizeUpdatePath(file) {
229
+ return file.replace(/\\/g, "/").replace(/^\.?\//, "");
230
+ }
231
+ function ignoredFilesFor(options) {
232
+ const ignored = /* @__PURE__ */ new Set();
233
+ if (!options.overwriteHome) {
234
+ for (const file of DEFAULT_IGNORED_FILES) ignored.add(file);
235
+ }
236
+ for (const file of options.ignoreFile ?? []) {
237
+ ignored.add(normalizeUpdatePath(file));
238
+ }
239
+ return ignored;
240
+ }
227
241
  async function update(targetDir, options) {
228
242
  const projectRoot = path2.resolve(process.cwd(), targetDir ?? ".");
229
243
  const packageJsonPath = path2.join(projectRoot, "package.json");
@@ -236,7 +250,10 @@ async function update(targetDir, options) {
236
250
  console.error(chalk2.red("Run this command from a CamelMind project root, or pass the project directory."));
237
251
  process.exit(1);
238
252
  }
239
- const files = await plannedTemplateFiles();
253
+ const ignoredFiles = ignoredFilesFor(options);
254
+ const allFiles = await plannedTemplateFiles();
255
+ const files = allFiles.filter((file) => !ignoredFiles.has(file));
256
+ const skippedFiles = allFiles.filter((file) => ignoredFiles.has(file));
240
257
  const backupRoot = path2.join(
241
258
  projectRoot,
242
259
  ".camelmind-update-backup",
@@ -247,12 +264,17 @@ async function update(targetDir, options) {
247
264
 
248
265
  Project: ${chalk2.cyan(projectRoot)}
249
266
  Files: ${chalk2.cyan(String(files.length))} framework files + package.json
267
+ Skipped: ${chalk2.cyan(String(skippedFiles.length))} preserved files
250
268
  Backup: ${chalk2.cyan(path2.relative(projectRoot, backupRoot))}
251
269
  `);
252
270
  if (options.dryRun) {
253
271
  console.log(chalk2.bold(" Dry run \u2014 files that would be refreshed:\n"));
254
272
  for (const file of files) console.log(` ${file}`);
255
273
  console.log(" package.json");
274
+ if (skippedFiles.length) {
275
+ console.log(chalk2.bold("\n Preserved files:\n"));
276
+ for (const file of skippedFiles) console.log(` ${file}`);
277
+ }
256
278
  console.log("");
257
279
  return;
258
280
  }
@@ -359,5 +381,5 @@ var program = new Command();
359
381
  program.name("camelmind").description("CamelMind CLI \u2014 scaffold and manage documentation sites").version(pkg.version);
360
382
  program.command("init [project-name]").description("Create a new CamelMind documentation site").option("--no-install", "Skip installing npm dependencies").action(init);
361
383
  program.command("version").description("Show installed version and check for updates").action(() => checkVersion(pkg.version));
362
- program.command("update [project-dir]").description("Update an existing CamelMind site to the latest platform files").option("--no-install", "Skip installing npm dependencies").option("--dry-run", "Show what would change without writing files").option("-y, --yes", "Skip the confirmation prompt").action(update);
384
+ program.command("update [project-dir]").description("Update an existing CamelMind site to the latest platform files").option("--no-install", "Skip installing npm dependencies").option("--dry-run", "Show what would change without writing files").option("--ignore-file <path...>", "Preserve additional project files during update").option("--overwrite-home", "Overwrite app/home/page.tsx with the latest template").option("-y, --yes", "Skip the confirmation prompt").action(update);
363
385
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camelmind",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Create and manage CamelMind documentation sites",
5
5
  "license": "MIT",
6
6
  "type": "module",