@tscircuit/cli 0.1.699 → 0.1.700
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 +20 -11
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -73219,17 +73219,15 @@ var getSessionToken = () => {
|
|
|
73219
73219
|
var setSessionToken = (token) => {
|
|
73220
73220
|
cliConfig.set("sessionToken", token);
|
|
73221
73221
|
const decoded = jwtDecode(token);
|
|
73222
|
-
|
|
73222
|
+
if (decoded.tscircuit_handle)
|
|
73223
|
+
cliConfig.set("tscircuitHandle", decoded.tscircuit_handle);
|
|
73223
73224
|
if (decoded.account_id)
|
|
73224
73225
|
cliConfig.set("accountId", decoded.account_id);
|
|
73225
73226
|
if (decoded.session_id)
|
|
73226
73227
|
cliConfig.set("sessionId", decoded.session_id);
|
|
73227
73228
|
};
|
|
73228
73229
|
var clearSession = () => {
|
|
73229
|
-
cliConfig.
|
|
73230
|
-
cliConfig.delete("githubUsername");
|
|
73231
|
-
cliConfig.delete("accountId");
|
|
73232
|
-
cliConfig.delete("sessionId");
|
|
73230
|
+
cliConfig.clear();
|
|
73233
73231
|
};
|
|
73234
73232
|
var getRegistryApiUrl = () => {
|
|
73235
73233
|
return cliConfig.get("registryApiUrl") ?? "https://registry-api.tscircuit.com";
|
|
@@ -74113,7 +74111,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74113
74111
|
import { execSync as execSync2 } from "node:child_process";
|
|
74114
74112
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74115
74113
|
// package.json
|
|
74116
|
-
var version = "0.1.
|
|
74114
|
+
var version = "0.1.699";
|
|
74117
74115
|
var package_default = {
|
|
74118
74116
|
name: "@tscircuit/cli",
|
|
74119
74117
|
version,
|
|
@@ -74419,8 +74417,13 @@ var registerInit = (program3) => {
|
|
|
74419
74417
|
message: "Package name",
|
|
74420
74418
|
initial: defaultPackageName
|
|
74421
74419
|
});
|
|
74422
|
-
|
|
74423
|
-
|
|
74420
|
+
let authorName = cliConfig.get("tscircuitHandle");
|
|
74421
|
+
if (!authorName) {
|
|
74422
|
+
const account = await fetchAccount();
|
|
74423
|
+
if (account?.tscircuit_handle) {
|
|
74424
|
+
authorName = account.tscircuit_handle;
|
|
74425
|
+
}
|
|
74426
|
+
}
|
|
74424
74427
|
fs7.mkdirSync(projectDir, { recursive: true });
|
|
74425
74428
|
writeFileIfNotExists(path10.join(projectDir, "index.tsx"), `
|
|
74426
74429
|
export default () => (
|
|
@@ -78498,7 +78501,11 @@ var pushSnippet = async ({
|
|
|
78498
78501
|
return onExit(1);
|
|
78499
78502
|
}
|
|
78500
78503
|
const ky2 = getRegistryApiKy({ sessionToken });
|
|
78501
|
-
const currentUsername = cliConfig.get("
|
|
78504
|
+
const currentUsername = cliConfig.get("tscircuitHandle");
|
|
78505
|
+
if (!currentUsername) {
|
|
78506
|
+
onError("You need to set your tscircuit handle to publish packages");
|
|
78507
|
+
return onExit(1);
|
|
78508
|
+
}
|
|
78502
78509
|
let unscopedPackageName = getUnscopedPackageName(packageJson.name ?? "");
|
|
78503
78510
|
const packageJsonAuthor = getPackageAuthor(packageJson.name ?? "");
|
|
78504
78511
|
if (unscopedPackageName) {
|
|
@@ -78537,7 +78544,7 @@ var pushSnippet = async ({
|
|
|
78537
78544
|
const hasOrgAccess = await checkOrgAccess(ky2, packageJsonAuthor);
|
|
78538
78545
|
if (hasOrgAccess) {
|
|
78539
78546
|
accountName = packageJsonAuthor;
|
|
78540
|
-
console.log(kleur_default.gray(`Publishing to org "${packageJsonAuthor}" (user: ${
|
|
78547
|
+
console.log(kleur_default.gray(`Publishing to org "${packageJsonAuthor}" (user: ${accountName})`));
|
|
78541
78548
|
} else {
|
|
78542
78549
|
onError(`You don't have access to the org "${packageJsonAuthor}". Either:
|
|
78543
78550
|
` + ` 1. Get added as a member of the "${packageJsonAuthor}" org, or
|
|
@@ -78698,7 +78705,9 @@ var pushSnippet = async ({
|
|
|
78698
78705
|
}
|
|
78699
78706
|
});
|
|
78700
78707
|
onSuccess([
|
|
78701
|
-
|
|
78708
|
+
`
|
|
78709
|
+
`,
|
|
78710
|
+
kleur_default.bold().green(`"${tsciPackageName}@${releaseVersion}" published!`),
|
|
78702
78711
|
kleur_default.underline(kleur_default.blue(`https://tscircuit.com/${scopedPackageName}`))
|
|
78703
78712
|
].join(`
|
|
78704
78713
|
`));
|