brick-engine-cli 1.0.1 → 1.0.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.
@@ -35,9 +35,10 @@ jobs:
35
35
  run: npm ci
36
36
 
37
37
  - name: Inject Secrets
38
- run: |
39
- sed -i "s|%%SUPABASE_URL%%|${{ secrets.SUPABASE_URL }}|g" src/config/constants.ts
40
- sed -i "s|%%SUPABASE_ANON_KEY%%|${{ secrets.SUPABASE_ANON_KEY }}|g" src/config/constants.ts
38
+ run: node scripts/inject-secrets.js
39
+ env:
40
+ SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
41
+ SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
41
42
 
42
43
  - name: Build project
43
44
  run: npm run build
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brick-engine-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CLI to scaffold Brick Game projects",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -0,0 +1,30 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ const filePath = path.join(process.cwd(), "src/config/constants.ts");
5
+ let content = fs.readFileSync(filePath, "utf8");
6
+
7
+ const secrets = {
8
+ "%%SUPABASE_URL%%": process.env.SUPABASE_URL,
9
+ "%%SUPABASE_ANON_KEY%%": process.env.SUPABASE_ANON_KEY,
10
+ };
11
+
12
+ let replaced = false;
13
+ for (const [placeholder, value] of Object.entries(secrets)) {
14
+ if (value) {
15
+ console.log(`Injecting value for ${placeholder}...`);
16
+ content = content.replace(placeholder, value);
17
+ replaced = true;
18
+ } else {
19
+ console.warn(
20
+ `Warning: No value found for ${placeholder}. Skipping injection.`,
21
+ );
22
+ }
23
+ }
24
+
25
+ if (replaced) {
26
+ fs.writeFileSync(filePath, content);
27
+ console.log("Secrets injected successfully.");
28
+ } else {
29
+ console.log("No secrets were injected.");
30
+ }