@construct-space/cli 1.6.4 → 1.6.5

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10119,15 +10119,21 @@ async function packSource(root) {
10119
10119
  }
10120
10120
 
10121
10121
  // src/commands/publish.ts
10122
- async function uploadSource(portalURL, token, tarballPath, m) {
10122
+ async function uploadSource(portalURL, identityToken, publisherKey, tarballPath, m) {
10123
10123
  const formData = new FormData;
10124
10124
  formData.append("manifest", JSON.stringify(m));
10125
10125
  const fileData = readFileSync8(tarballPath);
10126
10126
  const blob = new Blob([fileData]);
10127
10127
  formData.append("source", blob, basename6(tarballPath));
10128
+ const headers = {
10129
+ Authorization: `Bearer ${identityToken}`
10130
+ };
10131
+ if (publisherKey) {
10132
+ headers["X-API-Key"] = publisherKey;
10133
+ }
10128
10134
  const resp = await fetch(`${portalURL}/publish`, {
10129
10135
  method: "POST",
10130
- headers: { Authorization: `Bearer ${token}` },
10136
+ headers,
10131
10137
  body: formData
10132
10138
  });
10133
10139
  const result = await resp.json();
@@ -10241,7 +10247,11 @@ async function publish(options) {
10241
10247
  m = read(root);
10242
10248
  console.log(source_default.green(`Version bumped to ${m.version}`));
10243
10249
  }
10244
- const publishToken = creds.publisherKey ?? creds.token;
10250
+ if (creds.token.startsWith("csk_live_")) {
10251
+ console.error(source_default.red("Stored credential is a publisher key, not an identity token."));
10252
+ console.error(source_default.dim(" Run 'construct login' or sign in via the desktop app to refresh."));
10253
+ process.exit(1);
10254
+ }
10245
10255
  if (!creds.publisherKey) {
10246
10256
  console.log(source_default.yellow("No publisher key in active profile."));
10247
10257
  console.log(source_default.dim(" Spaces will be attributed to your personal user identity."));
@@ -10283,7 +10293,7 @@ async function publish(options) {
10283
10293
  }
10284
10294
  const uploadSpinner = ora("Uploading & building...").start();
10285
10295
  try {
10286
- const result = await uploadSource(creds.portal, publishToken, tarballPath, m);
10296
+ const result = await uploadSource(creds.portal, creds.token, creds.publisherKey, tarballPath, m);
10287
10297
  unlinkSync2(tarballPath);
10288
10298
  gitSafe(root, "tag", `v${m.version}`);
10289
10299
  gitSafe(root, "push", "origin", `v${m.version}`);
@@ -11232,7 +11242,7 @@ function graphFork(newSpaceID) {
11232
11242
  // package.json
11233
11243
  var package_default = {
11234
11244
  name: "@construct-space/cli",
11235
- version: "1.6.4",
11245
+ version: "1.6.5",
11236
11246
  description: "Construct CLI \u2014 scaffold, build, develop, and publish spaces",
11237
11247
  type: "module",
11238
11248
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@construct-space/cli",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Construct CLI — scaffold, build, develop, and publish spaces",
5
5
  "type": "module",
6
6
  "bin": {