@tscircuit/cli 0.1.1184 → 0.1.1186
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 +2 -0
- package/dist/cli/main.js +80 -1
- package/dist/lib/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,8 @@ Commands:
|
|
|
54
54
|
install [packageSpec] Install project dependencies, or install a
|
|
55
55
|
specific package (e.g., tsci install
|
|
56
56
|
https://github.com/espressif/kicad-libraries)
|
|
57
|
+
update [packageSpec] Update tscircuit component packages to their
|
|
58
|
+
latest version
|
|
57
59
|
upgrade Upgrade CLI to the latest version
|
|
58
60
|
doctor Run diagnostic checks for your tscircuit setup
|
|
59
61
|
check Partially build and validate circuit artifacts
|
package/dist/cli/main.js
CHANGED
|
@@ -98409,7 +98409,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
98409
98409
|
// lib/getVersion.ts
|
|
98410
98410
|
import { createRequire as createRequire2 } from "node:module";
|
|
98411
98411
|
// package.json
|
|
98412
|
-
var version = "0.1.
|
|
98412
|
+
var version = "0.1.1185";
|
|
98413
98413
|
var package_default = {
|
|
98414
98414
|
name: "@tscircuit/cli",
|
|
98415
98415
|
version,
|
|
@@ -98770,6 +98770,26 @@ function getPackageManager() {
|
|
|
98770
98770
|
process.stdout.write(output);
|
|
98771
98771
|
}
|
|
98772
98772
|
},
|
|
98773
|
+
update: ({ name, cwd }) => {
|
|
98774
|
+
let updateCommand;
|
|
98775
|
+
if (pm === "yarn") {
|
|
98776
|
+
updateCommand = `yarn upgrade ${name}`;
|
|
98777
|
+
} else if (pm === "pnpm") {
|
|
98778
|
+
updateCommand = `pnpm update ${name}`;
|
|
98779
|
+
} else if (pm === "bun") {
|
|
98780
|
+
updateCommand = `bun update ${name}`;
|
|
98781
|
+
} else {
|
|
98782
|
+
updateCommand = `npm update ${name}`;
|
|
98783
|
+
}
|
|
98784
|
+
console.log(kleur_default.gray(`> ${updateCommand}`));
|
|
98785
|
+
const output = execSync(updateCommand, {
|
|
98786
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
98787
|
+
cwd
|
|
98788
|
+
});
|
|
98789
|
+
if (output) {
|
|
98790
|
+
process.stdout.write(output);
|
|
98791
|
+
}
|
|
98792
|
+
},
|
|
98773
98793
|
init: ({ cwd }) => {
|
|
98774
98794
|
const initCommand = getInitCommand();
|
|
98775
98795
|
execSync(initCommand, { stdio: "inherit", cwd });
|
|
@@ -270044,6 +270064,64 @@ function registerUpgradeCommand(program3) {
|
|
|
270044
270064
|
});
|
|
270045
270065
|
}
|
|
270046
270066
|
|
|
270067
|
+
// lib/shared/update-package.ts
|
|
270068
|
+
import * as path68 from "node:path";
|
|
270069
|
+
import * as fs65 from "node:fs";
|
|
270070
|
+
async function updatePackage(packageSpec, projectDir = process.cwd()) {
|
|
270071
|
+
const packageManager = getPackageManager();
|
|
270072
|
+
if (!packageSpec) {
|
|
270073
|
+
const pkgJsonPath = path68.join(projectDir, "package.json");
|
|
270074
|
+
if (!fs65.existsSync(pkgJsonPath)) {
|
|
270075
|
+
console.log(kleur_default.yellow("No package.json found. Cannot update all packages."));
|
|
270076
|
+
return;
|
|
270077
|
+
}
|
|
270078
|
+
const pkgJson = JSON.parse(fs65.readFileSync(pkgJsonPath, "utf-8"));
|
|
270079
|
+
const allDeps = {
|
|
270080
|
+
...pkgJson.dependencies || {},
|
|
270081
|
+
...pkgJson.devDependencies || {}
|
|
270082
|
+
};
|
|
270083
|
+
const tsciPackages = Object.keys(allDeps).filter((dep) => dep.startsWith("@tsci/") || dep.startsWith("@tscircuit/"));
|
|
270084
|
+
if (tsciPackages.length === 0) {
|
|
270085
|
+
console.log(kleur_default.yellow("No tscircuit packages found in package.json to update."));
|
|
270086
|
+
return;
|
|
270087
|
+
}
|
|
270088
|
+
const targetList = tsciPackages.join(" ");
|
|
270089
|
+
console.log(kleur_default.cyan(`Updating ${tsciPackages.length} packages: ${kleur_default.bold(targetList)}...`));
|
|
270090
|
+
try {
|
|
270091
|
+
packageManager.update({ name: targetList, cwd: projectDir });
|
|
270092
|
+
console.log(kleur_default.green(`✓ Updated all tscircuit packages successfully`));
|
|
270093
|
+
} catch (error) {
|
|
270094
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
270095
|
+
console.error(kleur_default.red(`✗ Failed to update packages:`), errorMessage);
|
|
270096
|
+
throw new Error(`Failed to update packages: ${errorMessage}`);
|
|
270097
|
+
}
|
|
270098
|
+
return;
|
|
270099
|
+
}
|
|
270100
|
+
const normalizedName = normalizeTscircuitPackageName(packageSpec);
|
|
270101
|
+
const displayName = normalizedName || packageSpec;
|
|
270102
|
+
const updateTarget = normalizedName || packageSpec;
|
|
270103
|
+
console.log(kleur_default.cyan(`Updating ${kleur_default.bold(displayName)}...`));
|
|
270104
|
+
try {
|
|
270105
|
+
packageManager.update({ name: updateTarget, cwd: projectDir });
|
|
270106
|
+
console.log(kleur_default.green(`✓ Updated ${kleur_default.bold(displayName)} successfully`));
|
|
270107
|
+
} catch (error) {
|
|
270108
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
270109
|
+
console.error(kleur_default.red(`✗ Failed to update ${displayName}:`), errorMessage);
|
|
270110
|
+
throw new Error(`Failed to update ${displayName}: ${errorMessage}`);
|
|
270111
|
+
}
|
|
270112
|
+
}
|
|
270113
|
+
|
|
270114
|
+
// cli/update/register.ts
|
|
270115
|
+
var registerUpdate = (program3) => {
|
|
270116
|
+
program3.command("update").description("Update tscircuit component packages to their latest version").argument("[packageSpec]", "Package to update, leave blank to update all @tsci dependencies.").action(async (packageSpec) => {
|
|
270117
|
+
try {
|
|
270118
|
+
await updatePackage(packageSpec);
|
|
270119
|
+
} catch (error) {
|
|
270120
|
+
process.exit(1);
|
|
270121
|
+
}
|
|
270122
|
+
});
|
|
270123
|
+
};
|
|
270124
|
+
|
|
270047
270125
|
// cli/main.ts
|
|
270048
270126
|
var program2 = new Command;
|
|
270049
270127
|
program2.name("tsci").description("CLI for developing tscircuit packages");
|
|
@@ -270070,6 +270148,7 @@ registerRemove(program2);
|
|
|
270070
270148
|
registerSnapshot(program2);
|
|
270071
270149
|
registerSetup(program2);
|
|
270072
270150
|
registerInstall(program2);
|
|
270151
|
+
registerUpdate(program2);
|
|
270073
270152
|
registerUpgradeCommand(program2);
|
|
270074
270153
|
registerDoctor(program2);
|
|
270075
270154
|
registerCheck(program2);
|
package/dist/lib/index.js
CHANGED
|
@@ -60678,7 +60678,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
60678
60678
|
}));
|
|
60679
60679
|
};
|
|
60680
60680
|
// package.json
|
|
60681
|
-
var version = "0.1.
|
|
60681
|
+
var version = "0.1.1185";
|
|
60682
60682
|
var package_default = {
|
|
60683
60683
|
name: "@tscircuit/cli",
|
|
60684
60684
|
version,
|