@yamada-ui/cli 2.1.0-dev-20260308045531 → 2.1.0-dev-20260308051035
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/dist/index.mjs +62 -47
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5576,13 +5576,20 @@ var package_default = {
|
|
|
5576
5576
|
|
|
5577
5577
|
//#endregion
|
|
5578
5578
|
//#region src/constant.ts
|
|
5579
|
+
const PACKAGE_NAME = "@yamada-ui/react";
|
|
5579
5580
|
const CONFIG_FILE_NAME = "ui.json";
|
|
5580
5581
|
const REGISTRY_FILE_NAME = "registry.json";
|
|
5582
|
+
const REGISTRY_VERSION = "v2";
|
|
5583
|
+
const REGISTRY_URL = "https://yamada-ui.com/registry";
|
|
5584
|
+
const SECTION_NAMES = [
|
|
5585
|
+
"components",
|
|
5586
|
+
"hooks",
|
|
5587
|
+
"providers"
|
|
5588
|
+
];
|
|
5581
5589
|
const DEFAULT_PACKAGE_NAME = {
|
|
5582
5590
|
ui: "@workspaces/ui",
|
|
5583
5591
|
theme: "@workspaces/theme"
|
|
5584
5592
|
};
|
|
5585
|
-
const REGISTRY_URL = "https://yamada-ui.com/registry/v2";
|
|
5586
5593
|
const DEFAULT_PATH = {
|
|
5587
5594
|
components: "./components",
|
|
5588
5595
|
hooks: "./hooks",
|
|
@@ -5596,13 +5603,8 @@ const DEFAULT_PATH = {
|
|
|
5596
5603
|
polyrepo: "./theme"
|
|
5597
5604
|
}
|
|
5598
5605
|
};
|
|
5599
|
-
const SECTION_NAMES = [
|
|
5600
|
-
"components",
|
|
5601
|
-
"hooks",
|
|
5602
|
-
"providers"
|
|
5603
|
-
];
|
|
5604
5606
|
const DEFAULT_CONFIG = {
|
|
5605
|
-
$schema: `${REGISTRY_URL}/config.schema.json`,
|
|
5607
|
+
$schema: `${REGISTRY_URL}/${REGISTRY_VERSION}/config.schema.json`,
|
|
5606
5608
|
components: { overwrite: true },
|
|
5607
5609
|
hooks: { overwrite: true },
|
|
5608
5610
|
providers: { overwrite: true }
|
|
@@ -5611,9 +5613,9 @@ const REQUIRED_DEPENDENCIES = {
|
|
|
5611
5613
|
ui: [
|
|
5612
5614
|
"react@^19",
|
|
5613
5615
|
"react-dom@^19",
|
|
5614
|
-
|
|
5616
|
+
`${PACKAGE_NAME}@^2`
|
|
5615
5617
|
],
|
|
5616
|
-
theme: [
|
|
5618
|
+
theme: [`${PACKAGE_NAME}@^2`]
|
|
5617
5619
|
};
|
|
5618
5620
|
const REQUIRED_DEV_DEPENDENCIES = {
|
|
5619
5621
|
ui: ["@types/react@^19", "@types/react-dom@^19"],
|
|
@@ -5838,6 +5840,13 @@ function splitVersion(value) {
|
|
|
5838
5840
|
return [`@${name$1}`, version$1];
|
|
5839
5841
|
} else return value.split("@");
|
|
5840
5842
|
}
|
|
5843
|
+
function replaceVersion(value, target, tag) {
|
|
5844
|
+
if (!tag) return value;
|
|
5845
|
+
const [name$1, version$1] = splitVersion(value);
|
|
5846
|
+
if (!version$1) return value;
|
|
5847
|
+
if (name$1 !== target) return value;
|
|
5848
|
+
return `${name$1}@${tag}`;
|
|
5849
|
+
}
|
|
5841
5850
|
function getPackageName(value) {
|
|
5842
5851
|
return splitVersion(value)[0];
|
|
5843
5852
|
}
|
|
@@ -6064,15 +6073,15 @@ async function getModule(file, cwd$1) {
|
|
|
6064
6073
|
//#region src/utils/registry.ts
|
|
6065
6074
|
const agent = process.env.https_proxy ? new HttpsProxyAgent(process.env.https_proxy) : void 0;
|
|
6066
6075
|
const registryStore = /* @__PURE__ */ new Map();
|
|
6067
|
-
function getRegistryUrl(name$1) {
|
|
6068
|
-
if (name$1 === "index") return path$1.posix.join(REGISTRY_URL, "index.json");
|
|
6069
|
-
else if (name$1 === "theme") return path$1.posix.join(REGISTRY_URL, "theme.json");
|
|
6070
|
-
else if (name$1.startsWith("use-")) return path$1.posix.join(REGISTRY_URL, "hooks", `${name$1}.json`);
|
|
6071
|
-
else if (name$1.endsWith("-provider")) return path$1.posix.join(REGISTRY_URL, "providers", `${name$1}.json`);
|
|
6072
|
-
else return path$1.posix.join(REGISTRY_URL, "components", `${name$1}.json`);
|
|
6076
|
+
function getRegistryUrl(name$1, tag = "") {
|
|
6077
|
+
if (name$1 === "index") return path$1.posix.join(REGISTRY_URL, tag, REGISTRY_VERSION, "index.json");
|
|
6078
|
+
else if (name$1 === "theme") return path$1.posix.join(REGISTRY_URL, tag, REGISTRY_VERSION, "theme.json");
|
|
6079
|
+
else if (name$1.startsWith("use-")) return path$1.posix.join(REGISTRY_URL, tag, REGISTRY_VERSION, "hooks", `${name$1}.json`);
|
|
6080
|
+
else if (name$1.endsWith("-provider")) return path$1.posix.join(REGISTRY_URL, tag, REGISTRY_VERSION, "providers", `${name$1}.json`);
|
|
6081
|
+
else return path$1.posix.join(REGISTRY_URL, tag, REGISTRY_VERSION, "components", `${name$1}.json`);
|
|
6073
6082
|
}
|
|
6074
|
-
async function fetchRegistryNames() {
|
|
6075
|
-
const { sources } = await fetchRegistry("index");
|
|
6083
|
+
async function fetchRegistryNames(tag) {
|
|
6084
|
+
const { sources } = await fetchRegistry("index", { tag });
|
|
6076
6085
|
const content = sources[0].content;
|
|
6077
6086
|
const regex = /"@yamada-ui\/react\/([^"/]+)(?:\/([^"/]+))?"/g;
|
|
6078
6087
|
const registryNames = [];
|
|
@@ -6083,8 +6092,8 @@ async function fetchRegistryNames() {
|
|
|
6083
6092
|
}
|
|
6084
6093
|
return registryNames;
|
|
6085
6094
|
}
|
|
6086
|
-
async function fetchRegistry(name$1, { cache = true } = {}) {
|
|
6087
|
-
const url$2 = getRegistryUrl(name$1);
|
|
6095
|
+
async function fetchRegistry(name$1, { cache = true, tag } = {}) {
|
|
6096
|
+
const url$2 = getRegistryUrl(name$1, tag);
|
|
6088
6097
|
if (cache && registryStore.has(url$2)) return registryStore.get(url$2);
|
|
6089
6098
|
const res = await fetch(url$2, { agent });
|
|
6090
6099
|
if (res.ok) {
|
|
@@ -6103,12 +6112,15 @@ async function fetchRegistry(name$1, { cache = true } = {}) {
|
|
|
6103
6112
|
default: throw new Error(`An error occurred while fetching the registry at ${c.red(name$1)}. Please try again later.`);
|
|
6104
6113
|
}
|
|
6105
6114
|
}
|
|
6106
|
-
async function fetchRegistries(names, config$1, { cache = true, dependencies: withDependencies = true, dependents: withDependents = true, omit = [] } = {}) {
|
|
6115
|
+
async function fetchRegistries(names, config$1, { cache = true, dependencies: withDependencies = true, dependents: withDependents = true, omit = [], tag } = {}) {
|
|
6107
6116
|
const results = {};
|
|
6108
6117
|
async function fetch$1(names$1) {
|
|
6109
6118
|
await Promise.all(names$1.map(async (name$1) => {
|
|
6110
6119
|
if (results[name$1] || omit.includes(name$1)) return;
|
|
6111
|
-
results[name$1] = fetchRegistry(name$1, {
|
|
6120
|
+
results[name$1] = fetchRegistry(name$1, {
|
|
6121
|
+
cache,
|
|
6122
|
+
tag
|
|
6123
|
+
});
|
|
6112
6124
|
results[name$1] = await results[name$1];
|
|
6113
6125
|
const { dependencies: dependencies$1, dependents, section } = results[name$1];
|
|
6114
6126
|
const target = [];
|
|
@@ -6168,7 +6180,7 @@ function transformContent(targetSection, content, { getSection }, generatedNames
|
|
|
6168
6180
|
const depth = (value.match(/\.\.\//g) || []).length;
|
|
6169
6181
|
if (!depth) return;
|
|
6170
6182
|
if (depth === 1) if (generated) replaceValue = `from "${path$1.join("..", name$1)}"`;
|
|
6171
|
-
else replaceValue = `from "
|
|
6183
|
+
else replaceValue = `from "${PACKAGE_NAME}/${targetSection}/${name$1}"`;
|
|
6172
6184
|
else {
|
|
6173
6185
|
const { path: sectionPath, section } = getSection(value.replace(/(\.\.\/|\.\/)/g, "").split("/").slice(0, -1).join("/")) ?? {};
|
|
6174
6186
|
if (!section || !sectionPath) return;
|
|
@@ -6176,7 +6188,7 @@ function transformContent(targetSection, content, { getSection }, generatedNames
|
|
|
6176
6188
|
const neededDepth = depth + (sectionPath.match(/\.\.\//g) || []).length;
|
|
6177
6189
|
const omittedTargetPath = sectionPath.replace(/(\.\.\/|\.\/)/g, "");
|
|
6178
6190
|
replaceValue = `from "${"../".repeat(neededDepth)}${omittedTargetPath}/${name$1}"`;
|
|
6179
|
-
} else replaceValue = `from "
|
|
6191
|
+
} else replaceValue = `from "${PACKAGE_NAME}/${section}/${name$1}"`;
|
|
6180
6192
|
}
|
|
6181
6193
|
}
|
|
6182
6194
|
content = content.replace(searchValue, replaceValue);
|
|
@@ -6218,7 +6230,7 @@ function transformIndex(generatedNames, content, { getSection }) {
|
|
|
6218
6230
|
} else {
|
|
6219
6231
|
const { section } = getSection(value.replace(/(\.\.\/|\.\/)/g, "").split("/").slice(0, -1).join("/")) ?? {};
|
|
6220
6232
|
if (!section) return;
|
|
6221
|
-
replaceValue = `from "
|
|
6233
|
+
replaceValue = `from "${PACKAGE_NAME}/${section}/${name$1}"`;
|
|
6222
6234
|
}
|
|
6223
6235
|
content = content.replace(searchValue, replaceValue);
|
|
6224
6236
|
});
|
|
@@ -6256,7 +6268,7 @@ async function generateSources(dirPath, registry, config$1, generatedNames = [])
|
|
|
6256
6268
|
|
|
6257
6269
|
//#endregion
|
|
6258
6270
|
//#region src/commands/add/index.ts
|
|
6259
|
-
const add = new Command("add").description("add a component to your project").argument("[components...]", "components to add").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-o, --overwrite", "overwrite existing files.", false).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(componentNames, { config: configPath, cwd: cwd$1, format: format$2, install, lint, overwrite, sequential }) {
|
|
6271
|
+
const add = new Command("add").description("add a component to your project").argument("[components...]", "components to add").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-o, --overwrite", "overwrite existing files.", false).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.").option("-t, --tag <name>", "tag for the registries (e.g. dev, next)").action(async function(componentNames, { config: configPath, cwd: cwd$1, format: format$2, install, lint, overwrite, sequential, tag }) {
|
|
6260
6272
|
const spinner = ora();
|
|
6261
6273
|
try {
|
|
6262
6274
|
const { end } = timer();
|
|
@@ -6289,7 +6301,7 @@ const add = new Command("add").description("add a component to your project").ar
|
|
|
6289
6301
|
if (!overwrite$1) process.exit(0);
|
|
6290
6302
|
}
|
|
6291
6303
|
spinner.start("Fetching all available components");
|
|
6292
|
-
componentNames = await fetchRegistryNames();
|
|
6304
|
+
componentNames = await fetchRegistryNames(tag);
|
|
6293
6305
|
spinner.succeed("Fetched all available components");
|
|
6294
6306
|
} else {
|
|
6295
6307
|
spinner.start("Getting generated components");
|
|
@@ -6313,7 +6325,8 @@ const add = new Command("add").description("add a component to your project").ar
|
|
|
6313
6325
|
const registries = await fetchRegistries(componentNames, config$1, {
|
|
6314
6326
|
dependencies: !!componentNames.length,
|
|
6315
6327
|
dependents: !!componentNames.length,
|
|
6316
|
-
omit: omittedGeneratedNames
|
|
6328
|
+
omit: omittedGeneratedNames,
|
|
6329
|
+
tag
|
|
6317
6330
|
});
|
|
6318
6331
|
const registryNames = Object.keys(registries);
|
|
6319
6332
|
const dependencies$1 = [...new Set(Object.values(registries).map(({ dependencies: dependencies$2 }) => dependencies$2?.externals).filter((dependencies$2) => !isUndefined(dependencies$2)).flat())];
|
|
@@ -6401,7 +6414,7 @@ const add = new Command("add").description("add a component to your project").ar
|
|
|
6401
6414
|
});
|
|
6402
6415
|
else tasks.add({
|
|
6403
6416
|
task: async (_, task) => {
|
|
6404
|
-
const { sources: [source] } = await fetchRegistry("index");
|
|
6417
|
+
const { sources: [source] } = await fetchRegistry("index", { tag });
|
|
6405
6418
|
let content = transformIndex(targetNames, source.content, config$1);
|
|
6406
6419
|
if (config$1.jsx) content = transformTsToJs(content);
|
|
6407
6420
|
await writeFileSafe(config$1.paths.ui.index, content, config$1);
|
|
@@ -6720,7 +6733,7 @@ async function validateDiff3() {
|
|
|
6720
6733
|
|
|
6721
6734
|
//#endregion
|
|
6722
6735
|
//#region src/commands/diff/get-registries-and-files.ts
|
|
6723
|
-
async function getRegistriesAndFiles(componentNames, config$1, { concurrent = true, index = false, theme: theme$1 = false } = {}) {
|
|
6736
|
+
async function getRegistriesAndFiles(componentNames, config$1, { concurrent = true, index = false, tag, theme: theme$1 = false } = {}) {
|
|
6724
6737
|
const fileMap = {};
|
|
6725
6738
|
const registryMap = {
|
|
6726
6739
|
local: {},
|
|
@@ -6736,7 +6749,7 @@ async function getRegistriesAndFiles(componentNames, config$1, { concurrent = tr
|
|
|
6736
6749
|
title: `Getting ${c.cyan("index")} file`
|
|
6737
6750
|
}, {
|
|
6738
6751
|
task: async (_, task) => {
|
|
6739
|
-
registryMap.remote.index = await fetchRegistry("index");
|
|
6752
|
+
registryMap.remote.index = await fetchRegistry("index", { tag });
|
|
6740
6753
|
task.title = `Fetched ${c.cyan("index")} registry`;
|
|
6741
6754
|
},
|
|
6742
6755
|
title: `Fetching ${c.cyan("index")} registry`
|
|
@@ -6752,7 +6765,7 @@ async function getRegistriesAndFiles(componentNames, config$1, { concurrent = tr
|
|
|
6752
6765
|
title: `Getting ${c.cyan("theme")} files`
|
|
6753
6766
|
}, {
|
|
6754
6767
|
task: async (_, task) => {
|
|
6755
|
-
registryMap.remote.theme = await fetchRegistry("theme");
|
|
6768
|
+
registryMap.remote.theme = await fetchRegistry("theme", { tag });
|
|
6756
6769
|
task.title = `Fetched ${c.cyan("theme")} registry`;
|
|
6757
6770
|
},
|
|
6758
6771
|
title: `Fetching ${c.cyan("theme")} registry`
|
|
@@ -6767,7 +6780,7 @@ async function getRegistriesAndFiles(componentNames, config$1, { concurrent = tr
|
|
|
6767
6780
|
title: `Getting ${c.cyan(componentName)} files`
|
|
6768
6781
|
}, {
|
|
6769
6782
|
task: async (_, task) => {
|
|
6770
|
-
registryMap.remote[componentName] = await fetchRegistry(componentName);
|
|
6783
|
+
registryMap.remote[componentName] = await fetchRegistry(componentName, { tag });
|
|
6771
6784
|
task.title = `Fetched ${c.cyan(componentName)} registry`;
|
|
6772
6785
|
},
|
|
6773
6786
|
title: `Fetching ${c.cyan(componentName)} registry`
|
|
@@ -6830,7 +6843,7 @@ function printDiffDependencies({ add: add$1, remove, update: update$1 }) {
|
|
|
6830
6843
|
|
|
6831
6844
|
//#endregion
|
|
6832
6845
|
//#region src/commands/diff/index.ts
|
|
6833
|
-
const diff = new Command("diff").description("check for updates against the registry").argument("[component]", "component to check").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-s, --sequential", "run tasks sequentially.", false).option("-d, --detail", "show detailed changes", false).action(async function(targetName, { config: configPath, cwd: cwd$1, detail, sequential }) {
|
|
6846
|
+
const diff = new Command("diff").description("check for updates against the registry").argument("[component]", "component to check").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-s, --sequential", "run tasks sequentially.", false).option("-d, --detail", "show detailed changes", false).option("-t, --tag <name>", "tag for the registries (e.g. dev, next)").action(async function(targetName, { config: configPath, cwd: cwd$1, detail, sequential, tag }) {
|
|
6834
6847
|
const spinner = ora();
|
|
6835
6848
|
try {
|
|
6836
6849
|
const { end } = timer();
|
|
@@ -6875,6 +6888,7 @@ const diff = new Command("diff").description("check for updates against the regi
|
|
|
6875
6888
|
const { registryMap } = await getRegistriesAndFiles(componentNames, config$1, {
|
|
6876
6889
|
concurrent: !sequential,
|
|
6877
6890
|
index,
|
|
6891
|
+
tag,
|
|
6878
6892
|
theme: theme$1
|
|
6879
6893
|
});
|
|
6880
6894
|
const { changeMap, dependencyMap } = await getDiff(generatedNames, registryMap, config$1, !sequential);
|
|
@@ -6923,7 +6937,7 @@ const diff = new Command("diff").description("check for updates against the regi
|
|
|
6923
6937
|
|
|
6924
6938
|
//#endregion
|
|
6925
6939
|
//#region src/commands/init/index.ts
|
|
6926
|
-
const init = new Command("init").description("initialize your project and install dependencies").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-o, --overwrite", "overwrite existing files.", false).option("-j, --jsx", "use jsx instead of tsx", false).action(async function({ config: configPath, cwd: cwd$1, jsx, overwrite }) {
|
|
6940
|
+
const init = new Command("init").description("initialize your project and install dependencies").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-o, --overwrite", "overwrite existing files.", false).option("-t, --tag <name>", "tag for the registries (e.g. dev, next)").option("-j, --jsx", "use jsx instead of tsx", false).action(async function({ config: configPath, cwd: cwd$1, jsx, overwrite, tag }) {
|
|
6927
6941
|
const spinner = ora();
|
|
6928
6942
|
try {
|
|
6929
6943
|
const { end } = timer();
|
|
@@ -7038,8 +7052,8 @@ const init = new Command("init").description("initialize your project and instal
|
|
|
7038
7052
|
await writeFileSafe(targetPath, JSON.stringify({
|
|
7039
7053
|
name: packageName,
|
|
7040
7054
|
...DEFAULT_PACKAGE_JSON,
|
|
7041
|
-
dependencies: Object.fromEntries(REQUIRED_DEPENDENCIES.ui.map((dependency) => splitVersion(dependency))),
|
|
7042
|
-
devDependencies: Object.fromEntries(REQUIRED_DEV_DEPENDENCIES.ui.map((dependency) => splitVersion(dependency))),
|
|
7055
|
+
dependencies: Object.fromEntries(REQUIRED_DEPENDENCIES.ui.map((dependency) => splitVersion(replaceVersion(dependency, PACKAGE_NAME, tag)))),
|
|
7056
|
+
devDependencies: Object.fromEntries(REQUIRED_DEV_DEPENDENCIES.ui.map((dependency) => splitVersion(replaceVersion(dependency, PACKAGE_NAME, tag)))),
|
|
7043
7057
|
exports: exports$1
|
|
7044
7058
|
}), merge(config$1, { format: { parser: "json" } }));
|
|
7045
7059
|
task.title = `Generated ${c.cyan("package.json")}`;
|
|
@@ -7049,7 +7063,7 @@ const init = new Command("init").description("initialize your project and instal
|
|
|
7049
7063
|
{
|
|
7050
7064
|
task: async (_, task) => {
|
|
7051
7065
|
const targetPath = path$1.resolve(outdirPath, src ? "src" : "");
|
|
7052
|
-
const registry = await fetchRegistry("index");
|
|
7066
|
+
const registry = await fetchRegistry("index", { tag });
|
|
7053
7067
|
let content = registry.sources[0].content;
|
|
7054
7068
|
if (jsx) content = transformTsToJs(content);
|
|
7055
7069
|
await Promise.all([writeFileSafe(path$1.join(targetPath, indexFileName), content, config$1), writeFileSafe(path$1.join(targetPath, REGISTRY_FILE_NAME), JSON.stringify(registry), merge(config$1, { format: { parser: "json" } }))]);
|
|
@@ -7090,14 +7104,14 @@ const init = new Command("init").description("initialize your project and instal
|
|
|
7090
7104
|
await new Listr([{
|
|
7091
7105
|
task: async (_, task) => {
|
|
7092
7106
|
const packageJson$2 = await getPackageJson(cwd$1);
|
|
7093
|
-
notInstalledDependencies.push(...getNotInstalledDependencies(packageJson$2, REQUIRED_DEPENDENCIES.ui));
|
|
7094
|
-
notInstalledDevDependencies.push(...getNotInstalledDependencies(packageJson$2, REQUIRED_DEV_DEPENDENCIES.ui));
|
|
7107
|
+
notInstalledDependencies.push(...getNotInstalledDependencies(packageJson$2, REQUIRED_DEPENDENCIES.ui.map((dependency) => replaceVersion(dependency, PACKAGE_NAME, tag))));
|
|
7108
|
+
notInstalledDevDependencies.push(...getNotInstalledDependencies(packageJson$2, REQUIRED_DEV_DEPENDENCIES.ui.map((dependency) => replaceVersion(dependency, PACKAGE_NAME, tag))));
|
|
7095
7109
|
task.title = `Checked ${c.cyan("package.json")} dependencies`;
|
|
7096
7110
|
},
|
|
7097
7111
|
title: `Checking ${c.cyan("package.json")} dependencies`
|
|
7098
7112
|
}, {
|
|
7099
7113
|
task: async (_, task) => {
|
|
7100
|
-
const registry = await fetchRegistry("index");
|
|
7114
|
+
const registry = await fetchRegistry("index", { tag });
|
|
7101
7115
|
let content = registry.sources[0].content;
|
|
7102
7116
|
if (jsx) content = transformTsToJs(content);
|
|
7103
7117
|
await Promise.all([writeFileSafe(path$1.resolve(outdirPath, indexFileName), content, config$1), writeFileSafe(path$1.resolve(outdirPath, REGISTRY_FILE_NAME), JSON.stringify(registry), merge(config$1, { format: { parser: "json" } }))]);
|
|
@@ -7152,7 +7166,7 @@ const init = new Command("init").description("initialize your project and instal
|
|
|
7152
7166
|
|
|
7153
7167
|
//#endregion
|
|
7154
7168
|
//#region src/commands/theme/index.ts
|
|
7155
|
-
const theme = new Command("theme").description("generate theme to your project").argument("[path]", "path to the theme directory").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-o, --overwrite", "overwrite existing directory.", false).option("-j, --js", "use js instead of ts").option("-f, --format", "format the output files.").option("-l, --lint", "lint the output files.").action(async function(themePath, { config: configPath, cwd: cwd$1, format: format$2, js, lint, overwrite }) {
|
|
7169
|
+
const theme = new Command("theme").description("generate theme to your project").argument("[path]", "path to the theme directory").option("--cwd <path>", "current working directory", cwd).option("-c, --config <path>", "path to the config file", CONFIG_FILE_NAME).option("-o, --overwrite", "overwrite existing directory.", false).option("-j, --js", "use js instead of ts").option("-f, --format", "format the output files.").option("-l, --lint", "lint the output files.").option("-t, --tag <name>", "tag for the registries (e.g. dev, next)").action(async function(themePath, { config: configPath, cwd: cwd$1, format: format$2, js, lint, overwrite, tag }) {
|
|
7156
7170
|
const spinner = ora();
|
|
7157
7171
|
try {
|
|
7158
7172
|
const { end } = timer();
|
|
@@ -7216,7 +7230,7 @@ const theme = new Command("theme").description("generate theme to your project")
|
|
|
7216
7230
|
spinner.succeed("Cleared directory");
|
|
7217
7231
|
}
|
|
7218
7232
|
spinner.start("Fetching registry");
|
|
7219
|
-
const registry = await fetchRegistry("theme");
|
|
7233
|
+
const registry = await fetchRegistry("theme", { tag });
|
|
7220
7234
|
spinner.succeed("Fetched registry");
|
|
7221
7235
|
const tasks = new Listr([{
|
|
7222
7236
|
task: async (_, task) => {
|
|
@@ -7250,8 +7264,8 @@ const theme = new Command("theme").description("generate theme to your project")
|
|
|
7250
7264
|
await writeFileSafe(targetPath, JSON.stringify({
|
|
7251
7265
|
name: monorepoConfig.packageName,
|
|
7252
7266
|
...DEFAULT_PACKAGE_JSON,
|
|
7253
|
-
dependencies: Object.fromEntries(REQUIRED_DEPENDENCIES.theme.map((dependency) => splitVersion(dependency))),
|
|
7254
|
-
devDependencies: Object.fromEntries(REQUIRED_DEV_DEPENDENCIES.theme.map((dependency) => splitVersion(dependency))),
|
|
7267
|
+
dependencies: Object.fromEntries(REQUIRED_DEPENDENCIES.theme.map((dependency) => splitVersion(replaceVersion(dependency, PACKAGE_NAME, tag)))),
|
|
7268
|
+
devDependencies: Object.fromEntries(REQUIRED_DEV_DEPENDENCIES.theme.map((dependency) => splitVersion(replaceVersion(dependency, PACKAGE_NAME, tag)))),
|
|
7255
7269
|
exports: exports$1
|
|
7256
7270
|
}), merge(config$1, { format: { parser: "json" } }));
|
|
7257
7271
|
task.title = `Generated ${c.cyan("package.json")}`;
|
|
@@ -7465,9 +7479,9 @@ function generateThemeTokens(theme$1, { internal = false, theme: { responsive =
|
|
|
7465
7479
|
`}`
|
|
7466
7480
|
].join("\n");
|
|
7467
7481
|
else return [
|
|
7468
|
-
`import type { UsageThemeTokens } from "
|
|
7482
|
+
`import type { UsageThemeTokens } from "${PACKAGE_NAME}"`,
|
|
7469
7483
|
``,
|
|
7470
|
-
`declare module
|
|
7484
|
+
`declare module "${PACKAGE_NAME}" {`,
|
|
7471
7485
|
` interface CustomThemeTokens extends UsageThemeTokens {`,
|
|
7472
7486
|
` ${print({
|
|
7473
7487
|
...tokens$1,
|
|
@@ -7541,7 +7555,7 @@ const tokens = new Command("tokens").description("generate theme typings").argum
|
|
|
7541
7555
|
|
|
7542
7556
|
//#endregion
|
|
7543
7557
|
//#region src/commands/update/index.ts
|
|
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 }) {
|
|
7558
|
+
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.").option("-t, --tag <name>", "tag for the registries (e.g. dev, next)").action(async function(targetNames, { config: configPath, cwd: cwd$1, force, format: format$2, install, lint, sequential, tag }) {
|
|
7545
7559
|
const spinner = ora();
|
|
7546
7560
|
try {
|
|
7547
7561
|
const { end } = timer();
|
|
@@ -7589,6 +7603,7 @@ const update = new Command("update").description("update components in your proj
|
|
|
7589
7603
|
const { registryMap } = await getRegistriesAndFiles(componentNames, config$1, {
|
|
7590
7604
|
concurrent: !sequential,
|
|
7591
7605
|
index,
|
|
7606
|
+
tag,
|
|
7592
7607
|
theme: theme$1
|
|
7593
7608
|
});
|
|
7594
7609
|
const { changeMap, dependencyMap } = await getDiff(generatedNames, registryMap, config$1, !sequential);
|