@jtl-software/create-cloud-app 0.5.1 → 0.5.2
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/index.js +31 -5
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -704,6 +704,23 @@ function writeFrontendPublicClient(root, authIssuer, publicClientId) {
|
|
|
704
704
|
});
|
|
705
705
|
return envFile;
|
|
706
706
|
}
|
|
707
|
+
function readBackendPort(backend) {
|
|
708
|
+
if (backend.kind === "node") {
|
|
709
|
+
for (const file of [backend.envFile, `${backend.envFile}.example`]) {
|
|
710
|
+
const value = readEnvFile(file).PORT;
|
|
711
|
+
if (value && /^\d+$/.test(value)) return Number(value);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return 3005;
|
|
715
|
+
}
|
|
716
|
+
function writeVerifyDemoEnv(root, backend) {
|
|
717
|
+
if (!backend) return;
|
|
718
|
+
const frontendDir = detectFrontend(root);
|
|
719
|
+
if (!frontendDir) return;
|
|
720
|
+
upsertEnv(path2.join(frontendDir, ".env"), {
|
|
721
|
+
VITE_BACKEND_URL: `http://localhost:${readBackendPort(backend)}`
|
|
722
|
+
});
|
|
723
|
+
}
|
|
707
724
|
function readExistingCredentials(backend) {
|
|
708
725
|
if (backend.kind === "node") {
|
|
709
726
|
const values = readEnvFile(backend.envFile);
|
|
@@ -720,11 +737,12 @@ function readExistingCredentials(backend) {
|
|
|
720
737
|
return {};
|
|
721
738
|
}
|
|
722
739
|
}
|
|
723
|
-
function writeBackendCredentials(backend, clientId, clientSecret) {
|
|
740
|
+
function writeBackendCredentials(backend, clientId, clientSecret, issuer) {
|
|
724
741
|
if (backend.kind === "node") {
|
|
725
742
|
upsertEnv(backend.envFile, {
|
|
726
743
|
CLIENT_ID: clientId,
|
|
727
|
-
CLIENT_SECRET: clientSecret
|
|
744
|
+
CLIENT_SECRET: clientSecret,
|
|
745
|
+
...issuer ? { JTL_ISSUER: issuer } : {}
|
|
728
746
|
});
|
|
729
747
|
return backend.envFile;
|
|
730
748
|
}
|
|
@@ -739,7 +757,8 @@ function writeBackendCredentials(backend, clientId, clientSecret) {
|
|
|
739
757
|
settings.JtlPlatform = {
|
|
740
758
|
...settings.JtlPlatform ?? {},
|
|
741
759
|
ClientId: clientId,
|
|
742
|
-
ClientSecret: clientSecret
|
|
760
|
+
ClientSecret: clientSecret,
|
|
761
|
+
...issuer ? { Issuer: issuer } : {}
|
|
743
762
|
};
|
|
744
763
|
fs2.writeFileSync(
|
|
745
764
|
backend.settingsFile,
|
|
@@ -1022,7 +1041,12 @@ async function persistCredentials(backend, clientId, clientSecret, root, opts, c
|
|
|
1022
1041
|
p2.outro(pc2.green("Done. Credentials printed above; file left untouched."));
|
|
1023
1042
|
return;
|
|
1024
1043
|
}
|
|
1025
|
-
const written = writeBackendCredentials(
|
|
1044
|
+
const written = writeBackendCredentials(
|
|
1045
|
+
backend,
|
|
1046
|
+
clientId,
|
|
1047
|
+
clientSecret,
|
|
1048
|
+
opts.auth
|
|
1049
|
+
);
|
|
1026
1050
|
printHubLink(
|
|
1027
1051
|
context.hub,
|
|
1028
1052
|
context.tenantSlug,
|
|
@@ -1169,6 +1193,7 @@ async function register(argv = [], runOpts = {}) {
|
|
|
1169
1193
|
);
|
|
1170
1194
|
}
|
|
1171
1195
|
}
|
|
1196
|
+
writeVerifyDemoEnv(root, backend);
|
|
1172
1197
|
printHubLink(
|
|
1173
1198
|
opts.hub,
|
|
1174
1199
|
tenant.slug,
|
|
@@ -1242,6 +1267,7 @@ async function register(argv = [], runOpts = {}) {
|
|
|
1242
1267
|
);
|
|
1243
1268
|
}
|
|
1244
1269
|
}
|
|
1270
|
+
writeVerifyDemoEnv(root, backend);
|
|
1245
1271
|
if (backend) {
|
|
1246
1272
|
await persistCredentials(backend, clientId, clientSecret, root, opts, {
|
|
1247
1273
|
hub: opts.hub,
|
|
@@ -1797,7 +1823,7 @@ import os2 from "os";
|
|
|
1797
1823
|
import path6 from "path";
|
|
1798
1824
|
import { PostHog } from "posthog-node";
|
|
1799
1825
|
var TOKEN = "phc_SkFAxTIa4RUQxotci1Ftdw7xefZK2Ax0LEIGcl8zuD2";
|
|
1800
|
-
var CLI_VERSION = "0.5.
|
|
1826
|
+
var CLI_VERSION = "0.5.2";
|
|
1801
1827
|
var client = TOKEN ? new PostHog(TOKEN, { host: "https://e.jtl-cloud.com" }) : null;
|
|
1802
1828
|
function telemetryDisabledByEnv() {
|
|
1803
1829
|
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.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tool for scaffolding JTL Platform cloud apps",
|
|
6
6
|
"bin": {
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@clack/prompts": "^1.7.0",
|
|
21
|
-
"@jtl-software/cloud-app-template-backend-dotnet": "0.0.
|
|
22
|
-
"@jtl-software/cloud-app-template-backend-node": "0.0.
|
|
23
|
-
"@jtl-software/cloud-app-template-backend-php": "0.1.
|
|
24
|
-
"@jtl-software/cloud-app-template-frontend-react": "0.1.
|
|
21
|
+
"@jtl-software/cloud-app-template-backend-dotnet": "0.0.13",
|
|
22
|
+
"@jtl-software/cloud-app-template-backend-node": "0.0.16",
|
|
23
|
+
"@jtl-software/cloud-app-template-backend-php": "0.1.3",
|
|
24
|
+
"@jtl-software/cloud-app-template-frontend-react": "0.1.2",
|
|
25
25
|
"@jtl-software/cloud-app-template-shared": "0.1.2",
|
|
26
26
|
"picocolors": "^1.1.1",
|
|
27
27
|
"posthog-node": "^5.48.1"
|