climaybe 2.2.1 → 2.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 +3 -1
- package/bin/version.txt +1 -1
- package/package.json +1 -1
- package/src/commands/init.js +2 -1
- package/src/lib/build-workflows.js +24 -3
package/README.md
CHANGED
|
@@ -234,8 +234,10 @@ Enabled via `climaybe init` prompt (`Enable build + Lighthouse workflows?`; defa
|
|
|
234
234
|
When enabled, `init` validates required theme files and exits with an error if any are missing:
|
|
235
235
|
- `_scripts/main.js`
|
|
236
236
|
- `_styles/main.css`
|
|
237
|
+
|
|
238
|
+
`init` auto-creates:
|
|
237
239
|
- `assets/`
|
|
238
|
-
- `release-notes.md`
|
|
240
|
+
- `release-notes.md` (starter template)
|
|
239
241
|
|
|
240
242
|
`climaybe` auto-installs the shared build script at `.climaybe/build-scripts.js` during workflow scaffolding.
|
|
241
243
|
|
package/bin/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.2.
|
|
1
|
+
2.2.2
|
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -19,7 +19,7 @@ import { scaffoldWorkflows } from '../lib/workflows.js';
|
|
|
19
19
|
import { createStoreDirectories } from '../lib/store-sync.js';
|
|
20
20
|
import { scaffoldCommitlint } from '../lib/commit-tooling.js';
|
|
21
21
|
import { scaffoldCursorBundle } from '../lib/cursor-bundle.js';
|
|
22
|
-
import { getMissingBuildWorkflowRequirements, getBuildScriptRelativePath } from '../lib/build-workflows.js';
|
|
22
|
+
import { getMissingBuildWorkflowRequirements, getBuildScriptRelativePath, ensureBuildWorkflowDefaults } from '../lib/build-workflows.js';
|
|
23
23
|
import { getDevKitExistingFiles, scaffoldThemeDevKit } from '../lib/theme-dev-kit.js';
|
|
24
24
|
import {
|
|
25
25
|
isGhAvailable,
|
|
@@ -54,6 +54,7 @@ async function runInitFlow() {
|
|
|
54
54
|
console.log(pc.dim(`\n Mode: ${mode}-store (${stores.length} store(s))`));
|
|
55
55
|
|
|
56
56
|
if (enableBuildWorkflows) {
|
|
57
|
+
ensureBuildWorkflowDefaults();
|
|
57
58
|
const missingBuildFiles = getMissingBuildWorkflowRequirements();
|
|
58
59
|
if (missingBuildFiles.length > 0) {
|
|
59
60
|
console.log(pc.red('\n Build workflows are enabled, but required files are missing:'));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, mkdirSync, rmSync } from 'node:fs';
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
5
4
|
|
|
6
5
|
const SCRIPT_SOURCE = fileURLToPath(new URL('../workflows/build/build-scripts.js', import.meta.url));
|
|
7
6
|
const SCRIPT_TARGET = '.climaybe/build-scripts.js';
|
|
@@ -20,8 +19,18 @@ module.exports = { buildScripts };
|
|
|
20
19
|
const REQUIRED_PATHS = [
|
|
21
20
|
{ path: '_scripts/main.js', kind: 'file' },
|
|
22
21
|
{ path: '_styles/main.css', kind: 'file' },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const DEFAULTS = [
|
|
23
25
|
{ path: 'assets', kind: 'dir' },
|
|
24
|
-
{
|
|
26
|
+
{
|
|
27
|
+
path: 'release-notes.md',
|
|
28
|
+
kind: 'file',
|
|
29
|
+
content: `# Release Notes
|
|
30
|
+
|
|
31
|
+
- describe key changes for this release
|
|
32
|
+
`,
|
|
33
|
+
},
|
|
25
34
|
];
|
|
26
35
|
|
|
27
36
|
function targetScriptPath(cwd = process.cwd()) {
|
|
@@ -61,6 +70,18 @@ export function getMissingBuildWorkflowRequirements(cwd = process.cwd()) {
|
|
|
61
70
|
return missing;
|
|
62
71
|
}
|
|
63
72
|
|
|
73
|
+
export function ensureBuildWorkflowDefaults(cwd = process.cwd()) {
|
|
74
|
+
for (const entry of DEFAULTS) {
|
|
75
|
+
const abs = join(cwd, entry.path);
|
|
76
|
+
if (existsSync(abs)) continue;
|
|
77
|
+
if (entry.kind === 'dir') {
|
|
78
|
+
mkdirSync(abs, { recursive: true });
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
writeFileSync(abs, entry.content || '', 'utf-8');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
64
85
|
export function getBuildScriptRelativePath() {
|
|
65
86
|
return SCRIPT_TARGET;
|
|
66
87
|
}
|