@smi-digital/create-smi-app 2.0.0 → 2.1.0
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 +12 -4
- package/package.json +1 -1
- package/templates/.husky/pre-commit +28 -1
- package/templates/base/gitignore.template +6 -1
- package/templates/integrations/strapi-astro/.vault-password.template +1 -0
- package/templates/integrations/strapi-astro/integration.config.json +12 -0
- package/templates/integrations/strapi-astro/production.backend.env.template +19 -0
- package/templates/integrations/strapi-astro/production.frontend.env.template +14 -0
package/dist/index.js
CHANGED
|
@@ -64,8 +64,7 @@ var FRAMEWORK_GENERATORS = {
|
|
|
64
64
|
"--template",
|
|
65
65
|
"minimal",
|
|
66
66
|
"--install",
|
|
67
|
-
"--git",
|
|
68
|
-
"false",
|
|
67
|
+
"--no-git",
|
|
69
68
|
"--yes"
|
|
70
69
|
];
|
|
71
70
|
}
|
|
@@ -487,6 +486,7 @@ async function createApps(projectRoot, targets) {
|
|
|
487
486
|
// src/modules/scaffoldActions/createIntegrations.ts
|
|
488
487
|
import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
|
|
489
488
|
import { dirname as dirname2, join as join4 } from "path";
|
|
489
|
+
import { randomBytes } from "crypto";
|
|
490
490
|
function toTemplateToken(key) {
|
|
491
491
|
const normalized = key.replaceAll(/[^a-zA-Z0-9]+/gv, "_").replaceAll(/^_+|_+$/gv, "").toUpperCase();
|
|
492
492
|
return `__${normalized}__`;
|
|
@@ -552,11 +552,19 @@ async function createIntegrations(options, projectRoot, templatesDir) {
|
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
554
|
const applyFile = async (file) => runStep(`Adding ${file.target}`, async () => {
|
|
555
|
+
const generateSecret = () => randomBytes(32).toString("base64url");
|
|
555
556
|
const templateValues = {
|
|
556
557
|
...options.integrationInputs,
|
|
557
|
-
|
|
558
|
-
astro_port: "4321"
|
|
558
|
+
/* eslint-disable camelcase */
|
|
559
|
+
astro_port: "4321",
|
|
559
560
|
// Hardcoded to SSR port
|
|
561
|
+
vault_password: generateSecret(),
|
|
562
|
+
app_keys: `${generateSecret()},${generateSecret()}`,
|
|
563
|
+
api_token_salt: generateSecret(),
|
|
564
|
+
admin_jwt_secret: generateSecret(),
|
|
565
|
+
transfer_token_salt: generateSecret(),
|
|
566
|
+
jwt_secret: generateSecret()
|
|
567
|
+
/* eslint-enable camelcase */
|
|
560
568
|
};
|
|
561
569
|
return copyTemplateFile(
|
|
562
570
|
join4(integrationRoot, file.template),
|
package/package.json
CHANGED
|
@@ -1 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# 1. Run standard linters and formatters
|
|
4
|
+
npx lint-staged
|
|
5
|
+
|
|
6
|
+
# 2. Ansible-Vault Security Guard
|
|
7
|
+
# Find any staged files that end in .env and start with "production"
|
|
8
|
+
STAGED_ENV_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '^production\..*\.env$')
|
|
9
|
+
|
|
10
|
+
for file in $STAGED_ENV_FILES; do
|
|
11
|
+
# Read the first line of the file
|
|
12
|
+
FIRST_LINE=$(head -n 1 "$file")
|
|
13
|
+
|
|
14
|
+
# Check if the first line indicates it is an Ansible Vault file
|
|
15
|
+
if [[ "$FIRST_LINE" != "\$ANSIBLE_VAULT;"* ]]; then
|
|
16
|
+
echo ""
|
|
17
|
+
echo "🚨 SECURITY ALERT: Unencrypted Production Secrets Detected! 🚨"
|
|
18
|
+
echo "File: $file"
|
|
19
|
+
echo ""
|
|
20
|
+
echo "You are attempting to commit a plain-text production .env file."
|
|
21
|
+
echo "Please encrypt it using Ansible-Vault before committing:"
|
|
22
|
+
echo ""
|
|
23
|
+
echo " ansible-vault encrypt $file"
|
|
24
|
+
echo ""
|
|
25
|
+
echo "Commit aborted."
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
done
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__VAULT_PASSWORD__
|
|
@@ -69,6 +69,18 @@
|
|
|
69
69
|
{
|
|
70
70
|
"template": "frontend/src/middleware.ts.template",
|
|
71
71
|
"target": "frontend/src/middleware.ts"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"template": ".vault-password.template",
|
|
75
|
+
"target": ".vault-password"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"template": "production.frontend.env.template",
|
|
79
|
+
"target": "production.frontend.env"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"template": "production.backend.env.template",
|
|
83
|
+
"target": "production.backend.env"
|
|
72
84
|
}
|
|
73
85
|
]
|
|
74
86
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# PRODUCTION BACKEND SECRETS (Strapi)
|
|
3
|
+
#
|
|
4
|
+
# 🚨 SECURITY WARNING 🚨
|
|
5
|
+
# This file MUST be encrypted before committing to Git!
|
|
6
|
+
# Run: ansible-vault encrypt production.backend.env --vault-password-file .vault-password
|
|
7
|
+
# ==============================================================================
|
|
8
|
+
|
|
9
|
+
# Strapi System Keys (Automatically generated by create-smi-app)
|
|
10
|
+
APP_KEYS=__APP_KEYS__
|
|
11
|
+
API_TOKEN_SALT=__API_TOKEN_SALT__
|
|
12
|
+
ADMIN_JWT_SECRET=__ADMIN_JWT_SECRET__
|
|
13
|
+
TRANSFER_TOKEN_SALT=__TRANSFER_TOKEN_SALT__
|
|
14
|
+
JWT_SECRET=__JWT_SECRET__
|
|
15
|
+
|
|
16
|
+
# Production Settings
|
|
17
|
+
HOST=0.0.0.0
|
|
18
|
+
PORT=1337
|
|
19
|
+
NODE_ENV=production
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# PRODUCTION FRONTEND SECRETS (Astro SSR)
|
|
3
|
+
#
|
|
4
|
+
# 🚨 SECURITY WARNING 🚨
|
|
5
|
+
# This file MUST be encrypted before committing to Git!
|
|
6
|
+
# Run: ansible-vault encrypt production.frontend.env --vault-password-file .vault-password
|
|
7
|
+
# ==============================================================================
|
|
8
|
+
|
|
9
|
+
# Internal Docker Network routing (Do not change)
|
|
10
|
+
PUBLIC_API_URL=http://__APP_NAME__-strapi:1337
|
|
11
|
+
|
|
12
|
+
# Add your client-specific 3rd party secrets below
|
|
13
|
+
# STRIPE_SECRET_KEY=sk_live_...
|
|
14
|
+
# SENDGRID_API_KEY=SG...
|