@ant-design/cli 6.5.0 → 6.5.2
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/README.md +15 -1
- package/data/v6.5.2.json.gz +0 -0
- package/data/v6.json.gz +0 -0
- package/data/versions.json +1 -1
- package/dist/index.js +601 -161
- package/package.json +4 -2
- package/data/v6.5.0.json.gz +0 -0
package/dist/index.js
CHANGED
|
@@ -7310,7 +7310,7 @@ var require_compile = __commonJS({
|
|
|
7310
7310
|
const schOrFunc = root.refs[ref];
|
|
7311
7311
|
if (schOrFunc)
|
|
7312
7312
|
return schOrFunc;
|
|
7313
|
-
let _sch =
|
|
7313
|
+
let _sch = resolve3.call(this, root, ref);
|
|
7314
7314
|
if (_sch === void 0) {
|
|
7315
7315
|
const schema = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
|
|
7316
7316
|
const { schemaId } = this.opts;
|
|
@@ -7337,7 +7337,7 @@ var require_compile = __commonJS({
|
|
|
7337
7337
|
function sameSchemaEnv(s1, s2) {
|
|
7338
7338
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
7339
7339
|
}
|
|
7340
|
-
function
|
|
7340
|
+
function resolve3(root, ref) {
|
|
7341
7341
|
let sch;
|
|
7342
7342
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
7343
7343
|
ref = sch;
|
|
@@ -7968,55 +7968,55 @@ var require_fast_uri = __commonJS({
|
|
|
7968
7968
|
}
|
|
7969
7969
|
return uri;
|
|
7970
7970
|
}
|
|
7971
|
-
function
|
|
7971
|
+
function resolve3(baseURI, relativeURI, options) {
|
|
7972
7972
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
7973
7973
|
const resolved = resolveComponent2(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
7974
7974
|
schemelessOptions.skipEscape = true;
|
|
7975
7975
|
return serialize(resolved, schemelessOptions);
|
|
7976
7976
|
}
|
|
7977
|
-
function resolveComponent2(base,
|
|
7977
|
+
function resolveComponent2(base, relative3, options, skipNormalization) {
|
|
7978
7978
|
const target = {};
|
|
7979
7979
|
if (!skipNormalization) {
|
|
7980
7980
|
base = parse3(serialize(base, options), options);
|
|
7981
|
-
|
|
7981
|
+
relative3 = parse3(serialize(relative3, options), options);
|
|
7982
7982
|
}
|
|
7983
7983
|
options = options || {};
|
|
7984
|
-
if (!options.tolerant &&
|
|
7985
|
-
target.scheme =
|
|
7986
|
-
target.userinfo =
|
|
7987
|
-
target.host =
|
|
7988
|
-
target.port =
|
|
7989
|
-
target.path = removeDotSegments(
|
|
7990
|
-
target.query =
|
|
7984
|
+
if (!options.tolerant && relative3.scheme) {
|
|
7985
|
+
target.scheme = relative3.scheme;
|
|
7986
|
+
target.userinfo = relative3.userinfo;
|
|
7987
|
+
target.host = relative3.host;
|
|
7988
|
+
target.port = relative3.port;
|
|
7989
|
+
target.path = removeDotSegments(relative3.path || "");
|
|
7990
|
+
target.query = relative3.query;
|
|
7991
7991
|
} else {
|
|
7992
|
-
if (
|
|
7993
|
-
target.userinfo =
|
|
7994
|
-
target.host =
|
|
7995
|
-
target.port =
|
|
7996
|
-
target.path = removeDotSegments(
|
|
7997
|
-
target.query =
|
|
7992
|
+
if (relative3.userinfo !== void 0 || relative3.host !== void 0 || relative3.port !== void 0) {
|
|
7993
|
+
target.userinfo = relative3.userinfo;
|
|
7994
|
+
target.host = relative3.host;
|
|
7995
|
+
target.port = relative3.port;
|
|
7996
|
+
target.path = removeDotSegments(relative3.path || "");
|
|
7997
|
+
target.query = relative3.query;
|
|
7998
7998
|
} else {
|
|
7999
|
-
if (!
|
|
7999
|
+
if (!relative3.path) {
|
|
8000
8000
|
target.path = base.path;
|
|
8001
|
-
if (
|
|
8002
|
-
target.query =
|
|
8001
|
+
if (relative3.query !== void 0) {
|
|
8002
|
+
target.query = relative3.query;
|
|
8003
8003
|
} else {
|
|
8004
8004
|
target.query = base.query;
|
|
8005
8005
|
}
|
|
8006
8006
|
} else {
|
|
8007
|
-
if (
|
|
8008
|
-
target.path = removeDotSegments(
|
|
8007
|
+
if (relative3.path[0] === "/") {
|
|
8008
|
+
target.path = removeDotSegments(relative3.path);
|
|
8009
8009
|
} else {
|
|
8010
8010
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
8011
|
-
target.path = "/" +
|
|
8011
|
+
target.path = "/" + relative3.path;
|
|
8012
8012
|
} else if (!base.path) {
|
|
8013
|
-
target.path =
|
|
8013
|
+
target.path = relative3.path;
|
|
8014
8014
|
} else {
|
|
8015
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
8015
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative3.path;
|
|
8016
8016
|
}
|
|
8017
8017
|
target.path = removeDotSegments(target.path);
|
|
8018
8018
|
}
|
|
8019
|
-
target.query =
|
|
8019
|
+
target.query = relative3.query;
|
|
8020
8020
|
}
|
|
8021
8021
|
target.userinfo = base.userinfo;
|
|
8022
8022
|
target.host = base.host;
|
|
@@ -8024,7 +8024,7 @@ var require_fast_uri = __commonJS({
|
|
|
8024
8024
|
}
|
|
8025
8025
|
target.scheme = base.scheme;
|
|
8026
8026
|
}
|
|
8027
|
-
target.fragment =
|
|
8027
|
+
target.fragment = relative3.fragment;
|
|
8028
8028
|
return target;
|
|
8029
8029
|
}
|
|
8030
8030
|
function equal(uriA, uriB, options) {
|
|
@@ -8226,7 +8226,7 @@ var require_fast_uri = __commonJS({
|
|
|
8226
8226
|
var fastUri = {
|
|
8227
8227
|
SCHEMES,
|
|
8228
8228
|
normalize,
|
|
8229
|
-
resolve:
|
|
8229
|
+
resolve: resolve3,
|
|
8230
8230
|
resolveComponent: resolveComponent2,
|
|
8231
8231
|
equal,
|
|
8232
8232
|
serialize,
|
|
@@ -15546,12 +15546,18 @@ function loadMetadata(majorVersion) {
|
|
|
15546
15546
|
};
|
|
15547
15547
|
}
|
|
15548
15548
|
}
|
|
15549
|
+
var MAX_METADATA_CACHE_ENTRIES = 32;
|
|
15549
15550
|
var metadataCache = /* @__PURE__ */ new Map();
|
|
15550
15551
|
function loadMetadataForVersion(version2) {
|
|
15551
15552
|
const cached2 = metadataCache.get(version2);
|
|
15552
15553
|
if (cached2) return cached2;
|
|
15553
15554
|
const result = loadMetadataForVersionUncached(version2);
|
|
15554
15555
|
metadataCache.set(version2, result);
|
|
15556
|
+
while (metadataCache.size > MAX_METADATA_CACHE_ENTRIES) {
|
|
15557
|
+
const oldestKey = metadataCache.keys().next().value;
|
|
15558
|
+
if (oldestKey === void 0) break;
|
|
15559
|
+
metadataCache.delete(oldestKey);
|
|
15560
|
+
}
|
|
15555
15561
|
return result;
|
|
15556
15562
|
}
|
|
15557
15563
|
function loadMetadataForVersionUncached(version2) {
|
|
@@ -15748,15 +15754,6 @@ function parsePropsFromDoc(comp) {
|
|
|
15748
15754
|
function backfillFromMajor(comp, majorStore) {
|
|
15749
15755
|
const majorComp = findComponent(majorStore, comp.name);
|
|
15750
15756
|
if (!majorComp) return;
|
|
15751
|
-
if (comp.props.length === 0 && majorComp.props.length > 0) {
|
|
15752
|
-
comp.props = [...majorComp.props];
|
|
15753
|
-
if (!comp.subComponentProps && majorComp.subComponentProps) {
|
|
15754
|
-
comp.subComponentProps = { ...majorComp.subComponentProps };
|
|
15755
|
-
for (const key of Object.keys(comp.subComponentProps)) {
|
|
15756
|
-
comp.subComponentProps[key] = [...majorComp.subComponentProps[key]];
|
|
15757
|
-
}
|
|
15758
|
-
}
|
|
15759
|
-
}
|
|
15760
15757
|
if (!comp.description && majorComp.description) {
|
|
15761
15758
|
comp.description = majorComp.description;
|
|
15762
15759
|
}
|
|
@@ -15766,8 +15763,8 @@ function backfillFromMajor(comp, majorStore) {
|
|
|
15766
15763
|
}
|
|
15767
15764
|
function resolveComponent(component, version2) {
|
|
15768
15765
|
const store = loadMetadataForVersion(version2);
|
|
15769
|
-
const
|
|
15770
|
-
if (!
|
|
15766
|
+
const storedComp = findComponent(store, component);
|
|
15767
|
+
if (!storedComp) {
|
|
15771
15768
|
const names = getAllComponentNames(store);
|
|
15772
15769
|
const suggestion = fuzzyMatch(component, names);
|
|
15773
15770
|
return createError(
|
|
@@ -15776,6 +15773,7 @@ function resolveComponent(component, version2) {
|
|
|
15776
15773
|
suggestion ? `Did you mean '${suggestion}'?` : void 0
|
|
15777
15774
|
);
|
|
15778
15775
|
}
|
|
15776
|
+
const comp = { ...storedComp };
|
|
15779
15777
|
const majorVersion = `v${version2.split(".")[0]}`;
|
|
15780
15778
|
if (comp.props.length === 0 && comp.doc) {
|
|
15781
15779
|
const parsed = parsePropsFromDoc(comp);
|
|
@@ -15786,7 +15784,7 @@ function resolveComponent(component, version2) {
|
|
|
15786
15784
|
}
|
|
15787
15785
|
}
|
|
15788
15786
|
}
|
|
15789
|
-
const needsMajorBackfill =
|
|
15787
|
+
const needsMajorBackfill = !comp.description || !comp.descriptionZh;
|
|
15790
15788
|
if (needsMajorBackfill) {
|
|
15791
15789
|
const majorStore = loadMetadata(majorVersion);
|
|
15792
15790
|
backfillFromMajor(comp, majorStore);
|
|
@@ -15893,8 +15891,8 @@ function toMajor(version2) {
|
|
|
15893
15891
|
return `v${major}`;
|
|
15894
15892
|
}
|
|
15895
15893
|
function compare(a, b) {
|
|
15896
|
-
const sa = semver.coerce(a);
|
|
15897
|
-
const sb = semver.coerce(b);
|
|
15894
|
+
const sa = semver.parse(a) ?? semver.coerce(a, { includePrerelease: true });
|
|
15895
|
+
const sb = semver.parse(b) ?? semver.coerce(b, { includePrerelease: true });
|
|
15898
15896
|
if (!sa || !sb) return null;
|
|
15899
15897
|
return semver.compare(sa, sb);
|
|
15900
15898
|
}
|
|
@@ -16542,10 +16540,7 @@ function diffProps(oldProps, newProps) {
|
|
|
16542
16540
|
}
|
|
16543
16541
|
for (const [name, prop] of oldMap) {
|
|
16544
16542
|
if (!newMap.has(name)) {
|
|
16545
|
-
|
|
16546
|
-
(p) => p.type === prop.type && !oldMap.has(p.name)
|
|
16547
|
-
);
|
|
16548
|
-
removed.push({ name, type: prop.type, replacement: possibleRename?.name });
|
|
16543
|
+
removed.push({ name, type: prop.type });
|
|
16549
16544
|
}
|
|
16550
16545
|
}
|
|
16551
16546
|
return { added, removed, changed };
|
|
@@ -16693,10 +16688,7 @@ function printApiDiff(result, format, lang = "en") {
|
|
|
16693
16688
|
for (const diff of result.diffs) {
|
|
16694
16689
|
console.log(` ${diff.component}:`);
|
|
16695
16690
|
for (const p of diff.added) console.log(` + ${p.name}: ${p.type}`);
|
|
16696
|
-
for (const p of diff.removed) {
|
|
16697
|
-
const note = p.replacement ? ` (replaced by ${p.replacement})` : "";
|
|
16698
|
-
console.log(` - ${p.name}: ${p.type}${note}`);
|
|
16699
|
-
}
|
|
16691
|
+
for (const p of diff.removed) console.log(` - ${p.name}: ${p.type}`);
|
|
16700
16692
|
for (const p of diff.changed) console.log(` ~ ${p.name}: ${p.change}`);
|
|
16701
16693
|
console.log("");
|
|
16702
16694
|
}
|
|
@@ -17458,7 +17450,9 @@ Non-component antd exports (${nonComponents.length}):`,
|
|
|
17458
17450
|
}
|
|
17459
17451
|
|
|
17460
17452
|
// src/commands/lint.ts
|
|
17461
|
-
import { readFileSync as readFileSync7 } from "fs";
|
|
17453
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7, statSync as statSync2 } from "fs";
|
|
17454
|
+
import { execFileSync } from "child_process";
|
|
17455
|
+
import { dirname as dirname4, extname, join as join5, relative, resolve } from "path";
|
|
17462
17456
|
import { parseSync as parseSync2, Visitor as Visitor2 } from "oxc-parser";
|
|
17463
17457
|
function getDeprecatedProps(store) {
|
|
17464
17458
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -17513,6 +17507,51 @@ function getObjectExpressionKeys(attrs, name) {
|
|
|
17513
17507
|
}
|
|
17514
17508
|
return [];
|
|
17515
17509
|
}
|
|
17510
|
+
function getMemberPath(node) {
|
|
17511
|
+
if (!node) return [];
|
|
17512
|
+
if (node.type === "Identifier") return [node.name];
|
|
17513
|
+
if (node.type === "ChainExpression") return getMemberPath(node.expression);
|
|
17514
|
+
if (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") {
|
|
17515
|
+
const objectPath = getMemberPath(node.object);
|
|
17516
|
+
if (objectPath.length === 0) return [];
|
|
17517
|
+
let propertyName;
|
|
17518
|
+
if (node.property?.type === "Identifier" && !node.computed) {
|
|
17519
|
+
propertyName = node.property.name;
|
|
17520
|
+
} else if (node.property?.type === "Literal" && typeof node.property.value === "string") {
|
|
17521
|
+
propertyName = node.property.value;
|
|
17522
|
+
}
|
|
17523
|
+
return propertyName ? [...objectPath, propertyName] : [];
|
|
17524
|
+
}
|
|
17525
|
+
return [];
|
|
17526
|
+
}
|
|
17527
|
+
function collectPatternNames(pattern, names = []) {
|
|
17528
|
+
if (!pattern) return names;
|
|
17529
|
+
if (pattern.type === "Identifier") {
|
|
17530
|
+
names.push(pattern.name);
|
|
17531
|
+
} else if (pattern.type === "AssignmentPattern") {
|
|
17532
|
+
collectPatternNames(pattern.left, names);
|
|
17533
|
+
} else if (pattern.type === "RestElement") {
|
|
17534
|
+
collectPatternNames(pattern.argument, names);
|
|
17535
|
+
} else if (pattern.type === "ArrayPattern") {
|
|
17536
|
+
for (const element of pattern.elements ?? []) collectPatternNames(element, names);
|
|
17537
|
+
} else if (pattern.type === "ObjectPattern") {
|
|
17538
|
+
for (const property of pattern.properties ?? []) {
|
|
17539
|
+
if (property.type === "Property") {
|
|
17540
|
+
collectPatternNames(property.value, names);
|
|
17541
|
+
} else if (property.type === "RestElement") {
|
|
17542
|
+
collectPatternNames(property.argument, names);
|
|
17543
|
+
}
|
|
17544
|
+
}
|
|
17545
|
+
} else if (pattern.pattern) {
|
|
17546
|
+
collectPatternNames(pattern.pattern, names);
|
|
17547
|
+
}
|
|
17548
|
+
return names;
|
|
17549
|
+
}
|
|
17550
|
+
var STATIC_FEEDBACK_METHODS = {
|
|
17551
|
+
message: ["open", "success", "error", "info", "warning", "warn", "loading"],
|
|
17552
|
+
notification: ["open", "success", "error", "info", "warning", "warn"],
|
|
17553
|
+
Modal: ["confirm", "info", "success", "error", "warning", "warn"]
|
|
17554
|
+
};
|
|
17516
17555
|
function createLineMapper(source) {
|
|
17517
17556
|
let lastOffset = 0;
|
|
17518
17557
|
let lastLine = 1;
|
|
@@ -17540,25 +17579,108 @@ function isLocalePath(source, antdAliases) {
|
|
|
17540
17579
|
(alias) => source.startsWith(`${alias}/locale/`) || source.startsWith(`${alias}/es/locale/`) || source.startsWith(`${alias}/lib/locale/`)
|
|
17541
17580
|
);
|
|
17542
17581
|
}
|
|
17582
|
+
var MODULE_EXTENSIONS = /* @__PURE__ */ new Set(["js", "jsx", "ts", "tsx", "mjs", "cjs", "mts", "cts"]);
|
|
17583
|
+
function isNonModuleSource(source) {
|
|
17584
|
+
const match = /\.([^./]+)$/.exec(source);
|
|
17585
|
+
if (!match) return false;
|
|
17586
|
+
return !MODULE_EXTENSIONS.has(match[1].toLowerCase());
|
|
17587
|
+
}
|
|
17543
17588
|
function mayContainAntdAlias(content, antdAliases) {
|
|
17544
17589
|
return antdAliases.some((antdAlias) => content.includes(antdAlias));
|
|
17545
17590
|
}
|
|
17546
17591
|
function collectAntdAlias(source, previous) {
|
|
17547
17592
|
return [...previous, source];
|
|
17548
17593
|
}
|
|
17549
|
-
function
|
|
17594
|
+
function execGit(cwd, args) {
|
|
17595
|
+
const options = { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] };
|
|
17596
|
+
try {
|
|
17597
|
+
return execFileSync("git", args, options);
|
|
17598
|
+
} catch (error2) {
|
|
17599
|
+
const stderr = typeof error2.stderr === "string" ? error2.stderr.trim() : "";
|
|
17600
|
+
throw new Error(stderr || (error2 instanceof Error ? error2.message : "git command failed"));
|
|
17601
|
+
}
|
|
17602
|
+
}
|
|
17603
|
+
function getGitRoot(targetPath) {
|
|
17604
|
+
const absoluteTarget = resolve(targetPath);
|
|
17605
|
+
if (!existsSync5(absoluteTarget)) {
|
|
17606
|
+
throw new Error(`Lint target not found: ${targetPath}`);
|
|
17607
|
+
}
|
|
17608
|
+
let gitCwd = absoluteTarget;
|
|
17609
|
+
try {
|
|
17610
|
+
if (statSync2(absoluteTarget).isFile()) {
|
|
17611
|
+
gitCwd = dirname4(absoluteTarget);
|
|
17612
|
+
}
|
|
17613
|
+
} catch {
|
|
17614
|
+
gitCwd = absoluteTarget;
|
|
17615
|
+
}
|
|
17616
|
+
return execGit(gitCwd, ["rev-parse", "--show-toplevel"]).trim();
|
|
17617
|
+
}
|
|
17618
|
+
function getPathspec(repoRoot, targetPath) {
|
|
17619
|
+
const rel = relative(repoRoot, resolve(targetPath));
|
|
17620
|
+
return rel === "" ? "." : rel.replace(/\\/g, "/");
|
|
17621
|
+
}
|
|
17622
|
+
function isLintableSource(filePath, gitPath = filePath) {
|
|
17623
|
+
if (!existsSync5(filePath)) return false;
|
|
17624
|
+
try {
|
|
17625
|
+
if (!statSync2(filePath).isFile()) return false;
|
|
17626
|
+
} catch {
|
|
17627
|
+
return false;
|
|
17628
|
+
}
|
|
17629
|
+
if (!SCAN_EXTENSIONS.has(extname(filePath))) return false;
|
|
17630
|
+
return !gitPath.split(/[\\/]/).some((segment) => SKIP_DIRS.has(segment) || segment.startsWith(".umi"));
|
|
17631
|
+
}
|
|
17632
|
+
function resolveDiffBase(repoRoot, diff) {
|
|
17633
|
+
if (typeof diff === "string" && diff.trim()) {
|
|
17634
|
+
const requested = diff.trim();
|
|
17635
|
+
try {
|
|
17636
|
+
return execGit(repoRoot, ["merge-base", requested, "HEAD"]).trim() || requested;
|
|
17637
|
+
} catch {
|
|
17638
|
+
return requested;
|
|
17639
|
+
}
|
|
17640
|
+
}
|
|
17641
|
+
try {
|
|
17642
|
+
return execGit(repoRoot, ["merge-base", "origin/main", "HEAD"]).trim();
|
|
17643
|
+
} catch {
|
|
17644
|
+
return "HEAD";
|
|
17645
|
+
}
|
|
17646
|
+
}
|
|
17647
|
+
function collectGitFiles(targetPath, mode, diff) {
|
|
17648
|
+
const repoRoot = getGitRoot(targetPath);
|
|
17649
|
+
const pathspec = getPathspec(repoRoot, targetPath);
|
|
17650
|
+
const args = mode === "staged" ? ["diff", "--name-only", "--cached", "--diff-filter=ACMR", "--", pathspec] : ["diff", "--name-only", "--diff-filter=ACMR", resolveDiffBase(repoRoot, diff), "--", pathspec];
|
|
17651
|
+
return execGit(repoRoot, args).split("\n").map((file2) => file2.trim()).filter(Boolean).filter((file2) => isLintableSource(join5(repoRoot, file2), file2)).map((file2) => join5(repoRoot, file2));
|
|
17652
|
+
}
|
|
17653
|
+
function lintFile(filePath, deprecatedMap, antdAliases, antdMajor, only) {
|
|
17550
17654
|
let content;
|
|
17551
17655
|
try {
|
|
17552
17656
|
content = readFileSync7(filePath, "utf-8");
|
|
17553
|
-
} catch {
|
|
17554
|
-
return
|
|
17657
|
+
} catch (error2) {
|
|
17658
|
+
return {
|
|
17659
|
+
issues: [],
|
|
17660
|
+
skipped: {
|
|
17661
|
+
file: filePath,
|
|
17662
|
+
reason: "read-error",
|
|
17663
|
+
message: error2 instanceof Error ? error2.message : "Failed to read file"
|
|
17664
|
+
}
|
|
17665
|
+
};
|
|
17555
17666
|
}
|
|
17556
|
-
if (!mayContainAntdAlias(content, antdAliases)) return [];
|
|
17667
|
+
if (!mayContainAntdAlias(content, antdAliases)) return { issues: [] };
|
|
17557
17668
|
const result = parseSync2(filePath, content);
|
|
17558
|
-
if (result.errors.length > 0)
|
|
17669
|
+
if (result.errors.length > 0) {
|
|
17670
|
+
return {
|
|
17671
|
+
issues: [],
|
|
17672
|
+
skipped: {
|
|
17673
|
+
file: filePath,
|
|
17674
|
+
reason: "parse-error",
|
|
17675
|
+
message: result.errors[0]?.message ?? "Failed to parse file"
|
|
17676
|
+
}
|
|
17677
|
+
};
|
|
17678
|
+
}
|
|
17559
17679
|
const issues = [];
|
|
17560
17680
|
const importedComponents = /* @__PURE__ */ new Set();
|
|
17681
|
+
const antdImportLocals = /* @__PURE__ */ new Map();
|
|
17561
17682
|
const offsetToLine = createLineMapper(content);
|
|
17683
|
+
const enableV5UsageRules = antdMajor >= 5;
|
|
17562
17684
|
const lineOf = (node) => {
|
|
17563
17685
|
if (typeof node.start === "number") return offsetToLine(node.start);
|
|
17564
17686
|
return node.loc?.start?.line ?? 0;
|
|
@@ -17570,7 +17692,47 @@ function lintFile(filePath, deprecatedMap, antdAliases, only) {
|
|
|
17570
17692
|
const isInsideComponent = (name) => jsxAncestorStack.includes(name);
|
|
17571
17693
|
const pendingPerformanceIssues = [];
|
|
17572
17694
|
const namespaceMemberUsage = /* @__PURE__ */ new Map();
|
|
17695
|
+
const scopeStack = [/* @__PURE__ */ new Set()];
|
|
17696
|
+
const declarePattern = (pattern) => {
|
|
17697
|
+
const currentScope = scopeStack[scopeStack.length - 1];
|
|
17698
|
+
for (const name of collectPatternNames(pattern)) {
|
|
17699
|
+
currentScope.add(name);
|
|
17700
|
+
}
|
|
17701
|
+
};
|
|
17702
|
+
const isShadowed = (name) => scopeStack.some((scope) => scope.has(name));
|
|
17703
|
+
const pushFunctionScope = (node) => {
|
|
17704
|
+
scopeStack.push(/* @__PURE__ */ new Set());
|
|
17705
|
+
for (const param of node.params ?? []) declarePattern(param);
|
|
17706
|
+
};
|
|
17573
17707
|
const visitor = new Visitor2({
|
|
17708
|
+
BlockStatement() {
|
|
17709
|
+
scopeStack.push(/* @__PURE__ */ new Set());
|
|
17710
|
+
},
|
|
17711
|
+
"BlockStatement:exit"() {
|
|
17712
|
+
scopeStack.pop();
|
|
17713
|
+
},
|
|
17714
|
+
FunctionDeclaration: pushFunctionScope,
|
|
17715
|
+
"FunctionDeclaration:exit"() {
|
|
17716
|
+
scopeStack.pop();
|
|
17717
|
+
},
|
|
17718
|
+
FunctionExpression: pushFunctionScope,
|
|
17719
|
+
"FunctionExpression:exit"() {
|
|
17720
|
+
scopeStack.pop();
|
|
17721
|
+
},
|
|
17722
|
+
ArrowFunctionExpression: pushFunctionScope,
|
|
17723
|
+
"ArrowFunctionExpression:exit"() {
|
|
17724
|
+
scopeStack.pop();
|
|
17725
|
+
},
|
|
17726
|
+
CatchClause(node) {
|
|
17727
|
+
scopeStack.push(/* @__PURE__ */ new Set());
|
|
17728
|
+
if (node.param) declarePattern(node.param);
|
|
17729
|
+
},
|
|
17730
|
+
"CatchClause:exit"() {
|
|
17731
|
+
scopeStack.pop();
|
|
17732
|
+
},
|
|
17733
|
+
VariableDeclarator(node) {
|
|
17734
|
+
declarePattern(node.id);
|
|
17735
|
+
},
|
|
17574
17736
|
JSXElement(node) {
|
|
17575
17737
|
const elName = getJSXElementName(node.openingElement?.name);
|
|
17576
17738
|
jsxAncestorStack.push(elName);
|
|
@@ -17586,24 +17748,39 @@ function lintFile(filePath, deprecatedMap, antdAliases, only) {
|
|
|
17586
17748
|
if (spec.type === "ImportSpecifier") {
|
|
17587
17749
|
if (spec.importKind === "type") continue;
|
|
17588
17750
|
const name = spec.imported?.name || spec.local?.name;
|
|
17751
|
+
const localName = spec.local?.name || name;
|
|
17589
17752
|
if (name) importedComponents.add(name);
|
|
17753
|
+
if (name && localName) antdImportLocals.set(localName, name);
|
|
17590
17754
|
}
|
|
17591
17755
|
if (!only || only === "performance") {
|
|
17592
|
-
const
|
|
17593
|
-
const
|
|
17594
|
-
if (
|
|
17756
|
+
const isNamespace = spec.type === "ImportNamespaceSpecifier";
|
|
17757
|
+
const isDefault = spec.type === "ImportDefaultSpecifier";
|
|
17758
|
+
if ((isNamespace || isDefault) && !isLocalePath(source, antdAliases) && !isNonModuleSource(source)) {
|
|
17595
17759
|
const localName = spec.local?.name ?? "";
|
|
17596
17760
|
pendingPerformanceIssues.push({
|
|
17597
17761
|
line: lineOf(node),
|
|
17598
17762
|
source,
|
|
17599
17763
|
localName,
|
|
17600
|
-
kind:
|
|
17764
|
+
kind: isNamespace ? "namespace" : "default"
|
|
17601
17765
|
});
|
|
17602
17766
|
namespaceMemberUsage.set(localName, /* @__PURE__ */ new Set());
|
|
17603
17767
|
}
|
|
17604
17768
|
}
|
|
17605
17769
|
}
|
|
17606
17770
|
},
|
|
17771
|
+
CallExpression(node) {
|
|
17772
|
+
if (only && only !== "usage") return;
|
|
17773
|
+
if (!enableV5UsageRules) return;
|
|
17774
|
+
const path7 = getMemberPath(node.callee);
|
|
17775
|
+
if (path7.length < 2) return;
|
|
17776
|
+
const importedName = antdImportLocals.get(path7[0]);
|
|
17777
|
+
const method = path7[1];
|
|
17778
|
+
const callName = path7.join(".");
|
|
17779
|
+
const line = lineOf(node);
|
|
17780
|
+
if (importedName && !isShadowed(path7[0]) && STATIC_FEEDBACK_METHODS[importedName]?.includes(method)) {
|
|
17781
|
+
report("usage", "warning", line, `Static antd feedback API \`${callName}\` cannot consume ConfigProvider context. Use App.useApp() instead.`);
|
|
17782
|
+
}
|
|
17783
|
+
},
|
|
17607
17784
|
JSXOpeningElement(node) {
|
|
17608
17785
|
const compName = getJSXElementName(node.name);
|
|
17609
17786
|
if (!compName) return;
|
|
@@ -17720,6 +17897,21 @@ function lintFile(filePath, deprecatedMap, antdAliases, only) {
|
|
|
17720
17897
|
report("usage", "warning", line, "TreeSelect `multiple={false}` is ignored when `treeCheckable` is true");
|
|
17721
17898
|
}
|
|
17722
17899
|
}
|
|
17900
|
+
if (enableV5UsageRules && (compName === "Upload" || compName === "Upload.Dragger") && importedComponents.has("Upload")) {
|
|
17901
|
+
if (hasAttr(attrs, "fileList") && hasAttr(attrs, "defaultFileList")) {
|
|
17902
|
+
report("usage", "warning", line, "Upload should not use both controlled `fileList` and uncontrolled `defaultFileList`");
|
|
17903
|
+
} else if (hasAttr(attrs, "fileList") && !hasAttr(attrs, "onChange")) {
|
|
17904
|
+
report("usage", "warning", line, "Upload with controlled `fileList` should provide `onChange`");
|
|
17905
|
+
}
|
|
17906
|
+
}
|
|
17907
|
+
if (enableV5UsageRules && importedComponents.has("Select")) {
|
|
17908
|
+
if (compName === "Select.Option") {
|
|
17909
|
+
report("usage", "warning", line, "Select.Option children are not recommended in antd v5+. Use the `options` prop instead.");
|
|
17910
|
+
}
|
|
17911
|
+
if (compName === "Select.OptGroup") {
|
|
17912
|
+
report("usage", "warning", line, "Select.OptGroup children are not recommended in antd v5+. Use grouped `options` instead.");
|
|
17913
|
+
}
|
|
17914
|
+
}
|
|
17723
17915
|
}
|
|
17724
17916
|
if (!only || only === "performance") {
|
|
17725
17917
|
if (compName === "Select" && importedComponents.has("Select") || compName === "TreeSelect" && importedComponents.has("TreeSelect")) {
|
|
@@ -17738,47 +17930,57 @@ function lintFile(filePath, deprecatedMap, antdAliases, only) {
|
|
|
17738
17930
|
const suggestion = memberList ? `Use named imports: \`import { ${memberList} } from '${pending.source}'\`` : "Use named imports instead";
|
|
17739
17931
|
report("performance", "error", pending.line, `Avoid ${importKind} import from ${pending.source}. ${suggestion}`);
|
|
17740
17932
|
}
|
|
17741
|
-
return issues;
|
|
17933
|
+
return { issues };
|
|
17934
|
+
}
|
|
17935
|
+
function printSkippedFiles(skippedFiles) {
|
|
17936
|
+
for (const skipped of skippedFiles) {
|
|
17937
|
+
console.log(` - ${skipped.file} [${skipped.reason}] ${skipped.message}`);
|
|
17938
|
+
}
|
|
17742
17939
|
}
|
|
17743
17940
|
function registerLintCommand(program2) {
|
|
17744
|
-
program2.command("lint [target]").description("Check antd usage against best practices").option("--only <category>", "Only check specific category (deprecated, a11y, usage, performance)").option("--antd-alias <source>", "Treat additional package names as aliases of antd imports", collectAntdAlias, []).action((target, cmdOpts) => {
|
|
17941
|
+
program2.command("lint [target]").description("Check antd usage against best practices").option("--only <category>", "Only check specific category (deprecated, a11y, usage, performance)").option("--antd-alias <source>", "Treat additional package names as aliases of antd imports", collectAntdAlias, []).option("--diff [base]", "Only lint files changed from a git diff base (default: origin/main, fallback: HEAD)").option("--staged", "Only lint staged git files").action((target, cmdOpts) => {
|
|
17745
17942
|
const opts = program2.opts();
|
|
17746
17943
|
const targetPath = target || ".";
|
|
17944
|
+
if (cmdOpts.diff && cmdOpts.staged) {
|
|
17945
|
+
program2.error("--diff and --staged cannot be used together");
|
|
17946
|
+
}
|
|
17747
17947
|
const versionInfo = detectVersion(opts.version);
|
|
17748
17948
|
const store = loadMetadataForVersion(versionInfo.version);
|
|
17749
17949
|
const deprecatedMap = getDeprecatedProps(store);
|
|
17750
17950
|
const antdAliases = normalizeAntdAliases(cmdOpts.antdAlias);
|
|
17751
|
-
|
|
17951
|
+
let files;
|
|
17952
|
+
try {
|
|
17953
|
+
files = cmdOpts.staged ? collectGitFiles(targetPath, "staged") : cmdOpts.diff ? collectGitFiles(targetPath, "diff", cmdOpts.diff) : collectFiles(targetPath);
|
|
17954
|
+
} catch (error2) {
|
|
17955
|
+
program2.error(error2 instanceof Error ? error2.message : String(error2));
|
|
17956
|
+
}
|
|
17752
17957
|
const allIssues = [];
|
|
17958
|
+
const skippedFiles = [];
|
|
17753
17959
|
for (const file2 of files) {
|
|
17754
|
-
|
|
17960
|
+
const result = lintFile(file2, deprecatedMap, antdAliases, parseInt(versionInfo.majorVersion.slice(1), 10), cmdOpts.only);
|
|
17961
|
+
allIssues.push(...result.issues);
|
|
17962
|
+
if (result.skipped) skippedFiles.push(result.skipped);
|
|
17755
17963
|
}
|
|
17756
17964
|
const summary = {
|
|
17757
17965
|
total: allIssues.length,
|
|
17758
17966
|
deprecated: allIssues.filter((i) => i.rule === "deprecated").length,
|
|
17759
17967
|
a11y: allIssues.filter((i) => i.rule === "a11y").length,
|
|
17760
17968
|
usage: allIssues.filter((i) => i.rule === "usage").length,
|
|
17761
|
-
performance: allIssues.filter((i) => i.rule === "performance").length
|
|
17969
|
+
performance: allIssues.filter((i) => i.rule === "performance").length,
|
|
17970
|
+
skipped: skippedFiles.length
|
|
17762
17971
|
};
|
|
17763
17972
|
if (opts.format === "json") {
|
|
17764
|
-
output({ issues: allIssues, summary }, "json");
|
|
17765
|
-
return;
|
|
17766
|
-
}
|
|
17767
|
-
if (allIssues.length === 0) {
|
|
17768
|
-
console.log(localize(
|
|
17769
|
-
`Scanned ${files.length} files. No issues found.`,
|
|
17770
|
-
`\u626B\u63CF\u4E86 ${files.length} \u4E2A\u6587\u4EF6\uFF0C\u672A\u53D1\u73B0\u95EE\u9898\u3002`,
|
|
17771
|
-
opts.lang
|
|
17772
|
-
));
|
|
17973
|
+
output({ issues: allIssues, skippedFiles, partial: skippedFiles.length > 0, summary }, "json");
|
|
17773
17974
|
return;
|
|
17774
17975
|
}
|
|
17775
17976
|
const summaryParts = [
|
|
17776
17977
|
localize(`${summary.deprecated} deprecated`, `${summary.deprecated} \u5DF2\u5E9F\u5F03`, opts.lang),
|
|
17777
17978
|
localize(`${summary.a11y} a11y`, `${summary.a11y} \u65E0\u969C\u788D`, opts.lang),
|
|
17778
17979
|
localize(`${summary.usage} usage`, `${summary.usage} \u7528\u6CD5`, opts.lang),
|
|
17779
|
-
localize(`${summary.performance} performance`, `${summary.performance} \u6027\u80FD`, opts.lang)
|
|
17980
|
+
localize(`${summary.performance} performance`, `${summary.performance} \u6027\u80FD`, opts.lang),
|
|
17981
|
+
localize(`${summary.skipped} skipped`, `${summary.skipped} \u5DF2\u8DF3\u8FC7`, opts.lang)
|
|
17780
17982
|
].join(", ");
|
|
17781
|
-
if (opts.format === "markdown") {
|
|
17983
|
+
if (opts.format === "markdown" && (allIssues.length > 0 || skippedFiles.length > 0)) {
|
|
17782
17984
|
console.log(`## ${localize("Lint Results", "Lint \u7ED3\u679C", opts.lang)}`);
|
|
17783
17985
|
console.log("");
|
|
17784
17986
|
console.log(localize(
|
|
@@ -17787,18 +17989,50 @@ function registerLintCommand(program2) {
|
|
|
17787
17989
|
opts.lang
|
|
17788
17990
|
));
|
|
17789
17991
|
console.log("");
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17992
|
+
if (allIssues.length > 0) {
|
|
17993
|
+
const headers = [
|
|
17994
|
+
localize("Rule", "\u89C4\u5219", opts.lang),
|
|
17995
|
+
localize("Severity", "\u7EA7\u522B", opts.lang),
|
|
17996
|
+
localize("Message", "\u4FE1\u606F", opts.lang),
|
|
17997
|
+
localize("File", "\u6587\u4EF6", opts.lang)
|
|
17998
|
+
];
|
|
17999
|
+
const rows = allIssues.map((i) => [i.rule, i.severity, i.message, `${i.file}:${i.line}`]);
|
|
18000
|
+
console.log(formatTable(headers, rows, "markdown"));
|
|
18001
|
+
}
|
|
18002
|
+
if (skippedFiles.length > 0) {
|
|
18003
|
+
console.log("");
|
|
18004
|
+
console.log(`### ${localize("Skipped Files", "\u8DF3\u8FC7\u6587\u4EF6", opts.lang)}`);
|
|
18005
|
+
console.log("");
|
|
18006
|
+
console.log(formatTable(
|
|
18007
|
+
[
|
|
18008
|
+
localize("Reason", "\u539F\u56E0", opts.lang),
|
|
18009
|
+
localize("Message", "\u4FE1\u606F", opts.lang),
|
|
18010
|
+
localize("File", "\u6587\u4EF6", opts.lang)
|
|
18011
|
+
],
|
|
18012
|
+
skippedFiles.map((file2) => [file2.reason, file2.message, file2.file]),
|
|
18013
|
+
"markdown"
|
|
18014
|
+
));
|
|
18015
|
+
}
|
|
17798
18016
|
console.log("");
|
|
17799
18017
|
console.log(`**${localize("Summary:", "\u6458\u8981\uFF1A", opts.lang)}** ${summaryParts}`);
|
|
17800
18018
|
return;
|
|
17801
18019
|
}
|
|
18020
|
+
if (allIssues.length === 0) {
|
|
18021
|
+
console.log(localize(
|
|
18022
|
+
`Scanned ${files.length} files. No issues found.`,
|
|
18023
|
+
`\u626B\u63CF\u4E86 ${files.length} \u4E2A\u6587\u4EF6\uFF0C\u672A\u53D1\u73B0\u95EE\u9898\u3002`,
|
|
18024
|
+
opts.lang
|
|
18025
|
+
));
|
|
18026
|
+
if (skippedFiles.length > 0) {
|
|
18027
|
+
console.log(localize(
|
|
18028
|
+
`Skipped ${skippedFiles.length} file${skippedFiles.length > 1 ? "s" : ""}:`,
|
|
18029
|
+
`\u8DF3\u8FC7 ${skippedFiles.length} \u4E2A\u6587\u4EF6\uFF1A`,
|
|
18030
|
+
opts.lang
|
|
18031
|
+
));
|
|
18032
|
+
printSkippedFiles(skippedFiles);
|
|
18033
|
+
}
|
|
18034
|
+
return;
|
|
18035
|
+
}
|
|
17802
18036
|
console.log(localize(
|
|
17803
18037
|
`Scanned ${files.length} files. Found ${allIssues.length} issues:`,
|
|
17804
18038
|
`\u626B\u63CF\u4E86 ${files.length} \u4E2A\u6587\u4EF6\uFF0C\u53D1\u73B0 ${allIssues.length} \u4E2A\u95EE\u9898\uFF1A`,
|
|
@@ -17809,13 +18043,18 @@ function registerLintCommand(program2) {
|
|
|
17809
18043
|
console.log(` ${icon} ${issue2.file}:${issue2.line} [${issue2.rule}]`);
|
|
17810
18044
|
console.log(` ${issue2.message}`);
|
|
17811
18045
|
}
|
|
18046
|
+
if (skippedFiles.length > 0) {
|
|
18047
|
+
console.log(`
|
|
18048
|
+
${localize("Skipped files:", "\u8DF3\u8FC7\u6587\u4EF6\uFF1A", opts.lang)}`);
|
|
18049
|
+
printSkippedFiles(skippedFiles);
|
|
18050
|
+
}
|
|
17812
18051
|
console.log(`
|
|
17813
18052
|
${localize("Summary:", "\u6458\u8981\uFF1A", opts.lang)} ${summaryParts}`);
|
|
17814
18053
|
});
|
|
17815
18054
|
}
|
|
17816
18055
|
|
|
17817
18056
|
// src/commands/migrate.ts
|
|
17818
|
-
import { relative } from "path";
|
|
18057
|
+
import { relative as relative2 } from "path";
|
|
17819
18058
|
|
|
17820
18059
|
// src/commands/migrate-v3-to-v4.ts
|
|
17821
18060
|
var V3_TO_V4_STEPS = [
|
|
@@ -19113,7 +19352,7 @@ function formatApplyPrompt(from, to, steps, dir, format) {
|
|
|
19113
19352
|
);
|
|
19114
19353
|
const fixableSteps = relevantSteps.filter((s) => s.autoFixable && s.searchPattern);
|
|
19115
19354
|
const manualSteps = relevantSteps.filter((s) => !s.autoFixable);
|
|
19116
|
-
const relativePath = (file2) =>
|
|
19355
|
+
const relativePath = (file2) => relative2(process.cwd(), file2);
|
|
19117
19356
|
if (format === "json") {
|
|
19118
19357
|
const componentSummary = {};
|
|
19119
19358
|
for (const [name, files] of scan.componentFiles) {
|
|
@@ -19288,14 +19527,14 @@ function registerMigrateCommand(program2) {
|
|
|
19288
19527
|
|
|
19289
19528
|
// src/utils/issue.ts
|
|
19290
19529
|
import { platform, release } from "os";
|
|
19291
|
-
import { execFileSync } from "child_process";
|
|
19292
|
-
import { join as
|
|
19530
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
19531
|
+
import { join as join6 } from "path";
|
|
19293
19532
|
function getSystem() {
|
|
19294
19533
|
return `${platform()} ${release()}`;
|
|
19295
19534
|
}
|
|
19296
19535
|
function collectAntdEnv(cwd, versionOverride) {
|
|
19297
|
-
const antdPkg = readJson(
|
|
19298
|
-
const reactPkg = readJson(
|
|
19536
|
+
const antdPkg = readJson(join6(cwd, "node_modules", "antd", "package.json"));
|
|
19537
|
+
const reactPkg = readJson(join6(cwd, "node_modules", "react", "package.json"));
|
|
19299
19538
|
return {
|
|
19300
19539
|
antd: versionOverride || antdPkg?.version || "unknown",
|
|
19301
19540
|
react: reactPkg?.version || "unknown",
|
|
@@ -19306,7 +19545,7 @@ function collectAntdEnv(cwd, versionOverride) {
|
|
|
19306
19545
|
function collectCliEnv() {
|
|
19307
19546
|
let cliVersion;
|
|
19308
19547
|
try {
|
|
19309
|
-
cliVersion = "6.5.
|
|
19548
|
+
cliVersion = "6.5.2";
|
|
19310
19549
|
} catch (err) {
|
|
19311
19550
|
console.error("Failed to get CLI version:", err);
|
|
19312
19551
|
cliVersion = "unknown";
|
|
@@ -19399,14 +19638,14 @@ ${extra}`;
|
|
|
19399
19638
|
}
|
|
19400
19639
|
function checkGhAvailable() {
|
|
19401
19640
|
try {
|
|
19402
|
-
|
|
19641
|
+
execFileSync2("gh", ["--version"], { stdio: "ignore" });
|
|
19403
19642
|
return true;
|
|
19404
19643
|
} catch {
|
|
19405
19644
|
return false;
|
|
19406
19645
|
}
|
|
19407
19646
|
}
|
|
19408
19647
|
function submitViaGh(repo, title, body) {
|
|
19409
|
-
const result =
|
|
19648
|
+
const result = execFileSync2("gh", ["issue", "create", "--repo", repo, "--title", title, "--body", body], {
|
|
19410
19649
|
encoding: "utf-8",
|
|
19411
19650
|
timeout: 3e4
|
|
19412
19651
|
}).trim();
|
|
@@ -19579,8 +19818,8 @@ function registerBugCliCommand(program2) {
|
|
|
19579
19818
|
|
|
19580
19819
|
// src/commands/env.ts
|
|
19581
19820
|
import { readdirSync as readdirSync3 } from "fs";
|
|
19582
|
-
import { execFileSync as
|
|
19583
|
-
import { join as
|
|
19821
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
19822
|
+
import { join as join7, isAbsolute } from "path";
|
|
19584
19823
|
import stringWidth2 from "string-width";
|
|
19585
19824
|
async function collectEnvinfo(cwd) {
|
|
19586
19825
|
try {
|
|
@@ -19615,7 +19854,7 @@ async function collectEnvinfo(cwd) {
|
|
|
19615
19854
|
}
|
|
19616
19855
|
result.Binaries = result.Binaries || {};
|
|
19617
19856
|
try {
|
|
19618
|
-
const registry2 =
|
|
19857
|
+
const registry2 = execFileSync3("npm", ["config", "get", "registry"], {
|
|
19619
19858
|
cwd,
|
|
19620
19859
|
encoding: "utf-8",
|
|
19621
19860
|
timeout: 5e3,
|
|
@@ -19634,7 +19873,7 @@ var CORE_DEPS = ["antd", "react", "react-dom", "dayjs", "@ant-design/cssinjs", "
|
|
|
19634
19873
|
function collectDependencies(cwd) {
|
|
19635
19874
|
const result = {};
|
|
19636
19875
|
for (const dep of CORE_DEPS) {
|
|
19637
|
-
const pkg = readJson(
|
|
19876
|
+
const pkg = readJson(join7(cwd, "node_modules", dep, "package.json"));
|
|
19638
19877
|
result[dep] = pkg?.version ?? null;
|
|
19639
19878
|
}
|
|
19640
19879
|
return result;
|
|
@@ -19642,24 +19881,24 @@ function collectDependencies(cwd) {
|
|
|
19642
19881
|
function scanEcosystem(cwd) {
|
|
19643
19882
|
const result = {};
|
|
19644
19883
|
const coreSet = new Set(CORE_DEPS);
|
|
19645
|
-
const scopeDir =
|
|
19884
|
+
const scopeDir = join7(cwd, "node_modules", "@ant-design");
|
|
19646
19885
|
try {
|
|
19647
19886
|
const entries = readdirSync3(scopeDir);
|
|
19648
19887
|
for (const entry of entries) {
|
|
19649
19888
|
if (entry.startsWith(".")) continue;
|
|
19650
19889
|
const fullName = `@ant-design/${entry}`;
|
|
19651
19890
|
if (coreSet.has(fullName)) continue;
|
|
19652
|
-
const pkg = readJson(
|
|
19891
|
+
const pkg = readJson(join7(scopeDir, entry, "package.json"));
|
|
19653
19892
|
if (pkg?.version) result[fullName] = pkg.version;
|
|
19654
19893
|
}
|
|
19655
19894
|
} catch {
|
|
19656
19895
|
}
|
|
19657
|
-
const nmDir =
|
|
19896
|
+
const nmDir = join7(cwd, "node_modules");
|
|
19658
19897
|
try {
|
|
19659
19898
|
const entries = readdirSync3(nmDir);
|
|
19660
19899
|
for (const entry of entries) {
|
|
19661
19900
|
if (!entry.startsWith("rc-")) continue;
|
|
19662
|
-
const pkg = readJson(
|
|
19901
|
+
const pkg = readJson(join7(nmDir, entry, "package.json"));
|
|
19663
19902
|
if (pkg?.version) result[entry] = pkg.version;
|
|
19664
19903
|
}
|
|
19665
19904
|
} catch {
|
|
@@ -19702,7 +19941,7 @@ var ENVINFO_ORDER = ["System", "Binaries", "Managers", "Utilities", "Servers", "
|
|
|
19702
19941
|
function collectBuildTools(cwd) {
|
|
19703
19942
|
const result = {};
|
|
19704
19943
|
for (const tool of BUILD_TOOLS) {
|
|
19705
|
-
const pkg = readJson(
|
|
19944
|
+
const pkg = readJson(join7(cwd, "node_modules", tool, "package.json"));
|
|
19706
19945
|
if (pkg?.version) result[tool] = pkg.version;
|
|
19707
19946
|
}
|
|
19708
19947
|
return result;
|
|
@@ -19763,7 +20002,7 @@ function formatMarkdown2(data) {
|
|
|
19763
20002
|
function registerEnvCommand(program2) {
|
|
19764
20003
|
program2.command("env [dir]").description("Collect antd-related environment information for bug reporting").action(async (dir) => {
|
|
19765
20004
|
const opts = program2.opts();
|
|
19766
|
-
const cwd = dir ? isAbsolute(dir) ? dir :
|
|
20005
|
+
const cwd = dir ? isAbsolute(dir) ? dir : join7(process.cwd(), dir) : process.cwd();
|
|
19767
20006
|
const data = {
|
|
19768
20007
|
envinfo: await collectEnvinfo(cwd),
|
|
19769
20008
|
dependencies: collectDependencies(cwd),
|
|
@@ -19784,7 +20023,7 @@ function registerEnvCommand(program2) {
|
|
|
19784
20023
|
import { execFile, spawn } from "child_process";
|
|
19785
20024
|
|
|
19786
20025
|
// src/utils/detect-pm.ts
|
|
19787
|
-
import { execFileSync as
|
|
20026
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
19788
20027
|
var PM_RULES = [
|
|
19789
20028
|
{ pm: "utoo", keywords: [".utoo", "utoo/global"] },
|
|
19790
20029
|
{ pm: "cnpm", keywords: [".cnpm", "cnpm/global"] },
|
|
@@ -19812,7 +20051,7 @@ function inferPackageManagerFromPath(binPath) {
|
|
|
19812
20051
|
function detectPackageManager() {
|
|
19813
20052
|
const isWin = process.platform === "win32";
|
|
19814
20053
|
try {
|
|
19815
|
-
const binPath =
|
|
20054
|
+
const binPath = execFileSync4(isWin ? "where" : "which", ["antd"], {
|
|
19816
20055
|
encoding: "utf-8",
|
|
19817
20056
|
timeout: 5e3
|
|
19818
20057
|
}).trim();
|
|
@@ -20199,7 +20438,7 @@ var retryifyAsync = (fn, options) => {
|
|
|
20199
20438
|
throw error2;
|
|
20200
20439
|
const delay = Math.round(interval * Math.random());
|
|
20201
20440
|
if (delay > 0) {
|
|
20202
|
-
const delayPromise = new Promise((
|
|
20441
|
+
const delayPromise = new Promise((resolve3) => setTimeout(resolve3, delay));
|
|
20203
20442
|
return delayPromise.then(() => attempt.apply(void 0, args));
|
|
20204
20443
|
} else {
|
|
20205
20444
|
return attempt.apply(void 0, args);
|
|
@@ -21519,7 +21758,7 @@ function printUpdateNotice(currentVersion, latestVersion) {
|
|
|
21519
21758
|
}
|
|
21520
21759
|
async function checkForUpdate() {
|
|
21521
21760
|
if (process.env.CI || process.env.NO_UPDATE_CHECK) return;
|
|
21522
|
-
const currentVersion = "6.5.
|
|
21761
|
+
const currentVersion = "6.5.2";
|
|
21523
21762
|
if (!valid(currentVersion)) return;
|
|
21524
21763
|
const now = Date.now();
|
|
21525
21764
|
const cache = cacheStore.get("updateCache") ?? null;
|
|
@@ -21554,7 +21793,7 @@ function formatUpgradeMarkdown(data, lang) {
|
|
|
21554
21793
|
}
|
|
21555
21794
|
var IS_WIN = process.platform === "win32";
|
|
21556
21795
|
function runUpgrade(cmd, args) {
|
|
21557
|
-
return new Promise((
|
|
21796
|
+
return new Promise((resolve3, reject) => {
|
|
21558
21797
|
const child = spawn(cmd, args, {
|
|
21559
21798
|
stdio: "inherit",
|
|
21560
21799
|
timeout: 12e4,
|
|
@@ -21563,7 +21802,7 @@ function runUpgrade(cmd, args) {
|
|
|
21563
21802
|
});
|
|
21564
21803
|
child.on("error", reject);
|
|
21565
21804
|
child.on("close", (code, signal) => {
|
|
21566
|
-
if (code === 0)
|
|
21805
|
+
if (code === 0) resolve3();
|
|
21567
21806
|
else if (code !== null) reject(new Error(`Process exited with code ${code}`));
|
|
21568
21807
|
else reject(new Error(`Process killed by signal ${signal ?? "unknown"}`));
|
|
21569
21808
|
});
|
|
@@ -21572,7 +21811,7 @@ function runUpgrade(cmd, args) {
|
|
|
21572
21811
|
function registerUpgradeCommand(program2) {
|
|
21573
21812
|
program2.command("upgrade").description("Upgrade the CLI to the latest version").action(async () => {
|
|
21574
21813
|
const opts = program2.opts();
|
|
21575
|
-
const currentVersion = "6.5.
|
|
21814
|
+
const currentVersion = "6.5.2";
|
|
21576
21815
|
let latestVersion;
|
|
21577
21816
|
try {
|
|
21578
21817
|
latestVersion = await fetchLatestVersion();
|
|
@@ -21674,14 +21913,14 @@ function registerUpgradeCommand(program2) {
|
|
|
21674
21913
|
}
|
|
21675
21914
|
let newVersion = null;
|
|
21676
21915
|
try {
|
|
21677
|
-
newVersion = await new Promise((
|
|
21916
|
+
newVersion = await new Promise((resolve3, reject) => {
|
|
21678
21917
|
execFile("antd", ["--cli-version"], {
|
|
21679
21918
|
timeout: 1e4,
|
|
21680
21919
|
/* v8 ignore next -- Windows-only branch */
|
|
21681
21920
|
...IS_WIN ? { shell: true } : {}
|
|
21682
21921
|
}, (error2, stdout) => {
|
|
21683
21922
|
if (error2) reject(error2);
|
|
21684
|
-
else
|
|
21923
|
+
else resolve3(stdout.trim());
|
|
21685
21924
|
});
|
|
21686
21925
|
});
|
|
21687
21926
|
} catch {
|
|
@@ -34518,7 +34757,7 @@ var Protocol = class {
|
|
|
34518
34757
|
return;
|
|
34519
34758
|
}
|
|
34520
34759
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
34521
|
-
await new Promise((
|
|
34760
|
+
await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
|
|
34522
34761
|
options?.signal?.throwIfAborted();
|
|
34523
34762
|
}
|
|
34524
34763
|
} catch (error2) {
|
|
@@ -34535,7 +34774,7 @@ var Protocol = class {
|
|
|
34535
34774
|
*/
|
|
34536
34775
|
request(request, resultSchema, options) {
|
|
34537
34776
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
34538
|
-
return new Promise((
|
|
34777
|
+
return new Promise((resolve3, reject) => {
|
|
34539
34778
|
const earlyReject = (error2) => {
|
|
34540
34779
|
reject(error2);
|
|
34541
34780
|
};
|
|
@@ -34613,7 +34852,7 @@ var Protocol = class {
|
|
|
34613
34852
|
if (!parseResult.success) {
|
|
34614
34853
|
reject(parseResult.error);
|
|
34615
34854
|
} else {
|
|
34616
|
-
|
|
34855
|
+
resolve3(parseResult.data);
|
|
34617
34856
|
}
|
|
34618
34857
|
} catch (error2) {
|
|
34619
34858
|
reject(error2);
|
|
@@ -34874,12 +35113,12 @@ var Protocol = class {
|
|
|
34874
35113
|
}
|
|
34875
35114
|
} catch {
|
|
34876
35115
|
}
|
|
34877
|
-
return new Promise((
|
|
35116
|
+
return new Promise((resolve3, reject) => {
|
|
34878
35117
|
if (signal.aborted) {
|
|
34879
35118
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
34880
35119
|
return;
|
|
34881
35120
|
}
|
|
34882
|
-
const timeoutId = setTimeout(
|
|
35121
|
+
const timeoutId = setTimeout(resolve3, interval);
|
|
34883
35122
|
signal.addEventListener("abort", () => {
|
|
34884
35123
|
clearTimeout(timeoutId);
|
|
34885
35124
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -35749,12 +35988,12 @@ var StdioServerTransport = class {
|
|
|
35749
35988
|
this.onclose?.();
|
|
35750
35989
|
}
|
|
35751
35990
|
send(message) {
|
|
35752
|
-
return new Promise((
|
|
35991
|
+
return new Promise((resolve3) => {
|
|
35753
35992
|
const json2 = serializeMessage(message);
|
|
35754
35993
|
if (this._stdout.write(json2)) {
|
|
35755
|
-
|
|
35994
|
+
resolve3();
|
|
35756
35995
|
} else {
|
|
35757
|
-
this._stdout.once("drain",
|
|
35996
|
+
this._stdout.once("drain", resolve3);
|
|
35758
35997
|
}
|
|
35759
35998
|
});
|
|
35760
35999
|
}
|
|
@@ -35991,9 +36230,7 @@ ${SHARED_TOOL_WORKFLOW}
|
|
|
35991
36230
|
|
|
35992
36231
|
// src/commands/mcp.ts
|
|
35993
36232
|
function registerMcpCommand(program2) {
|
|
35994
|
-
program2.command("mcp").description(
|
|
35995
|
-
'Start MCP (Model Context Protocol) server for AI assistant integration.\nNot meant to be run directly. Configure your AI tool with:\n { "mcpServers": { "antd": { "command": "npx", "args": ["-y", "@ant-design/cli", "mcp"] } } }'
|
|
35996
|
-
).action(
|
|
36233
|
+
program2.command("mcp").description("Start MCP server for AI assistant integration").action(
|
|
35997
36234
|
/* v8 ignore start */
|
|
35998
36235
|
async () => {
|
|
35999
36236
|
if (process.stdin.isTTY) {
|
|
@@ -36021,7 +36258,7 @@ function registerMcpCommand(program2) {
|
|
|
36021
36258
|
const opts = program2.opts();
|
|
36022
36259
|
const versionInfo = detectVersion(opts.version);
|
|
36023
36260
|
const server = new Server(
|
|
36024
|
-
{ name: "antd", version: "6.5.
|
|
36261
|
+
{ name: "antd", version: "6.5.2" },
|
|
36025
36262
|
{ capabilities: { tools: {}, prompts: {} } }
|
|
36026
36263
|
);
|
|
36027
36264
|
const handleTool = createToolHandler({
|
|
@@ -36069,8 +36306,8 @@ function registerMcpCommand(program2) {
|
|
|
36069
36306
|
}
|
|
36070
36307
|
|
|
36071
36308
|
// src/commands/setup.ts
|
|
36072
|
-
import { cpSync, existsSync as
|
|
36073
|
-
import { dirname as
|
|
36309
|
+
import { cpSync, existsSync as existsSync6, mkdirSync, readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "fs";
|
|
36310
|
+
import { dirname as dirname5, join as join8, resolve as resolve2 } from "path";
|
|
36074
36311
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
36075
36312
|
var CLIENTS = {
|
|
36076
36313
|
claude: { file: ".mcp.json", serverKey: "mcpServers" },
|
|
@@ -36080,13 +36317,13 @@ var CLIENTS = {
|
|
|
36080
36317
|
var INSTRUCTIONS_START = "<!-- antd-cli setup start -->";
|
|
36081
36318
|
var INSTRUCTIONS_END = "<!-- antd-cli setup end -->";
|
|
36082
36319
|
function isAgentClient(value) {
|
|
36083
|
-
return value === "codex" || Object.prototype.hasOwnProperty.call(CLIENTS, value);
|
|
36320
|
+
return value === "codex" || value === "github-actions" || Object.prototype.hasOwnProperty.call(CLIENTS, value);
|
|
36084
36321
|
}
|
|
36085
36322
|
function isMcpAgentClient(value) {
|
|
36086
|
-
return value !== "codex";
|
|
36323
|
+
return value !== "codex" && value !== "github-actions";
|
|
36087
36324
|
}
|
|
36088
36325
|
function isSetupMode(value) {
|
|
36089
|
-
return value === "mcp" || value === "skill" || value === "both";
|
|
36326
|
+
return value === "mcp" || value === "skill" || value === "both" || value === "ci";
|
|
36090
36327
|
}
|
|
36091
36328
|
function buildMcpArgs(opts) {
|
|
36092
36329
|
const args = ["-y", "@ant-design/cli", "mcp"];
|
|
@@ -36099,7 +36336,7 @@ function buildMcpArgs(opts) {
|
|
|
36099
36336
|
return args;
|
|
36100
36337
|
}
|
|
36101
36338
|
function readConfig(file2) {
|
|
36102
|
-
if (!
|
|
36339
|
+
if (!existsSync6(file2)) return {};
|
|
36103
36340
|
const content = readFileSync8(file2, "utf-8").trim();
|
|
36104
36341
|
if (!content) return {};
|
|
36105
36342
|
const parsed = JSON.parse(content);
|
|
@@ -36122,6 +36359,50 @@ function createMergedConfig(current, serverKey, globalOpts) {
|
|
|
36122
36359
|
}
|
|
36123
36360
|
};
|
|
36124
36361
|
}
|
|
36362
|
+
function shellArg(value) {
|
|
36363
|
+
return /^[A-Za-z0-9@._/:=-]+$/.test(value) ? value : `'${value.replace(/'/g, "'\\''")}'`;
|
|
36364
|
+
}
|
|
36365
|
+
function buildCliCommand(command, args, opts) {
|
|
36366
|
+
const parts = ["npx", "-y", "@ant-design/cli", command, ...args];
|
|
36367
|
+
if (opts.version) {
|
|
36368
|
+
parts.push("--version", opts.version);
|
|
36369
|
+
}
|
|
36370
|
+
if (opts.lang && opts.lang !== "en") {
|
|
36371
|
+
parts.push("--lang", opts.lang);
|
|
36372
|
+
}
|
|
36373
|
+
return parts.map(shellArg).join(" ");
|
|
36374
|
+
}
|
|
36375
|
+
function createGitHubActionsWorkflow(globalOpts) {
|
|
36376
|
+
return [
|
|
36377
|
+
"name: Ant Design CLI",
|
|
36378
|
+
"",
|
|
36379
|
+
"on:",
|
|
36380
|
+
" pull_request:",
|
|
36381
|
+
"",
|
|
36382
|
+
"permissions:",
|
|
36383
|
+
" contents: read",
|
|
36384
|
+
"",
|
|
36385
|
+
"jobs:",
|
|
36386
|
+
" antd:",
|
|
36387
|
+
" runs-on: ubuntu-latest",
|
|
36388
|
+
" steps:",
|
|
36389
|
+
" - uses: actions/checkout@v7",
|
|
36390
|
+
" - uses: actions/setup-node@v6",
|
|
36391
|
+
" with:",
|
|
36392
|
+
" node-version: 20",
|
|
36393
|
+
" cache: npm",
|
|
36394
|
+
" - run: npm ci",
|
|
36395
|
+
" - run: npm run build",
|
|
36396
|
+
" - name: Run antd doctor",
|
|
36397
|
+
` run: ${buildCliCommand("doctor", ["--format", "json"], globalOpts)}`,
|
|
36398
|
+
" - name: Run antd lint",
|
|
36399
|
+
` run: ${buildCliCommand("lint", ["./src", "--format", "json"], globalOpts)}`,
|
|
36400
|
+
""
|
|
36401
|
+
].join("\n");
|
|
36402
|
+
}
|
|
36403
|
+
function normalizeTextFile(content) {
|
|
36404
|
+
return content.replace(/\r\n/g, "\n");
|
|
36405
|
+
}
|
|
36125
36406
|
function stableJson(value) {
|
|
36126
36407
|
return JSON.stringify(value, null, 2) + "\n";
|
|
36127
36408
|
}
|
|
@@ -36143,8 +36424,8 @@ function createMcpInstructionsBlock() {
|
|
|
36143
36424
|
].join("\n");
|
|
36144
36425
|
}
|
|
36145
36426
|
function getSkillDir(projectDir, client) {
|
|
36146
|
-
if (client === "claude") return
|
|
36147
|
-
return
|
|
36427
|
+
if (client === "claude") return join8(projectDir, ".claude", "skills", "antd");
|
|
36428
|
+
return join8(projectDir, ".agents", "skills", "antd");
|
|
36148
36429
|
}
|
|
36149
36430
|
function getSkillInstructionsPath(client) {
|
|
36150
36431
|
if (client === "claude") return ".claude/skills/antd/SKILL.md";
|
|
@@ -36181,11 +36462,12 @@ function createInstructionsBlock(mode, client) {
|
|
|
36181
36462
|
return createMcpInstructionsBlock();
|
|
36182
36463
|
}
|
|
36183
36464
|
function chooseInstructionsFile(projectDir, client) {
|
|
36184
|
-
|
|
36465
|
+
if (client === "github-actions") return join8(projectDir, ".github", "workflows", "antd-cli.yml");
|
|
36466
|
+
return join8(projectDir, client === "claude" ? "CLAUDE.md" : "AGENTS.md");
|
|
36185
36467
|
}
|
|
36186
36468
|
function writeInstructions(projectDir, dryRun, mode, client) {
|
|
36187
36469
|
const file2 = chooseInstructionsFile(projectDir, client);
|
|
36188
|
-
const current =
|
|
36470
|
+
const current = existsSync6(file2) ? readFileSync8(file2, "utf-8") : "";
|
|
36189
36471
|
const block = createInstructionsBlock(mode, client);
|
|
36190
36472
|
const pattern = new RegExp(`${INSTRUCTIONS_START}[\\s\\S]*?${INSTRUCTIONS_END}`);
|
|
36191
36473
|
const next = pattern.test(current) ? current.replace(pattern, block) : `${current.trimEnd()}${current.trimEnd() ? "\n\n" : ""}${block}
|
|
@@ -36197,13 +36479,13 @@ function writeInstructions(projectDir, dryRun, mode, client) {
|
|
|
36197
36479
|
return { file: file2, changed };
|
|
36198
36480
|
}
|
|
36199
36481
|
function resolveBundledSkillDir() {
|
|
36200
|
-
const here =
|
|
36482
|
+
const here = dirname5(fileURLToPath4(import.meta.url));
|
|
36201
36483
|
const candidates = [
|
|
36202
|
-
|
|
36203
|
-
|
|
36204
|
-
|
|
36484
|
+
resolve2(here, "../../skills/antd"),
|
|
36485
|
+
resolve2(here, "../skills/antd"),
|
|
36486
|
+
resolve2(process.cwd(), "skills/antd")
|
|
36205
36487
|
];
|
|
36206
|
-
const found = candidates.find((dir) =>
|
|
36488
|
+
const found = candidates.find((dir) => existsSync6(join8(dir, "SKILL.md")));
|
|
36207
36489
|
if (!found) {
|
|
36208
36490
|
throw new Error("Bundled Ant Design skill not found");
|
|
36209
36491
|
}
|
|
@@ -36212,11 +36494,11 @@ function resolveBundledSkillDir() {
|
|
|
36212
36494
|
function installSkill(projectDir, dryRun, client) {
|
|
36213
36495
|
const source = resolveBundledSkillDir();
|
|
36214
36496
|
const target = getSkillDir(projectDir, client);
|
|
36215
|
-
const sourceSkill =
|
|
36216
|
-
const targetSkill =
|
|
36217
|
-
const changed = !
|
|
36497
|
+
const sourceSkill = join8(source, "SKILL.md");
|
|
36498
|
+
const targetSkill = join8(target, "SKILL.md");
|
|
36499
|
+
const changed = !existsSync6(targetSkill) || readFileSync8(sourceSkill, "utf-8") !== readFileSync8(targetSkill, "utf-8");
|
|
36218
36500
|
if (changed && !dryRun) {
|
|
36219
|
-
mkdirSync(
|
|
36501
|
+
mkdirSync(dirname5(target), { recursive: true });
|
|
36220
36502
|
cpSync(source, target, { recursive: true, force: true });
|
|
36221
36503
|
}
|
|
36222
36504
|
return { dir: target, changed };
|
|
@@ -36235,7 +36517,7 @@ function isMatchingServerEntry(actual, expected) {
|
|
|
36235
36517
|
function checkInstructions(projectDir, mode, client) {
|
|
36236
36518
|
const expected = createInstructionsBlock(mode, client);
|
|
36237
36519
|
const file2 = chooseInstructionsFile(projectDir, client);
|
|
36238
|
-
if (!
|
|
36520
|
+
if (!existsSync6(file2)) {
|
|
36239
36521
|
return [mode === "mcp" ? "MCP instructions not found" : "Skill instructions not found"];
|
|
36240
36522
|
}
|
|
36241
36523
|
if (!readFileSync8(file2, "utf-8").includes(expected)) {
|
|
@@ -36245,18 +36527,20 @@ function checkInstructions(projectDir, mode, client) {
|
|
|
36245
36527
|
}
|
|
36246
36528
|
function checkSkill(projectDir, client) {
|
|
36247
36529
|
const source = resolveBundledSkillDir();
|
|
36248
|
-
const sourceSkill =
|
|
36249
|
-
const targetSkill =
|
|
36250
|
-
if (!
|
|
36530
|
+
const sourceSkill = join8(source, "SKILL.md");
|
|
36531
|
+
const targetSkill = join8(getSkillDir(projectDir, client), "SKILL.md");
|
|
36532
|
+
if (!existsSync6(targetSkill)) return ["Ant Design skill not installed"];
|
|
36251
36533
|
if (readFileSync8(sourceSkill, "utf-8") !== readFileSync8(targetSkill, "utf-8")) {
|
|
36252
36534
|
return ["Ant Design skill does not match bundled skill"];
|
|
36253
36535
|
}
|
|
36254
36536
|
return [];
|
|
36255
36537
|
}
|
|
36256
36538
|
function checkAgent(client, projectDir, globalOpts, mode, shouldCheckInstructions = false) {
|
|
36539
|
+
const isGitHubActions = client === "github-actions";
|
|
36257
36540
|
const clientConfig = isMcpAgentClient(client) ? CLIENTS[client] : void 0;
|
|
36258
|
-
const file2 = clientConfig ?
|
|
36541
|
+
const file2 = isGitHubActions ? resolve2(projectDir, ".github", "workflows", "antd-cli.yml") : clientConfig ? resolve2(projectDir, clientConfig.file) : chooseInstructionsFile(projectDir, client);
|
|
36259
36542
|
const targets = [
|
|
36543
|
+
...isGitHubActions ? [file2] : [],
|
|
36260
36544
|
...(mode === "mcp" || mode === "both") && clientConfig ? [file2] : [],
|
|
36261
36545
|
...mode === "skill" || mode === "both" ? [getSkillDir(projectDir, client)] : [],
|
|
36262
36546
|
...mode === "skill" || mode === "both" || shouldCheckInstructions ? [chooseInstructionsFile(projectDir, client)] : []
|
|
@@ -36265,8 +36549,29 @@ function checkAgent(client, projectDir, globalOpts, mode, shouldCheckInstruction
|
|
|
36265
36549
|
const expected = clientConfig ? getServerEntry(expectedConfig, clientConfig.serverKey) : {};
|
|
36266
36550
|
const problems = [];
|
|
36267
36551
|
let actual;
|
|
36552
|
+
if (isGitHubActions) {
|
|
36553
|
+
const expectedWorkflow = createGitHubActionsWorkflow(globalOpts);
|
|
36554
|
+
if (!existsSync6(file2)) {
|
|
36555
|
+
problems.push("GitHub Actions workflow not found");
|
|
36556
|
+
} else {
|
|
36557
|
+
actual = normalizeTextFile(readFileSync8(file2, "utf-8"));
|
|
36558
|
+
if (actual !== expectedWorkflow) {
|
|
36559
|
+
problems.push("GitHub Actions workflow does not match expected config");
|
|
36560
|
+
}
|
|
36561
|
+
}
|
|
36562
|
+
return {
|
|
36563
|
+
client,
|
|
36564
|
+
mode,
|
|
36565
|
+
file: file2,
|
|
36566
|
+
targets,
|
|
36567
|
+
configured: problems.length === 0,
|
|
36568
|
+
problems,
|
|
36569
|
+
expected: { workflow: expectedWorkflow },
|
|
36570
|
+
actual
|
|
36571
|
+
};
|
|
36572
|
+
}
|
|
36268
36573
|
if ((mode === "mcp" || mode === "both") && clientConfig) {
|
|
36269
|
-
if (!
|
|
36574
|
+
if (!existsSync6(file2)) {
|
|
36270
36575
|
problems.push("Config file not found");
|
|
36271
36576
|
} else {
|
|
36272
36577
|
const current = readConfig(file2);
|
|
@@ -36383,8 +36688,26 @@ function getSetupErrorSuggestion(error2, lang) {
|
|
|
36383
36688
|
);
|
|
36384
36689
|
}
|
|
36385
36690
|
function setup(client, projectDir, globalOpts, dryRun = false, mode = "mcp", shouldWriteInstructions = false) {
|
|
36691
|
+
const isGitHubActions = client === "github-actions";
|
|
36386
36692
|
const clientConfig = isMcpAgentClient(client) ? CLIENTS[client] : void 0;
|
|
36387
|
-
const file2 = clientConfig ?
|
|
36693
|
+
const file2 = isGitHubActions ? resolve2(projectDir, ".github", "workflows", "antd-cli.yml") : clientConfig ? resolve2(projectDir, clientConfig.file) : chooseInstructionsFile(projectDir, client);
|
|
36694
|
+
if (isGitHubActions) {
|
|
36695
|
+
const workflow = createGitHubActionsWorkflow(globalOpts);
|
|
36696
|
+
const current2 = existsSync6(file2) ? normalizeTextFile(readFileSync8(file2, "utf-8")) : "";
|
|
36697
|
+
const changed2 = current2 !== workflow;
|
|
36698
|
+
if (!dryRun && changed2) {
|
|
36699
|
+
mkdirSync(dirname5(file2), { recursive: true });
|
|
36700
|
+
writeFileSync2(file2, workflow);
|
|
36701
|
+
}
|
|
36702
|
+
return {
|
|
36703
|
+
client,
|
|
36704
|
+
mode,
|
|
36705
|
+
file: file2,
|
|
36706
|
+
changed: changed2,
|
|
36707
|
+
dryRun,
|
|
36708
|
+
config: { workflow }
|
|
36709
|
+
};
|
|
36710
|
+
}
|
|
36388
36711
|
const shouldWriteMcp = mode === "mcp" || mode === "both";
|
|
36389
36712
|
const current = shouldWriteMcp && clientConfig ? readConfig(file2) : {};
|
|
36390
36713
|
const config2 = shouldWriteMcp && clientConfig ? createMergedConfig(current, clientConfig.serverKey, globalOpts) : {};
|
|
@@ -36392,7 +36715,7 @@ function setup(client, projectDir, globalOpts, dryRun = false, mode = "mcp", sho
|
|
|
36392
36715
|
let instructions;
|
|
36393
36716
|
let skill;
|
|
36394
36717
|
if (!dryRun && changed) {
|
|
36395
|
-
mkdirSync(
|
|
36718
|
+
mkdirSync(dirname5(file2), { recursive: true });
|
|
36396
36719
|
writeFileSync2(file2, stableJson(config2));
|
|
36397
36720
|
}
|
|
36398
36721
|
if (mode === "skill" || mode === "both") {
|
|
@@ -36419,7 +36742,7 @@ function setup(client, projectDir, globalOpts, dryRun = false, mode = "mcp", sho
|
|
|
36419
36742
|
};
|
|
36420
36743
|
}
|
|
36421
36744
|
function registerSetupCommand(program2) {
|
|
36422
|
-
program2.command("setup").description("Set up Ant Design MCP/Skill for AI agents").requiredOption("--client <client>", "Agent client: claude, cursor, vscode, or
|
|
36745
|
+
program2.command("setup").description("Set up Ant Design MCP/Skill for AI agents or GitHub Actions").requiredOption("--client <client>", "Agent client: claude, cursor, vscode, codex, or github-actions").option("--mode <mode>", "Setup mode: mcp, skill, both, or ci").option("--project <dir>", "Project directory to write config into", process.cwd()).option("--dry-run", "Preview the config without writing files").option("--check", "Check whether the agent is already configured").option("--write-instructions", "Write agent instructions for using the antd MCP server").action((cmdOpts) => {
|
|
36423
36746
|
const opts = program2.opts();
|
|
36424
36747
|
if (!isAgentClient(cmdOpts.client)) {
|
|
36425
36748
|
const err = createError(
|
|
@@ -36430,8 +36753,8 @@ function registerSetupCommand(program2) {
|
|
|
36430
36753
|
opts.lang
|
|
36431
36754
|
),
|
|
36432
36755
|
localize(
|
|
36433
|
-
"Use one of: claude, cursor, vscode, codex.",
|
|
36434
|
-
"\u8BF7\u4F7F\u7528: claude, cursor, vscode, codex\u3002",
|
|
36756
|
+
"Use one of: claude, cursor, vscode, codex, github-actions.",
|
|
36757
|
+
"\u8BF7\u4F7F\u7528: claude, cursor, vscode, codex, github-actions\u3002",
|
|
36435
36758
|
opts.lang
|
|
36436
36759
|
)
|
|
36437
36760
|
);
|
|
@@ -36448,8 +36771,8 @@ function registerSetupCommand(program2) {
|
|
|
36448
36771
|
opts.lang
|
|
36449
36772
|
),
|
|
36450
36773
|
localize(
|
|
36451
|
-
"Use one of: mcp, skill, both.",
|
|
36452
|
-
"\u8BF7\u4F7F\u7528: mcp, skill, both\u3002",
|
|
36774
|
+
"Use one of: mcp, skill, both, ci.",
|
|
36775
|
+
"\u8BF7\u4F7F\u7528: mcp, skill, both, ci\u3002",
|
|
36453
36776
|
opts.lang
|
|
36454
36777
|
)
|
|
36455
36778
|
);
|
|
@@ -36457,7 +36780,7 @@ function registerSetupCommand(program2) {
|
|
|
36457
36780
|
process.exitCode = 1;
|
|
36458
36781
|
return;
|
|
36459
36782
|
}
|
|
36460
|
-
const mode = cmdOpts.mode ?? (cmdOpts.client === "codex" ? "skill" : "mcp");
|
|
36783
|
+
const mode = cmdOpts.mode ?? (cmdOpts.client === "codex" ? "skill" : cmdOpts.client === "github-actions" ? "ci" : "mcp");
|
|
36461
36784
|
if (cmdOpts.client === "codex" && mode !== "skill") {
|
|
36462
36785
|
const err = createError(
|
|
36463
36786
|
ErrorCodes.INVALID_ARGUMENT,
|
|
@@ -36476,6 +36799,42 @@ function registerSetupCommand(program2) {
|
|
|
36476
36799
|
process.exitCode = 1;
|
|
36477
36800
|
return;
|
|
36478
36801
|
}
|
|
36802
|
+
if (cmdOpts.client === "github-actions" && mode !== "ci") {
|
|
36803
|
+
const err = createError(
|
|
36804
|
+
ErrorCodes.INVALID_ARGUMENT,
|
|
36805
|
+
localize(
|
|
36806
|
+
"GitHub Actions setup only supports '--mode ci'",
|
|
36807
|
+
"GitHub Actions setup \u76EE\u524D\u53EA\u652F\u6301 '--mode ci'",
|
|
36808
|
+
opts.lang
|
|
36809
|
+
),
|
|
36810
|
+
localize(
|
|
36811
|
+
"Use `antd setup --client github-actions --mode ci` to write the workflow.",
|
|
36812
|
+
"\u8BF7\u4F7F\u7528 `antd setup --client github-actions --mode ci` \u5199\u5165 workflow\u3002",
|
|
36813
|
+
opts.lang
|
|
36814
|
+
)
|
|
36815
|
+
);
|
|
36816
|
+
printError(err, opts.format);
|
|
36817
|
+
process.exitCode = 1;
|
|
36818
|
+
return;
|
|
36819
|
+
}
|
|
36820
|
+
if (cmdOpts.client !== "github-actions" && mode === "ci") {
|
|
36821
|
+
const err = createError(
|
|
36822
|
+
ErrorCodes.INVALID_ARGUMENT,
|
|
36823
|
+
localize(
|
|
36824
|
+
"'--mode ci' is only supported with --client github-actions",
|
|
36825
|
+
"'--mode ci' \u4EC5\u652F\u6301\u4E0E --client github-actions \u4E00\u8D77\u4F7F\u7528",
|
|
36826
|
+
opts.lang
|
|
36827
|
+
),
|
|
36828
|
+
localize(
|
|
36829
|
+
"Use `--mode mcp`, `--mode skill`, or `--mode both` for agent clients.",
|
|
36830
|
+
"Agent \u5BA2\u6237\u7AEF\u8BF7\u4F7F\u7528 `--mode mcp`\u3001`--mode skill` \u6216 `--mode both`\u3002",
|
|
36831
|
+
opts.lang
|
|
36832
|
+
)
|
|
36833
|
+
);
|
|
36834
|
+
printError(err, opts.format);
|
|
36835
|
+
process.exitCode = 1;
|
|
36836
|
+
return;
|
|
36837
|
+
}
|
|
36479
36838
|
try {
|
|
36480
36839
|
const result = cmdOpts.check ? checkAgent(cmdOpts.client, cmdOpts.project, opts, mode, Boolean(cmdOpts.writeInstructions)) : setup(
|
|
36481
36840
|
cmdOpts.client,
|
|
@@ -36505,11 +36864,85 @@ function registerSetupCommand(program2) {
|
|
|
36505
36864
|
});
|
|
36506
36865
|
}
|
|
36507
36866
|
|
|
36867
|
+
// src/output/banner.ts
|
|
36868
|
+
import cfonts from "cfonts";
|
|
36869
|
+
|
|
36870
|
+
// src/output/logo.ts
|
|
36871
|
+
var HELP_LOGO_TEXT = " \u2584\u2588\u2588\u2584\n \u2584\u2588\u2588\u2580\u2580\u2588\u2588\u2584\n \u2584\u2588\u2588\u2580 \u2580\u2580 \u2584\n \u2584\u2588\u2588\u2580 \u2584\u2584\u2584\u2584 \u2580\u2588\u2588\u2584\n\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\n \u2580\u2588\u2588\u2584 \u2580\u2580\u2580\u2580 \u2584\u2588\u2588\u2580\n \u2580\u2588\u2588\u2584 \u2584\u2584 \u2580\n \u2580\u2588\u2588\u2584\u2584\u2588\u2588\u2580\n \u2580\u2588\u2588\u2580";
|
|
36872
|
+
var HELP_LOGO_ANSI = " \x1B[38;2;36;191;255m\u2584\x1B[39m\x1B[38;2;39;200;255m\x1B[48;2;37;192;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;40;201;255m\x1B[48;2;39;190;254m\u2580\x1B[39m\x1B[49m\x1B[38;2;44;182;251m\u2584\x1B[39m\n \x1B[38;2;30;172;255m\u2584\x1B[39m\x1B[38;2;33;181;255m\x1B[48;2;30;173;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;34;183;255m\x1B[48;2;31;175;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;34;184;255m\u2580\x1B[39m\x1B[38;2;58;155;242m\u2580\x1B[39m\x1B[38;2;59;157;242m\x1B[48;2;57;162;244m\u2580\x1B[39m\x1B[49m\x1B[38;2;57;162;244m\x1B[48;2;56;167;245m\u2580\x1B[39m\x1B[49m\x1B[38;2;54;172;247m\u2584\x1B[39m\n \x1B[38;2;24;153;255m\u2584\x1B[39m\x1B[38;2;27;162;255m\x1B[48;2;24;155;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;27;164;255m\x1B[48;2;25;156;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;28;165;255m\u2580\x1B[39m \x1B[38;2;54;172;247m\u2580\x1B[39m\x1B[38;2;53;177;248m\u2580\x1B[39m \x1B[38;2;249;106;103m\u2584\x1B[39m\n \x1B[38;2;19;138;255m\u2584\x1B[39m\x1B[38;2;21;144;255m\x1B[48;2;19;139;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;21;145;255m\x1B[48;2;20;140;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;22;147;255m\u2580\x1B[39m \x1B[38;2;248;87;98m\u2584\x1B[39m\x1B[38;2;248;94;102m\u2584\x1B[39m\x1B[38;2;248;100;104m\u2584\x1B[39m\x1B[38;2;248;100;104m\u2584\x1B[39m \x1B[38;2;248;94;99m\u2580\x1B[39m\x1B[38;2;248;96;99m\x1B[48;2;248;84;95m\u2580\x1B[39m\x1B[49m\x1B[38;2;248;98;100m\x1B[48;2;248;86;96m\u2580\x1B[39m\x1B[49m\x1B[38;2;248;88;97m\u2584\x1B[39m\n\x1B[38;2;18;134;255m\x1B[48;2;18;131;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;19;135;255m\x1B[48;2;18;132;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;19;136;255m\x1B[48;2;18;131;255m\u2580\x1B[39m\x1B[49m \x1B[38;2;247;71;89m\x1B[48;2;246;58;75m\u2580\x1B[39m\x1B[49m\x1B[38;2;247;76;92m\x1B[48;2;246;61;78m\u2580\x1B[39m\x1B[49m\x1B[38;2;247;80;95m\x1B[48;2;247;65;82m\u2580\x1B[39m\x1B[49m\x1B[38;2;248;85;97m\x1B[48;2;247;68;86m\u2580\x1B[39m\x1B[49m \x1B[38;2;247;74;91m\x1B[48;2;247;65;82m\u2580\x1B[39m\x1B[49m\x1B[38;2;247;76;92m\x1B[48;2;247;67;85m\u2580\x1B[39m\x1B[49m\x1B[38;2;247;78;93m\x1B[48;2;247;69;87m\u2580\x1B[39m\x1B[49m\n \x1B[38;2;17;128;255m\u2580\x1B[39m\x1B[38;2;17;128;255m\x1B[48;2;16;125;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;17;128;255m\x1B[48;2;16;125;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;16;124;255m\u2584\x1B[39m \x1B[38;2;246;48;64m\u2580\x1B[39m\x1B[38;2;246;48;64m\u2580\x1B[39m\x1B[38;2;246;51;67m\u2580\x1B[39m\x1B[38;2;246;56;73m\u2580\x1B[39m \x1B[38;2;246;45;61m\u2584\x1B[39m\x1B[38;2;246;55;71m\x1B[48;2;246;47;63m\u2580\x1B[39m\x1B[49m\x1B[38;2;246;57;74m\x1B[48;2;246;49;66m\u2580\x1B[39m\x1B[49m\x1B[38;2;246;59;77m\u2580\x1B[39m\n \x1B[38;2;15;121;255m\u2580\x1B[39m\x1B[38;2;16;121;255m\x1B[48;2;15;118;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;15;121;255m\x1B[48;2;15;118;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;15;118;255m\u2584\x1B[39m \x1B[38;2;15;120;255m\u2584\x1B[39m\x1B[38;2;15;121;255m\u2584\x1B[39m \x1B[38;2;246;41;57m\u2580\x1B[39m\n \x1B[38;2;14;114;255m\u2580\x1B[39m\x1B[38;2;14;115;255m\x1B[48;2;13;111;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;14;114;255m\x1B[48;2;13;111;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;13;111;255m\u2584\x1B[39m\x1B[38;2;13;111;255m\u2584\x1B[39m\x1B[38;2;14;116;255m\x1B[48;2;14;112;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;15;117;255m\x1B[48;2;14;113;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;15;117;255m\u2580\x1B[39m\n \x1B[38;2;13;108;255m\u2580\x1B[39m\x1B[38;2;13;108;255m\x1B[48;2;12;104;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;13;108;255m\x1B[48;2;12;105;255m\u2580\x1B[39m\x1B[49m\x1B[38;2;13;109;255m\u2580\x1B[39m";
|
|
36873
|
+
|
|
36874
|
+
// src/output/banner.ts
|
|
36875
|
+
var HELP_BANNER_GRADIENT = ["#1677ff", "#2dd9ff", "#ff4d4f"];
|
|
36876
|
+
var ANSI_ESCAPE_PATTERN = /^\u001b\[[0-9;]*m/;
|
|
36877
|
+
function shouldUseTerminalColor() {
|
|
36878
|
+
if (process.env.FORCE_COLOR && process.env.FORCE_COLOR !== "0") {
|
|
36879
|
+
return true;
|
|
36880
|
+
}
|
|
36881
|
+
return Boolean(process.stdout.isTTY && !process.env.NO_COLOR && process.env.TERM !== "dumb");
|
|
36882
|
+
}
|
|
36883
|
+
function createHelpBanner(version2, color = shouldUseTerminalColor()) {
|
|
36884
|
+
const wordmark = renderCfonts("ANT DESIGN CLI", {
|
|
36885
|
+
align: "left",
|
|
36886
|
+
font: "tiny",
|
|
36887
|
+
letterSpacing: 1
|
|
36888
|
+
}, color);
|
|
36889
|
+
const label = `@ant-design/cli v${version2}`;
|
|
36890
|
+
const divider = "\u2500".repeat(label.length);
|
|
36891
|
+
const wordmarkLines = wordmark.split("\n").map((line) => trimLineStart(line).trimEnd()).filter(Boolean);
|
|
36892
|
+
const banner = addLogo(wordmarkLines, color);
|
|
36893
|
+
return `
|
|
36894
|
+
${banner}
|
|
36895
|
+
|
|
36896
|
+
${label}
|
|
36897
|
+
${divider}
|
|
36898
|
+
`;
|
|
36899
|
+
}
|
|
36900
|
+
function renderCfonts(text, options, color) {
|
|
36901
|
+
const rendered = cfonts.render(text, {
|
|
36902
|
+
...options,
|
|
36903
|
+
colors: ["system"],
|
|
36904
|
+
gradient: color ? HELP_BANNER_GRADIENT : false,
|
|
36905
|
+
independentGradient: true,
|
|
36906
|
+
lineHeight: 0,
|
|
36907
|
+
maxLength: 0,
|
|
36908
|
+
spaceless: true,
|
|
36909
|
+
transitionGradient: true
|
|
36910
|
+
});
|
|
36911
|
+
return rendered?.string || text;
|
|
36912
|
+
}
|
|
36913
|
+
function trimLineStart(line) {
|
|
36914
|
+
let index = 0;
|
|
36915
|
+
let pendingAnsi = "";
|
|
36916
|
+
while (index < line.length) {
|
|
36917
|
+
const ansiMatch = line.slice(index).match(ANSI_ESCAPE_PATTERN);
|
|
36918
|
+
if (ansiMatch) {
|
|
36919
|
+
pendingAnsi += ansiMatch[0];
|
|
36920
|
+
index += ansiMatch[0].length;
|
|
36921
|
+
continue;
|
|
36922
|
+
}
|
|
36923
|
+
if (/\s/.test(line[index])) {
|
|
36924
|
+
pendingAnsi = "";
|
|
36925
|
+
index += 1;
|
|
36926
|
+
continue;
|
|
36927
|
+
}
|
|
36928
|
+
break;
|
|
36929
|
+
}
|
|
36930
|
+
return `${pendingAnsi}${line.slice(index)}`;
|
|
36931
|
+
}
|
|
36932
|
+
function addLogo(wordmarkLines, color) {
|
|
36933
|
+
const logo = color ? HELP_LOGO_ANSI : HELP_LOGO_TEXT;
|
|
36934
|
+
return `${logo}
|
|
36935
|
+
|
|
36936
|
+
${wordmarkLines.join("\n")}`;
|
|
36937
|
+
}
|
|
36938
|
+
|
|
36508
36939
|
// src/index.ts
|
|
36509
|
-
var CLI_VERSION = "6.5.
|
|
36940
|
+
var CLI_VERSION = "6.5.2";
|
|
36510
36941
|
function createProgram() {
|
|
36511
36942
|
const program2 = new Command();
|
|
36512
|
-
|
|
36943
|
+
let displayedRootHelp = false;
|
|
36944
|
+
program2.name("antd").description("CLI tool for querying antd knowledge and analyzing antd usage").addHelpCommand("help [command]", "display help for command").option("--format <format>", "Output format: json, text, or markdown", "text").option("--version <version>", "Target antd version (e.g. 5.20.0)").option("--lang <lang>", "Output language: en or zh", "en").option("--detail", "Full information output", false);
|
|
36945
|
+
program2.addHelpText("before", () => createHelpBanner(CLI_VERSION));
|
|
36513
36946
|
program2.addOption(new Option("-V, --cli-version", "Output the CLI version number"));
|
|
36514
36947
|
program2.on("option:cli-version", () => {
|
|
36515
36948
|
console.log(CLI_VERSION);
|
|
@@ -36533,6 +36966,10 @@ function createProgram() {
|
|
|
36533
36966
|
registerUpgradeCommand(program2);
|
|
36534
36967
|
registerBugCommand(program2);
|
|
36535
36968
|
registerBugCliCommand(program2);
|
|
36969
|
+
program2.action(() => {
|
|
36970
|
+
displayedRootHelp = true;
|
|
36971
|
+
program2.outputHelp();
|
|
36972
|
+
});
|
|
36536
36973
|
program2.hook("preAction", () => {
|
|
36537
36974
|
const opts = program2.opts();
|
|
36538
36975
|
const validFormats = ["json", "text", "markdown"];
|
|
@@ -36545,12 +36982,15 @@ function createProgram() {
|
|
|
36545
36982
|
}
|
|
36546
36983
|
});
|
|
36547
36984
|
program2.hook("postAction", async () => {
|
|
36985
|
+
if (displayedRootHelp) {
|
|
36986
|
+
return;
|
|
36987
|
+
}
|
|
36548
36988
|
await checkForUpdate();
|
|
36549
36989
|
});
|
|
36550
36990
|
return program2;
|
|
36551
36991
|
}
|
|
36552
36992
|
if (!process.env.VITEST) {
|
|
36553
|
-
createProgram().parseAsync();
|
|
36993
|
+
await createProgram().parseAsync();
|
|
36554
36994
|
}
|
|
36555
36995
|
export {
|
|
36556
36996
|
createProgram
|