@yamada-ui/cli 2.0.10-dev-20260305230416 → 2.1.0-dev-20260306204545

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.mjs +23 -15
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -6637,7 +6637,7 @@ async function mergeContent(remotePath, localPath, currentPath, fallback) {
6637
6637
  content
6638
6638
  };
6639
6639
  }
6640
- async function updateFiles(changeMap, { add: add$1, remove, update: update$1 }, { remote }, config$1, { concurrent = true, install = false } = {}) {
6640
+ async function updateFiles(changeMap, { add: add$1, remove, update: update$1 }, { remote }, config$1, { concurrent = true, force = false, install = false } = {}) {
6641
6641
  const conflictMap = {};
6642
6642
  const disabledFormatAndLint = {
6643
6643
  format: { enabled: false },
@@ -6653,18 +6653,22 @@ async function updateFiles(changeMap, { add: add$1, remove, update: update$1 },
6653
6653
  const name$1 = config$1.paths.ui.index.split("/").at(-1);
6654
6654
  const data = changes[name$1];
6655
6655
  if (!("local" in data && "remote" in data)) return;
6656
- const remotePath = path$1.join(tempDirPath, `remote-${name$1}`);
6657
- const localPath = path$1.join(tempDirPath, `local-${name$1}`);
6658
- await Promise.all([writeFileSafe(remotePath, data.remote, disabledFormatAndLint), writeFileSafe(localPath, data.local, disabledFormatAndLint)]);
6659
- const { conflict, content: mergedContent } = await mergeContent(remotePath, localPath, config$1.paths.ui.index, data.remote);
6660
- await writeFileSafe(config$1.paths.ui.index, mergedContent, conflict ? merge(config$1, disabledFormatAndLint) : config$1);
6661
- if (conflict) {
6662
- conflictMap[componentName] ??= {};
6663
- conflictMap[componentName][name$1] = config$1.paths.ui.index;
6656
+ if (force) await writeFileSafe(config$1.paths.ui.index, data.remote, config$1);
6657
+ else {
6658
+ const remotePath = path$1.join(tempDirPath, `remote-${name$1}`);
6659
+ const localPath = path$1.join(tempDirPath, `local-${name$1}`);
6660
+ await Promise.all([writeFileSafe(remotePath, data.remote, disabledFormatAndLint), writeFileSafe(localPath, data.local, disabledFormatAndLint)]);
6661
+ const { conflict, content: mergedContent } = await mergeContent(remotePath, localPath, config$1.paths.ui.index, data.remote);
6662
+ await writeFileSafe(config$1.paths.ui.index, mergedContent, conflict ? merge(config$1, disabledFormatAndLint) : config$1);
6663
+ if (conflict) {
6664
+ conflictMap[componentName] ??= {};
6665
+ conflictMap[componentName][name$1] = config$1.paths.ui.index;
6666
+ }
6664
6667
  }
6665
6668
  } else await Promise.all(Object.entries(changes).map(async ([name$1, { ...data }]) => {
6666
6669
  const currentPath = path$1.join(dirPath, name$1);
6667
- if ("local" in data && "remote" in data) {
6670
+ if ("local" in data && "remote" in data) if (force) await writeFileSafe(currentPath, data.remote, config$1);
6671
+ else {
6668
6672
  const remotePath = path$1.join(tempDirPath, `remote-${name$1}`);
6669
6673
  const localPath = path$1.join(tempDirPath, `local-${name$1}`);
6670
6674
  await Promise.all([writeFileSafe(remotePath, data.remote, disabledFormatAndLint), writeFileSafe(localPath, data.local, disabledFormatAndLint)]);
@@ -6674,7 +6678,8 @@ async function updateFiles(changeMap, { add: add$1, remove, update: update$1 },
6674
6678
  conflictMap[componentName] ??= {};
6675
6679
  conflictMap[componentName][name$1] = currentPath;
6676
6680
  }
6677
- } else if ("remote" in data) await writeFileSafe(currentPath, data.remote, config$1);
6681
+ }
6682
+ else if ("remote" in data) await writeFileSafe(currentPath, data.remote, config$1);
6678
6683
  else await rimraf(currentPath);
6679
6684
  }));
6680
6685
  await writeFileSafe(path$1.resolve(dirPath, REGISTRY_FILE_NAME), JSON.stringify(registry), merge(config$1, { format: { parser: "json" } }));
@@ -7536,7 +7541,7 @@ const tokens = new Command("tokens").description("generate theme typings").argum
7536
7541
 
7537
7542
  //#endregion
7538
7543
  //#region src/commands/update/index.ts
7539
- const update = new Command("update").description("update components in your project").argument("[components...]", "components to update").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-i, --install", "install dependencies", false).option("-s, --sequential", "run tasks sequentially.", false).option("-f, --format", "format the output files.").option("-l, --lint", "lint the output files.").action(async function(targetNames, { config: configPath, cwd: cwd$1, format: format$2, install, lint, sequential }) {
7544
+ const update = new Command("update").description("update components in your project").argument("[components...]", "components to update").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-i, --install", "install dependencies", false).option("-s, --sequential", "run tasks sequentially.", false).option("-F, --force", "force update, overwriting local changes.", false).option("-f, --format", "format the output files.").option("-l, --lint", "lint the output files.").action(async function(targetNames, { config: configPath, cwd: cwd$1, force, format: format$2, install, lint, sequential }) {
7540
7545
  const spinner = ora();
7541
7546
  try {
7542
7547
  const { end } = timer();
@@ -7546,9 +7551,11 @@ const update = new Command("update").description("update components in your proj
7546
7551
  spinner.start("Validating directory");
7547
7552
  await validateDir(cwd$1);
7548
7553
  spinner.succeed("Validated directory");
7549
- spinner.start("Validating methods");
7550
- await validateDiff3();
7551
- spinner.succeed("Validated methods");
7554
+ if (!force) {
7555
+ spinner.start("Validating methods");
7556
+ await validateDiff3();
7557
+ spinner.succeed("Validated methods");
7558
+ }
7552
7559
  spinner.start("Fetching config");
7553
7560
  const config$1 = await getConfig(cwd$1, configPath, {
7554
7561
  format: format$2,
@@ -7592,6 +7599,7 @@ const update = new Command("update").description("update components in your proj
7592
7599
  else {
7593
7600
  const conflictMap = await updateFiles(changeMap, dependencyMap, registryMap, config$1, {
7594
7601
  concurrent: !sequential,
7602
+ force,
7595
7603
  install
7596
7604
  });
7597
7605
  if (Object.keys(conflictMap).length) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yamada-ui/cli",
3
3
  "type": "module",
4
- "version": "2.0.10-dev-20260305230416",
4
+ "version": "2.1.0-dev-20260306204545",
5
5
  "description": "The official CLI for Yamada UI projects",
6
6
  "keywords": [
7
7
  "theme",