@jtl-software/create-cloud-app 0.9.0 → 0.9.1

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 +29 -3
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -383,6 +383,16 @@ async function acquireAccessToken(opts) {
383
383
  throw err;
384
384
  }
385
385
  }
386
+ var ApiError = class extends Error {
387
+ constructor(message, status, code) {
388
+ super(message);
389
+ this.status = status;
390
+ this.code = code;
391
+ this.name = "ApiError";
392
+ }
393
+ status;
394
+ code;
395
+ };
386
396
  async function apiCall(url, init) {
387
397
  const res = await fetch(url, init);
388
398
  const text3 = await res.text();
@@ -394,8 +404,11 @@ async function apiCall(url, init) {
394
404
  }
395
405
  if (!res.ok) {
396
406
  const detail = typeof body === "string" ? body : JSON.stringify(body);
397
- throw new Error(
398
- `${init.method ?? "GET"} ${url} returned ${res.status}: ${detail}`
407
+ const code = typeof body === "object" && body !== null && "code" in body ? String(body.code) : void 0;
408
+ throw new ApiError(
409
+ `${init.method ?? "GET"} ${url} returned ${res.status}: ${detail}`,
410
+ res.status,
411
+ code
399
412
  );
400
413
  }
401
414
  return body;
@@ -591,6 +604,9 @@ function buildHubAppOverviewUrl(hubHost, tenantSlug) {
591
604
  function buildPartnerPortalPublishUrl(partnerHost, tenantSlug, publisherId) {
592
605
  return `${partnerHost}/${tenantSlug}/${publisherId}/apps/publish`;
593
606
  }
607
+ function buildPartnerPortalOnboardingUrl(partnerHost, tenantSlug) {
608
+ return `${partnerHost}/${tenantSlug}/onboarding`;
609
+ }
594
610
  function terminalLink(url, text3 = url) {
595
611
  const OSC = "\x1B]";
596
612
  const ST = "\x1B\\";
@@ -1219,6 +1235,9 @@ async function updateAppManifest(apiBaseUrl, jwt, tenantId, appId, manifest, app
1219
1235
  }
1220
1236
  );
1221
1237
  }
1238
+ function isMissingPublisherError(err) {
1239
+ return err instanceof ApiError && err.status === 404 && (err.code === "PublisherNotFound" || err.code === "EntityNotFound");
1240
+ }
1222
1241
  async function createDraftApp(apiBaseUrl, jwt, tenantId, manifest, appServicePath = "app-service") {
1223
1242
  const created = await apiCall(
1224
1243
  `${apiBaseUrl}/${appServicePath}/store/apps`,
@@ -1618,6 +1637,13 @@ async function register(argv = [], runOpts = {}) {
1618
1637
  spinner4.stop(`Created app ${pc2.cyan(appId)}`);
1619
1638
  } catch (err) {
1620
1639
  spinner4.stop("Failed to create app");
1640
+ if (isMissingPublisherError(err)) {
1641
+ const url = buildPartnerPortalOnboardingUrl(opts.partner, tenant.slug);
1642
+ p2.note(pc2.cyan(terminalLink(url)), "Register as publisher");
1643
+ bail(
1644
+ `Organization "${tenant.name}" is not registered as a publisher yet. Complete the Partner Portal onboarding for it, then run this command again.`
1645
+ );
1646
+ }
1621
1647
  bail(err.message);
1622
1648
  }
1623
1649
  spinner4.start("Provisioning app");
@@ -2333,7 +2359,7 @@ import os2 from "os";
2333
2359
  import path6 from "path";
2334
2360
  import { PostHog } from "posthog-node";
2335
2361
  var TOKEN = "phc_SkFAxTIa4RUQxotci1Ftdw7xefZK2Ax0LEIGcl8zuD2";
2336
- var CLI_VERSION = "0.9.0";
2362
+ var CLI_VERSION = "0.9.1";
2337
2363
  var client = TOKEN ? new PostHog(TOKEN, { host: "https://e.jtl-cloud.com" }) : null;
2338
2364
  function telemetryDisabledByEnv() {
2339
2365
  const dnt = process.env.DO_NOT_TRACK;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtl-software/create-cloud-app",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "type": "module",
5
5
  "description": "CLI tool for scaffolding JTL Platform cloud apps",
6
6
  "bin": {
@@ -17,20 +17,20 @@
17
17
  "dev": "tsx src/index.ts"
18
18
  },
19
19
  "dependencies": {
20
- "@clack/prompts": "^1.7.0",
20
+ "@clack/prompts": "^1.8.1",
21
21
  "@jtl-software/cloud-app-template-backend-dotnet": "0.2.0",
22
- "@jtl-software/cloud-app-template-backend-node": "0.3.1",
22
+ "@jtl-software/cloud-app-template-backend-node": "0.3.2",
23
23
  "@jtl-software/cloud-app-template-backend-php": "0.3.0",
24
- "@jtl-software/cloud-app-template-frontend-react": "0.3.2",
24
+ "@jtl-software/cloud-app-template-frontend-react": "0.3.3",
25
25
  "@jtl-software/cloud-app-template-shared": "0.2.0",
26
26
  "picocolors": "^1.1.1",
27
- "posthog-node": "^5.51.6"
27
+ "posthog-node": "^5.55.3"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/node": "^26.4.0",
30
+ "@types/node": "^26.6.5",
31
31
  "msw": "^2.15.0",
32
32
  "tsup": "^8.5.1",
33
- "tsx": "^4.23.13",
33
+ "tsx": "^4.23.15",
34
34
  "typescript": "^6.0.3"
35
35
  },
36
36
  "publishConfig": {