basebrick-bricklayer 1.2.0 → 1.2.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.
package/README.md CHANGED
@@ -23,6 +23,18 @@ npx bricklayer init
23
23
 
24
24
  This interactive setup will create the default folder structure and ask if you'd like to scaffold a demo site with starter templates, as well as configure Sonic JS CMS integration automatically.
25
25
 
26
+ ## Automated Deployment (GitHub Actions)
27
+
28
+ If you chose to generate a `deploy.yml` workflow during initialization, Bricklayer will automatically deploy your site to Cloudflare on every push to the `main` branch.
29
+
30
+ For Wrangler to authenticate correctly in a non-interactive CI/CD environment, you **must** configure your repository secrets.
31
+
32
+ 1. Go to [Cloudflare API Tokens](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) and create an API Token with `Edit Cloudflare Workers` permissions.
33
+ 2. In your GitHub repository, navigate to **Settings > Secrets and variables > Actions**.
34
+ 3. Create two new Repository Secrets:
35
+ - `CLOUDFLARE_API_TOKEN`: Your newly created API token.
36
+ - `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare Account ID (found on your Cloudflare dashboard overview).
37
+
26
38
  Alternatively, if you are working within the BaseBrick ecosystem locally, you can link it:
27
39
 
28
40
  ```bash
package/bin/init.js CHANGED
@@ -234,8 +234,9 @@ url: post.title
234
234
  try {
235
235
  const existing = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
236
236
  pkg = { ...pkg, ...existing };
237
- pkg.dependencies = { ...pkg.dependencies, ...existing.dependencies };
238
- pkg.devDependencies = { ...pkg.devDependencies, ...existing.devDependencies };
237
+ pkg.scripts = { ...(existing.scripts || {}), ...pkg.scripts };
238
+ pkg.dependencies = { ...(existing.dependencies || {}), ...pkg.dependencies };
239
+ pkg.devDependencies = { ...(existing.devDependencies || {}), ...pkg.devDependencies };
239
240
  } catch(e) {}
240
241
  }
241
242
 
package/bin/manage.js CHANGED
@@ -129,12 +129,27 @@ export async function manageProject(cwd, options = {}) {
129
129
  const accountMatch = wranglerContent.match(/^account_id\s*=\s*"([^"]+)"/m);
130
130
  if (accountMatch && accountMatch[1]) {
131
131
  projectConfig.accountId = accountMatch[1];
132
+ } else if (process.env.CLOUDFLARE_ACCOUNT_ID) {
133
+ projectConfig.accountId = process.env.CLOUDFLARE_ACCOUNT_ID;
132
134
  }
133
135
  } catch (e) {
134
136
  console.error('Warning: Could not parse wrangler.toml');
135
137
  }
136
138
  }
137
139
 
140
+ if (!projectConfig.accountId) {
141
+ try {
142
+ const { execSync } = await import('child_process');
143
+ const whoamiOutput = execSync('npx wrangler whoami', { stdio: 'pipe', encoding: 'utf8' });
144
+ const match = whoamiOutput.match(/Account ID[^\n]*?([a-f0-9]{32})/i);
145
+ if (match && match[1]) {
146
+ projectConfig.accountId = match[1];
147
+ }
148
+ } catch (e) {
149
+ // Ignore if whoami fails
150
+ }
151
+ }
152
+
138
153
  // Save cleaned config back to .basebrick.config
139
154
  fs.writeFileSync(localConfigPath, JSON.stringify(projectConfig, null, 2));
140
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basebrick-bricklayer",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "description": "BaseBrick static site generator (JamBrick)",
6
6
  "main": "index.js",