@jtl-software/create-cloud-app 0.5.2 → 0.5.3

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 +65 -26
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1002,6 +1002,34 @@ async function provisionApp(apiBaseUrl, jwt, tenantId, appId, appServicePath = "
1002
1002
  publicClientId: provisioned.credentials?.publicClient?.clientId
1003
1003
  };
1004
1004
  }
1005
+ async function applyProvisionResult(root, backend, opts, tenant, appId, provisioned, isInstalled) {
1006
+ if (provisioned.publicClientId) {
1007
+ const written = writeFrontendPublicClient(
1008
+ root,
1009
+ opts.auth,
1010
+ provisioned.publicClientId
1011
+ );
1012
+ if (written) {
1013
+ p2.log.success(
1014
+ `Wrote VITE_JTL_CLIENT_ID/VITE_JTL_ISSUER to ${pc2.cyan(path2.relative(root, written))}.`
1015
+ );
1016
+ }
1017
+ }
1018
+ writeVerifyDemoEnv(root, backend);
1019
+ if (backend) {
1020
+ await persistCredentials(
1021
+ backend,
1022
+ provisioned.clientId,
1023
+ provisioned.clientSecret,
1024
+ root,
1025
+ opts,
1026
+ { hub: opts.hub, tenantSlug: tenant.slug, appId, isInstalled }
1027
+ );
1028
+ return;
1029
+ }
1030
+ printHubLink(opts.hub, tenant.slug, appId, isInstalled);
1031
+ p2.outro(pc2.green("Done. App registered."));
1032
+ }
1005
1033
  function credentialLabels(backend) {
1006
1034
  if (backend.kind === "node") {
1007
1035
  return {
@@ -1181,6 +1209,33 @@ async function register(argv = [], runOpts = {}) {
1181
1209
  spinner4.stop("Failed to update manifest");
1182
1210
  bail(err.message);
1183
1211
  }
1212
+ if (existing.provisioningStatus === "DRAFT") {
1213
+ spinner4.start("Provisioning app");
1214
+ let provisioned;
1215
+ try {
1216
+ provisioned = await provisionApp(
1217
+ opts.api,
1218
+ apiJwt,
1219
+ tenant.id,
1220
+ existing.id,
1221
+ opts.appServicePath
1222
+ );
1223
+ spinner4.stop("Provisioned");
1224
+ } catch (err) {
1225
+ spinner4.stop("Failed to provision app");
1226
+ bail(err.message);
1227
+ }
1228
+ await applyProvisionResult(
1229
+ root,
1230
+ backend,
1231
+ opts,
1232
+ tenant,
1233
+ existing.id,
1234
+ provisioned,
1235
+ existing.isInstalled ?? false
1236
+ );
1237
+ return;
1238
+ }
1184
1239
  if (existing.publicClientId) {
1185
1240
  const written = writeFrontendPublicClient(
1186
1241
  root,
@@ -1255,31 +1310,15 @@ async function register(argv = [], runOpts = {}) {
1255
1310
  spinner4.stop("Failed to provision app");
1256
1311
  bail(err.message);
1257
1312
  }
1258
- if (publicClientId) {
1259
- const written = writeFrontendPublicClient(
1260
- root,
1261
- opts.auth,
1262
- publicClientId
1263
- );
1264
- if (written) {
1265
- p2.log.success(
1266
- `Wrote VITE_JTL_CLIENT_ID/VITE_JTL_ISSUER to ${pc2.cyan(path2.relative(root, written))}.`
1267
- );
1268
- }
1269
- }
1270
- writeVerifyDemoEnv(root, backend);
1271
- if (backend) {
1272
- await persistCredentials(backend, clientId, clientSecret, root, opts, {
1273
- hub: opts.hub,
1274
- tenantSlug: tenant.slug,
1275
- appId,
1276
- // A freshly created app can't be installed yet.
1277
- isInstalled: false
1278
- });
1279
- return;
1280
- }
1281
- printHubLink(opts.hub, tenant.slug, appId, false);
1282
- p2.outro(pc2.green("Done. App registered."));
1313
+ await applyProvisionResult(
1314
+ root,
1315
+ backend,
1316
+ opts,
1317
+ tenant,
1318
+ appId,
1319
+ { clientId, clientSecret, publicClientId },
1320
+ false
1321
+ );
1283
1322
  return;
1284
1323
  }
1285
1324
  }
@@ -1823,7 +1862,7 @@ import os2 from "os";
1823
1862
  import path6 from "path";
1824
1863
  import { PostHog } from "posthog-node";
1825
1864
  var TOKEN = "phc_SkFAxTIa4RUQxotci1Ftdw7xefZK2Ax0LEIGcl8zuD2";
1826
- var CLI_VERSION = "0.5.2";
1865
+ var CLI_VERSION = "0.5.3";
1827
1866
  var client = TOKEN ? new PostHog(TOKEN, { host: "https://e.jtl-cloud.com" }) : null;
1828
1867
  function telemetryDisabledByEnv() {
1829
1868
  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.5.2",
3
+ "version": "0.5.3",
4
4
  "type": "module",
5
5
  "description": "CLI tool for scaffolding JTL Platform cloud apps",
6
6
  "bin": {
@@ -21,10 +21,10 @@
21
21
  "@jtl-software/cloud-app-template-backend-dotnet": "0.0.13",
22
22
  "@jtl-software/cloud-app-template-backend-node": "0.0.16",
23
23
  "@jtl-software/cloud-app-template-backend-php": "0.1.3",
24
- "@jtl-software/cloud-app-template-frontend-react": "0.1.2",
24
+ "@jtl-software/cloud-app-template-frontend-react": "0.1.3",
25
25
  "@jtl-software/cloud-app-template-shared": "0.1.2",
26
26
  "picocolors": "^1.1.1",
27
- "posthog-node": "^5.48.1"
27
+ "posthog-node": "^5.49.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^26.2.0",