@smi-digital/create-smi-app 2.0.0 → 2.2.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 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
- // eslint-disable-next-line camelcase
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@smi-digital/create-smi-app",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1 +1,31 @@
1
- npx lint-staged
1
+ #!/usr/bin/env sh
2
+
3
+ # 1. Run standard linters and formatters
4
+ npx lint-staged
5
+
6
+ # 2. Ansible-Vault Auto-Encryptor
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 already an Ansible Vault file
15
+ if [[ "$FIRST_LINE" != "\$ANSIBLE_VAULT;"* ]]; then
16
+ echo "🔒 Auto-encrypting production secrets for: $file"
17
+
18
+ # Check if .vault-password exists
19
+ if [ ! -f ".vault-password" ]; then
20
+ echo "❌ ERROR: .vault-password file not found. Cannot encrypt secrets."
21
+ echo "Please create a .vault-password file containing your master password."
22
+ exit 1
23
+ fi
24
+
25
+ # Encrypt the file using the local password
26
+ ansible-vault encrypt "$file" --vault-password-file .vault-password
27
+
28
+ # Re-stage the now-encrypted file
29
+ git add "$file"
30
+ fi
31
+ done
@@ -1,2 +1,7 @@
1
1
  node_modules
2
- *.env
2
+ *.env
3
+ # Allow encrypted production env files to be committed
4
+ !production.*.env
5
+
6
+ # Ansible Vault Password (NEVER COMMIT THIS)
7
+ .vault-password
@@ -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...