inai-react-components 1.4.0 → 1.4.1

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.
@@ -650,34 +650,53 @@ async function installAll(options) {
650
650
  ...registry.templates,
651
651
  ];
652
652
  console.log(chalk.bold(`\nInstalling all ${allItems.length} components, blocks, and templates...\n`));
653
- const installed = componentsJson.installedComponents ?? [];
654
- const installedNames = new Set(installed.map((c) => c.name));
653
+ // Track what's been installed across the loop. Because `runAdd` resolves
654
+ // transitive dependencies (e.g. `alert` pulls in `button`), a component
655
+ // scheduled later in the iteration may already be on disk by the time we
656
+ // reach it. We refresh this set from `components.json` after every
657
+ // `runAdd` call so `isInstalled` stays accurate across the bulk install.
658
+ const installedNames = new Set((componentsJson.installedComponents ?? []).map((c) => c.name));
655
659
  const allNpmDeps = new Set();
656
660
  let addedCount = 0;
657
- let updatedCount = 0;
661
+ let skippedCount = 0;
658
662
  for (const item of allItems) {
659
- const isInstalled = installedNames.has(item.name);
660
- const action = isInstalled ? "Updating" : "Adding";
663
+ // Skip components that were already installed by a previous iteration
664
+ // as a transitive dep avoids redundant file writes and prevents the
665
+ // overwrite prompt from hanging the bulk install.
666
+ if (installedNames.has(item.name)) {
667
+ skippedCount++;
668
+ continue;
669
+ }
661
670
  const prefix = item.type === "block" ? "block/" : item.type === "template" ? "template/" : "";
662
- const spinner = ora(`${action} "${prefix}${item.name}"...`).start();
671
+ const spinner = ora(`Adding "${prefix}${item.name}"...`).start();
663
672
  try {
664
673
  const spec = prefix ? `${prefix}${item.name}` : item.name;
674
+ // Pause the spinner defensively — any stray `prompts()` call inside
675
+ // `runAdd` would otherwise deadlock because ora holds stdout while
676
+ // the prompt reads stdin.
677
+ spinner.stop();
665
678
  const result = await runAdd(spec, rootDir, {
679
+ // During a bulk install, default to skipping files that already
680
+ // exist (from transitive deps or user edits) instead of prompting
681
+ // for overwrite. `--force` still overrides this if the user wants
682
+ // to refresh everything.
666
683
  force: options?.force,
667
684
  dryRun: options?.dryRun,
668
- skipExisting: options?.skipExisting,
685
+ skipExisting: options?.skipExisting ?? !options?.force,
669
686
  });
670
687
  if (!result.added) {
671
688
  spinner.fail(result.message);
672
689
  continue;
673
690
  }
674
- if (isInstalled) {
675
- spinner.succeed(`Updated "${prefix}${item.name}"`);
676
- updatedCount++;
677
- }
678
- else {
679
- spinner.succeed(`Added "${prefix}${item.name}"`);
680
- addedCount++;
691
+ spinner.succeed(`Added "${prefix}${item.name}"`);
692
+ addedCount++;
693
+ // Refresh the installed-names cache so the next iteration sees any
694
+ // transitive deps just installed by `runAdd`.
695
+ const freshJson = readComponentsJson(rootDir);
696
+ if (freshJson?.installedComponents) {
697
+ for (const entry of freshJson.installedComponents) {
698
+ installedNames.add(entry.name);
699
+ }
681
700
  }
682
701
  for (const dep of result.npmDeps) {
683
702
  allNpmDeps.add(dep);
@@ -694,8 +713,8 @@ async function installAll(options) {
694
713
  if (addedCount > 0) {
695
714
  console.log(chalk.green(` ${addedCount} component${addedCount > 1 ? "s" : ""} added`));
696
715
  }
697
- if (updatedCount > 0) {
698
- console.log(chalk.blue(` ${updatedCount} component${updatedCount > 1 ? "s" : ""} updated`));
716
+ if (skippedCount > 0) {
717
+ console.log(chalk.dim(` ${skippedCount} component${skippedCount > 1 ? "s" : ""} skipped (already installed as dependency)`));
699
718
  }
700
719
  if (allNpmDeps.size > 0) {
701
720
  console.log(chalk.yellow("\nInstall required npm dependencies:"));
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ const program = new Command();
17
17
  program
18
18
  .name("inai-ui")
19
19
  .description("CLI for InAI UI component library")
20
- .version("1.4.0");
20
+ .version("1.4.1");
21
21
  program
22
22
  .command("init [repo-url]")
23
23
  .description("Initialize InAI UI in your project. Optionally pass a Git repo URL to fetch components remotely.")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inai-react-components",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "CLI for InAI UI component library — install components from a private registry into your React project",
5
5
  "private": false,
6
6
  "type": "module",