@jtl-software/create-cloud-app 0.0.11 → 0.0.13
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 +16 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5,11 +5,24 @@ import * as p from "@clack/prompts";
|
|
|
5
5
|
import pc from "picocolors";
|
|
6
6
|
|
|
7
7
|
// src/scaffold.ts
|
|
8
|
+
import crypto from "crypto";
|
|
8
9
|
import fs from "fs";
|
|
9
10
|
import path from "path";
|
|
10
11
|
function toPascalCase(kebab) {
|
|
11
12
|
return kebab.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
12
13
|
}
|
|
14
|
+
function slugify(input) {
|
|
15
|
+
return input.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
16
|
+
}
|
|
17
|
+
function buildTechnicalName(appName) {
|
|
18
|
+
const hash = crypto.randomBytes(3).toString("hex");
|
|
19
|
+
return `${slugify(appName)}-${hash}`;
|
|
20
|
+
}
|
|
21
|
+
var SHORT_DESCRIPTION_MAX_LENGTH = 150;
|
|
22
|
+
function buildShortDescription(description) {
|
|
23
|
+
if (description.length <= SHORT_DESCRIPTION_MAX_LENGTH) return description;
|
|
24
|
+
return description.slice(0, SHORT_DESCRIPTION_MAX_LENGTH - 1).trimEnd() + "\u2026";
|
|
25
|
+
}
|
|
13
26
|
var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
14
27
|
".png",
|
|
15
28
|
".jpg",
|
|
@@ -98,7 +111,9 @@ async function scaffold({
|
|
|
98
111
|
const baseReplacements = {
|
|
99
112
|
"{{APP_NAME}}": appName,
|
|
100
113
|
"{{APP_NAME_PASCAL}}": pascalName,
|
|
101
|
-
"{{
|
|
114
|
+
"{{APP_TECHNICAL_NAME}}": buildTechnicalName(appName),
|
|
115
|
+
"{{APP_DESCRIPTION}}": description,
|
|
116
|
+
"{{APP_DESCRIPTION_SHORT}}": buildShortDescription(description)
|
|
102
117
|
};
|
|
103
118
|
if (fs.existsSync(targetDir)) {
|
|
104
119
|
throw new Error(`Directory "${appName}" already exists`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jtl-software/create-cloud-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tool for scaffolding JTL Platform cloud apps",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@clack/prompts": "^1.2.0",
|
|
18
|
-
"@jtl-software/cloud-app-template-frontend-react": "0.0.
|
|
18
|
+
"@jtl-software/cloud-app-template-frontend-react": "0.0.11",
|
|
19
19
|
"@jtl-software/cloud-app-template-backend-node": "0.0.8",
|
|
20
20
|
"@jtl-software/cloud-app-template-backend-dotnet": "0.0.7",
|
|
21
21
|
"@jtl-software/cloud-app-template-shared": "0.0.3",
|