myoperator-ui 0.0.206-beta.1 → 0.0.206-beta.3

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 +58 -19
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -17688,29 +17688,68 @@ async function sync(options) {
17688
17688
  console.log(chalk5.green(" \u2713 All components are up to date!\n"));
17689
17689
  return;
17690
17690
  }
17691
- if (toAdd.length > 0) {
17692
- console.log(chalk5.green(" Will add:"));
17693
- toAdd.forEach((c) => {
17694
- const comp = registry[c];
17695
- const fileCount = comp.isMultiFile ? ` (${comp.files.length} files)` : "";
17696
- console.log(chalk5.green(` + ${c}${fileCount}`));
17691
+ let selectedToAdd = toAdd;
17692
+ let selectedToUpdate = toUpdate;
17693
+ if (!options.yes && toAdd.length > 0) {
17694
+ const { selected } = await prompts3({
17695
+ type: "multiselect",
17696
+ name: "selected",
17697
+ message: "Select new components to add",
17698
+ choices: toAdd.map((c) => {
17699
+ const comp = registry[c];
17700
+ const fileCount = comp.isMultiFile ? ` (${comp.files.length} files)` : "";
17701
+ return { title: `${c}${fileCount}`, value: c, selected: true };
17702
+ })
17697
17703
  });
17698
- console.log("");
17704
+ if (!selected) {
17705
+ console.log(chalk5.yellow("\n Sync cancelled.\n"));
17706
+ process.exit(0);
17707
+ }
17708
+ selectedToAdd = selected;
17699
17709
  }
17700
- if (toUpdate.length > 0) {
17701
- console.log(chalk5.yellow(" Will update:"));
17702
- toUpdate.forEach((c) => {
17703
- const comp = registry[c];
17704
- const fileCount = comp.isMultiFile ? ` (${comp.files.length} files)` : "";
17705
- console.log(chalk5.yellow(` ~ ${c}${fileCount}`));
17710
+ if (!options.yes && toUpdate.length > 0) {
17711
+ const { selected } = await prompts3({
17712
+ type: "multiselect",
17713
+ name: "selected",
17714
+ message: "Select components to update",
17715
+ choices: toUpdate.map((c) => {
17716
+ const comp = registry[c];
17717
+ const fileCount = comp.isMultiFile ? ` (${comp.files.length} files)` : "";
17718
+ return { title: `${c}${fileCount}`, value: c, selected: true };
17719
+ })
17706
17720
  });
17707
- console.log("");
17721
+ if (!selected) {
17722
+ console.log(chalk5.yellow("\n Sync cancelled.\n"));
17723
+ process.exit(0);
17724
+ }
17725
+ selectedToUpdate = selected;
17726
+ }
17727
+ if (selectedToAdd.length === 0 && selectedToUpdate.length === 0 && orphaned.length === 0) {
17728
+ console.log(chalk5.green("\n \u2713 Nothing selected to sync.\n"));
17729
+ return;
17708
17730
  }
17709
- if (!options.yes && (toAdd.length > 0 || toUpdate.length > 0)) {
17731
+ if (!options.yes && (selectedToAdd.length > 0 || selectedToUpdate.length > 0)) {
17732
+ if (selectedToAdd.length > 0) {
17733
+ console.log(chalk5.green("\n Will add:"));
17734
+ selectedToAdd.forEach((c) => {
17735
+ const comp = registry[c];
17736
+ const fileCount = comp.isMultiFile ? ` (${comp.files.length} files)` : "";
17737
+ console.log(chalk5.green(` + ${c}${fileCount}`));
17738
+ });
17739
+ }
17740
+ if (selectedToUpdate.length > 0) {
17741
+ console.log(chalk5.yellow("\n Will update:"));
17742
+ selectedToUpdate.forEach((c) => {
17743
+ const comp = registry[c];
17744
+ const fileCount = comp.isMultiFile ? ` (${comp.files.length} files)` : "";
17745
+ console.log(chalk5.yellow(` ~ ${c}${fileCount}`));
17746
+ });
17747
+ }
17748
+ console.log("");
17710
17749
  const { confirm } = await prompts3({
17711
17750
  type: "confirm",
17712
17751
  name: "confirm",
17713
- message: `Proceed with ${toAdd.length} additions and ${toUpdate.length} updates?`,
17752
+ message: `Proceed with ${selectedToAdd.length} additions and ${selectedToUpdate.length} updates?`,
17714
17753
  initial: true
17715
17754
  });
17716
17755
  if (!confirm) {
@@ -17718,7 +17757,7 @@ async function sync(options) {
17718
17757
  process.exit(0);
17719
17758
  }
17720
17759
  }
17721
- if (toAdd.length > 0 || toUpdate.length > 0) {
17760
+ if (selectedToAdd.length > 0 || selectedToUpdate.length > 0) {
17722
17761
  const spinner = ora4("Syncing components...").start();
17723
17762
  try {
17724
17763
  const installed = [];
@@ -17763,10 +17802,10 @@ async function sync(options) {
17763
17802
  }
17764
17803
  processedComponents.add(componentName);
17765
17804
  };
17766
- for (const componentName of toAdd) {
17805
+ for (const componentName of selectedToAdd) {
17767
17806
  await installComponent(componentName, "added");
17768
17807
  }
17769
- for (const componentName of toUpdate) {
17808
+ for (const componentName of selectedToUpdate) {
17770
17809
  await installComponent(componentName, "updated");
17771
17810
  }
17772
17811
  spinner.succeed("Sync complete!");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-ui",
3
- "version": "0.0.206-beta.1",
3
+ "version": "0.0.206-beta.3",
4
4
  "description": "CLI for adding myOperator UI components to your project",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -29,8 +29,9 @@
29
29
  "dev": "tsup src/index.ts --format esm --watch",
30
30
  "typecheck": "tsc --noEmit",
31
31
  "test": "vitest run",
32
+ "test:e2e": "vitest run src/__tests__/e2e.test.ts --testTimeout 180000",
32
33
  "test:watch": "vitest",
33
- "prepublishOnly": "node scripts/check-publish-allowed.js && npm run validate-types && npm run build && npm run validate-registry"
34
+ "prepublishOnly": "node scripts/check-publish-allowed.js && npm run validate-types && npm run build && npm run validate-registry && npm run test:e2e"
34
35
  },
35
36
  "dependencies": {
36
37
  "chalk": "^5.3.0",