@tscircuit/cli 0.1.221 → 0.1.222
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/main.js +68 -27
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -58032,7 +58032,39 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
58032
58032
|
return figureOutCommandPath(program3, commandPath.concat([nextCommandName]));
|
|
58033
58033
|
});
|
|
58034
58034
|
var import_prompts22 = __toESM3(require_prompts3());
|
|
58035
|
-
var
|
|
58035
|
+
var camelToKebab = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
|
|
58036
|
+
var findOptionByKey = (command, key) => {
|
|
58037
|
+
var _a;
|
|
58038
|
+
return (_a = command == null ? undefined : command.options) == null ? undefined : _a.find((o) => {
|
|
58039
|
+
var _a2, _b;
|
|
58040
|
+
const longFlag = (_a2 = o.long) == null ? undefined : _a2.replace(/^--/, "");
|
|
58041
|
+
const shortFlag = (_b = o.short) == null ? undefined : _b.replace(/^-/, "");
|
|
58042
|
+
if (longFlag === key || shortFlag === key) {
|
|
58043
|
+
return true;
|
|
58044
|
+
}
|
|
58045
|
+
if (longFlag === camelToKebab(key)) {
|
|
58046
|
+
return true;
|
|
58047
|
+
}
|
|
58048
|
+
return false;
|
|
58049
|
+
});
|
|
58050
|
+
};
|
|
58051
|
+
var getOptionFlagName = (command, key) => {
|
|
58052
|
+
var _a, _b;
|
|
58053
|
+
const option = findOptionByKey(command, key);
|
|
58054
|
+
if (option) {
|
|
58055
|
+
return ((_a = option.long) == null ? undefined : _a.replace(/^--/, "")) || ((_b = option.short) == null ? undefined : _b.replace(/^-/, "")) || "";
|
|
58056
|
+
}
|
|
58057
|
+
return camelToKebab(key);
|
|
58058
|
+
};
|
|
58059
|
+
var stringifyOptions = (options, command) => Object.entries(options).filter((opt) => opt[0] !== "_").map(([key, value]) => {
|
|
58060
|
+
var _a;
|
|
58061
|
+
const option = findOptionByKey(command, key);
|
|
58062
|
+
const flagName = getOptionFlagName(command, key);
|
|
58063
|
+
if ((_a = option == null ? undefined : option.isBoolean) == null ? undefined : _a.call(option)) {
|
|
58064
|
+
return value ? `--${flagName}` : "";
|
|
58065
|
+
}
|
|
58066
|
+
return `--${flagName} ${value}`;
|
|
58067
|
+
}).filter(Boolean).join(" ");
|
|
58036
58068
|
var getOptionKey = (o) => {
|
|
58037
58069
|
var _a;
|
|
58038
58070
|
return ((_a = o.long) != null ? _a : o.short).replace(/^--/, "");
|
|
@@ -58057,8 +58089,8 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
58057
58089
|
if (command.options.length === 0) {
|
|
58058
58090
|
return options;
|
|
58059
58091
|
}
|
|
58060
|
-
console.log(`> ${[program3.name(), ...commandPath].filter(Boolean).join(" ")} ${stringifyOptions(options)}`);
|
|
58061
|
-
const hasRequiredOptions = command.options.filter((o) => o.mandatory).every((o) =>
|
|
58092
|
+
console.log(`> ${[program3.name(), ...commandPath].filter(Boolean).join(" ")} ${stringifyOptions(options, command)}`);
|
|
58093
|
+
const hasRequiredOptions = command.options.filter((o) => o.mandatory).every((o) => (getOptionKey(o) in options));
|
|
58062
58094
|
const { optionToEdit } = yield (0, import_prompts22.default)({
|
|
58063
58095
|
type: "autocomplete",
|
|
58064
58096
|
name: "optionToEdit",
|
|
@@ -58077,7 +58109,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
58077
58109
|
return {
|
|
58078
58110
|
title: `${o.long}${o.mandatory ? "*" : ""}`,
|
|
58079
58111
|
value: optionName,
|
|
58080
|
-
description:
|
|
58112
|
+
description: optionName in options ? `[${options[optionName]}]` : o.description
|
|
58081
58113
|
};
|
|
58082
58114
|
})
|
|
58083
58115
|
].filter((elm) => Boolean(elm))
|
|
@@ -58116,7 +58148,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
58116
58148
|
var stringifyCommandWithOptions = (program3, commandPath, options) => {
|
|
58117
58149
|
var _a, _b;
|
|
58118
58150
|
const command = getCommandFromPath(program3, commandPath);
|
|
58119
|
-
return `${[program3.name(), ...commandPath].filter(Boolean).join(" ")}${((_a = options == null ? undefined : options._) == null ? undefined : _a.length) > 0 ? ` ${(_b = options == null ? undefined : options._) == null ? undefined : _b.join(" ")}` : ""} ${stringifyOptions(options)}`;
|
|
58151
|
+
return `${[program3.name(), ...commandPath].filter(Boolean).join(" ")}${((_a = options == null ? undefined : options._) == null ? undefined : _a.length) > 0 ? ` ${(_b = options == null ? undefined : options._) == null ? undefined : _b.join(" ")}` : ""} ${stringifyOptions(options, command)}`;
|
|
58120
58152
|
};
|
|
58121
58153
|
var doesProgramHaveAllRequiredArgs = (program3, _, passedArgs) => {
|
|
58122
58154
|
const command = getCommandFromPath(program3, _);
|
|
@@ -58181,10 +58213,19 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
58181
58213
|
const fullCommandString = stringifyCommandWithOptions(program3, commandPath, options);
|
|
58182
58214
|
console.log(`> ${fullCommandString}`);
|
|
58183
58215
|
const strictCommandPath = getStrictCommandPath(program3, commandPath);
|
|
58216
|
+
const optionArgs = Object.entries(options).filter((opt) => opt[0] !== "_").flatMap(([optKey, optVal]) => {
|
|
58217
|
+
var _a2;
|
|
58218
|
+
const option = findOptionByKey(command, optKey);
|
|
58219
|
+
const flagName = getOptionFlagName(command, optKey);
|
|
58220
|
+
if ((_a2 = option == null ? undefined : option.isBoolean) == null ? undefined : _a2.call(option)) {
|
|
58221
|
+
return optVal ? [`--${flagName}`] : [];
|
|
58222
|
+
}
|
|
58223
|
+
return [`--${flagName}`, optVal];
|
|
58224
|
+
});
|
|
58184
58225
|
yield program3.parseAsync([
|
|
58185
58226
|
...process.argv.slice(0, 2),
|
|
58186
58227
|
...strictCommandPath.concat((_b = options._) != null ? _b : []),
|
|
58187
|
-
...
|
|
58228
|
+
...optionArgs
|
|
58188
58229
|
]);
|
|
58189
58230
|
});
|
|
58190
58231
|
});
|
|
@@ -63215,7 +63256,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
63215
63256
|
import { execSync as execSync2 } from "node:child_process";
|
|
63216
63257
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
63217
63258
|
// package.json
|
|
63218
|
-
var version = "0.1.
|
|
63259
|
+
var version = "0.1.221";
|
|
63219
63260
|
var package_default = {
|
|
63220
63261
|
name: "@tscircuit/cli",
|
|
63221
63262
|
version,
|
|
@@ -63262,7 +63303,7 @@ var package_default = {
|
|
|
63262
63303
|
ky: "^1.7.4",
|
|
63263
63304
|
"looks-same": "^9.0.1",
|
|
63264
63305
|
"make-vfs": "^1.0.15",
|
|
63265
|
-
"perfect-cli": "^1.0.
|
|
63306
|
+
"perfect-cli": "^1.0.21",
|
|
63266
63307
|
prompts: "^2.4.2",
|
|
63267
63308
|
redaxios: "^0.5.1",
|
|
63268
63309
|
semver: "^7.6.3",
|
|
@@ -68242,25 +68283,6 @@ var registerClone = (program3) => {
|
|
|
68242
68283
|
throw new Error("No valid match found");
|
|
68243
68284
|
const [, author, packageName] = match;
|
|
68244
68285
|
console.log(`Cloning ${author}/${packageName}...`);
|
|
68245
|
-
const ky2 = getRegistryApiKy();
|
|
68246
|
-
let packageFileList = {
|
|
68247
|
-
package_files: []
|
|
68248
|
-
};
|
|
68249
|
-
try {
|
|
68250
|
-
packageFileList = await ky2.post("package_files/list", {
|
|
68251
|
-
json: {
|
|
68252
|
-
package_name: `${author}/${packageName}`,
|
|
68253
|
-
use_latest_version: true
|
|
68254
|
-
}
|
|
68255
|
-
}).json();
|
|
68256
|
-
} catch (error) {
|
|
68257
|
-
if (typeof error === "object" && error !== null && "response" in error && typeof error.response === "object" && error.response?.status === 404) {
|
|
68258
|
-
console.error(`Package "${author}/${packageName}" not found. Please check the name and try again.`);
|
|
68259
|
-
process.exit(1);
|
|
68260
|
-
}
|
|
68261
|
-
console.error("Failed to fetch package files:", error instanceof Error ? error.message : error);
|
|
68262
|
-
process.exit(1);
|
|
68263
|
-
}
|
|
68264
68286
|
const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
|
|
68265
68287
|
const dirPath = userSettingToIncludeAuthor ? path20.resolve(`${author}.${packageName}`) : path20.resolve(packageName);
|
|
68266
68288
|
if (fs20.existsSync(dirPath)) {
|
|
@@ -68289,6 +68311,25 @@ var registerClone = (program3) => {
|
|
|
68289
68311
|
console.log(`Merging files into existing directory: ${dirPath}`);
|
|
68290
68312
|
}
|
|
68291
68313
|
}
|
|
68314
|
+
const ky2 = getRegistryApiKy();
|
|
68315
|
+
let packageFileList = {
|
|
68316
|
+
package_files: []
|
|
68317
|
+
};
|
|
68318
|
+
try {
|
|
68319
|
+
packageFileList = await ky2.post("package_files/list", {
|
|
68320
|
+
json: {
|
|
68321
|
+
package_name: `${author}/${packageName}`,
|
|
68322
|
+
use_latest_version: true
|
|
68323
|
+
}
|
|
68324
|
+
}).json();
|
|
68325
|
+
} catch (error) {
|
|
68326
|
+
if (typeof error === "object" && error !== null && "response" in error && typeof error.response === "object" && error.response?.status === 404) {
|
|
68327
|
+
console.error(`Package "${author}/${packageName}" not found. Please check the name and try again.`);
|
|
68328
|
+
process.exit(1);
|
|
68329
|
+
}
|
|
68330
|
+
console.error("Failed to fetch package files:", error instanceof Error ? error.message : error);
|
|
68331
|
+
process.exit(1);
|
|
68332
|
+
}
|
|
68292
68333
|
fs20.mkdirSync(dirPath, { recursive: true });
|
|
68293
68334
|
for (const fileInfo of packageFileList.package_files) {
|
|
68294
68335
|
const filePath = fileInfo.file_path.replace(/^\/|dist\//g, "");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.222",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@babel/standalone": "^7.26.9",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"ky": "^1.7.4",
|
|
45
45
|
"looks-same": "^9.0.1",
|
|
46
46
|
"make-vfs": "^1.0.15",
|
|
47
|
-
"perfect-cli": "^1.0.
|
|
47
|
+
"perfect-cli": "^1.0.21",
|
|
48
48
|
"prompts": "^2.4.2",
|
|
49
49
|
"redaxios": "^0.5.1",
|
|
50
50
|
"semver": "^7.6.3",
|