@smi-digital/create-smi-app 2.7.3 → 2.7.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.
package/dist/index.js
CHANGED
|
@@ -156,6 +156,9 @@ var smiTheme = {
|
|
|
156
156
|
cursor: primary12("\u276F")
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
+
function toSlug(value) {
|
|
160
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/gv, "-").replace(/^-+|-+$/gv, "");
|
|
161
|
+
}
|
|
159
162
|
async function askIntegrationInputs(inputConfig, index = 0, answers = {}) {
|
|
160
163
|
const current = inputConfig[index];
|
|
161
164
|
if (!current) {
|
|
@@ -178,9 +181,17 @@ async function askIntegrationInputs(inputConfig, index = 0, answers = {}) {
|
|
|
178
181
|
const inputConfigData = {
|
|
179
182
|
message: current.message,
|
|
180
183
|
validate(value) {
|
|
181
|
-
|
|
184
|
+
const trimmed = value.trim();
|
|
185
|
+
if (current.required && trimmed.length === 0) {
|
|
182
186
|
return "This value is required.";
|
|
183
187
|
}
|
|
188
|
+
if (current.validate === "slug" && trimmed.length > 0) {
|
|
189
|
+
const isSlug = /^[a-z0-9]+(?:-[a-z0-9]+)*$/v.test(trimmed);
|
|
190
|
+
if (!isSlug) {
|
|
191
|
+
const suggestion = toSlug(trimmed);
|
|
192
|
+
return `Must be a lowercase slug \u2014 letters, digits and single hyphens only (no dots, uppercase or spaces).${suggestion ? ` Try: ${suggestion}` : ""}`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
184
195
|
return true;
|
|
185
196
|
},
|
|
186
197
|
theme: smiTheme
|
|
@@ -458,7 +469,7 @@ ${stderrTail}` : "";
|
|
|
458
469
|
|
|
459
470
|
// src/modules/scaffoldActions/createApps.ts
|
|
460
471
|
import { join as join4 } from "path";
|
|
461
|
-
import {
|
|
472
|
+
import { writeFile as writeFile2 } from "fs/promises";
|
|
462
473
|
async function createFrameworkApp(projectRoot, target) {
|
|
463
474
|
const generator = FRAMEWORK_GENERATORS[target.framework];
|
|
464
475
|
if (!generator) {
|
|
@@ -487,13 +498,11 @@ async function createApps(projectRoot, targets) {
|
|
|
487
498
|
target.directory,
|
|
488
499
|
"config/plugins.ts"
|
|
489
500
|
);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
501
|
+
await writeFile2(pluginsPath, "export default () => ({});\n");
|
|
502
|
+
} catch (error) {
|
|
503
|
+
console.warn(
|
|
504
|
+
`Could not normalize config/plugins.ts: ${error instanceof Error ? error.message : String(error)}`
|
|
494
505
|
);
|
|
495
|
-
await writeFile2(pluginsPath, pluginsContent);
|
|
496
|
-
} catch {
|
|
497
506
|
}
|
|
498
507
|
}
|
|
499
508
|
await runSequentially(index + 1);
|
|
@@ -502,7 +511,7 @@ async function createApps(projectRoot, targets) {
|
|
|
502
511
|
}
|
|
503
512
|
|
|
504
513
|
// src/modules/scaffoldActions/createIntegrations.ts
|
|
505
|
-
import { mkdir, readFile as
|
|
514
|
+
import { mkdir, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
506
515
|
import { dirname as dirname2, join as join5 } from "path";
|
|
507
516
|
import { randomBytes } from "crypto";
|
|
508
517
|
function toTemplateToken(key) {
|
|
@@ -517,7 +526,7 @@ function applyTemplateVariables(content, values) {
|
|
|
517
526
|
return result;
|
|
518
527
|
}
|
|
519
528
|
async function copyTemplateFile(sourcePath, targetPath, values) {
|
|
520
|
-
const rawContent = await
|
|
529
|
+
const rawContent = await readFile3(sourcePath, "utf8");
|
|
521
530
|
const content = applyTemplateVariables(rawContent, values);
|
|
522
531
|
await mkdir(dirname2(targetPath), { recursive: true });
|
|
523
532
|
await writeFile3(targetPath, content, "utf8");
|
|
@@ -604,7 +613,7 @@ async function createIntegrations(options, projectRoot, templatesDir) {
|
|
|
604
613
|
const frontendDir = join5(projectRoot, "frontend");
|
|
605
614
|
await runCommandQuiet("npx", ["astro", "add", "node", "-y"], frontendDir);
|
|
606
615
|
const astroConfigPath = join5(frontendDir, "astro.config.mjs");
|
|
607
|
-
let astroConfig = await
|
|
616
|
+
let astroConfig = await readFile3(astroConfigPath, "utf8");
|
|
608
617
|
astroConfig = astroConfig.replace(
|
|
609
618
|
/export default defineConfig\s*\(\s*\{/v,
|
|
610
619
|
"export default defineConfig({\n output: 'server',"
|
package/package.json
CHANGED
|
@@ -14,10 +14,11 @@ jobs:
|
|
|
14
14
|
backend_domain: __BACKEND_DOMAIN__
|
|
15
15
|
app_name: __APP_NAME__
|
|
16
16
|
secrets:
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
# Per-repo secrets (Settings → Secrets and variables → Actions).
|
|
18
|
+
# WEBSERVER_SSH_KEY and ZOT_PASSWORD are shared across all projects;
|
|
19
|
+
# VAULT_PASSWORD is unique to this repo (matches its .vault-password).
|
|
20
|
+
# Shared infra (web server IP/user, Zot username) is set once as defaults
|
|
21
|
+
# in the cd-library workflow — no need to configure it here.
|
|
22
|
+
WEBSERVER_SSH_KEY: ${{ secrets.WEBSERVER_SSH_KEY }}
|
|
21
23
|
VAULT_PASSWORD: ${{ secrets.VAULT_PASSWORD }}
|
|
22
|
-
ZOT_USERNAME: ${{ secrets.ZOT_USERNAME }}
|
|
23
24
|
ZOT_PASSWORD: ${{ secrets.ZOT_PASSWORD }}
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"key": "app_name",
|
|
27
|
-
"message": "What is the app name?",
|
|
27
|
+
"message": "What is the app name? (lowercase slug, e.g. my-new-client)",
|
|
28
28
|
"type": "input",
|
|
29
29
|
"default": "my-new-client",
|
|
30
|
-
"required": true
|
|
30
|
+
"required": true,
|
|
31
|
+
"validate": "slug"
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
"key": "include_www",
|