climaybe 3.0.0 → 3.0.1
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/bin/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.0.
|
|
1
|
+
3.0.1
|
package/package.json
CHANGED
|
@@ -36,20 +36,15 @@ export async function ensureBranchesCommand() {
|
|
|
36
36
|
console.log(pc.dim(` Mode: ${mode}-store (${aliases.length} store(s))\n`));
|
|
37
37
|
|
|
38
38
|
ensureStagingBranch();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
for (const alias of aliases) {
|
|
42
|
-
createStoreBranches(alias);
|
|
43
|
-
}
|
|
39
|
+
for (const alias of aliases) {
|
|
40
|
+
createStoreBranches(alias);
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
console.log(pc.bold(pc.green('\n Branches ensured.\n')));
|
|
47
44
|
console.log(pc.dim(' Push them so CI can run:'));
|
|
48
45
|
console.log(pc.dim(' git push origin staging'));
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
console.log(pc.dim(` git push origin staging-${alias} live-${alias}`));
|
|
52
|
-
}
|
|
46
|
+
for (const alias of aliases) {
|
|
47
|
+
console.log(pc.dim(` git push origin staging-${alias} live-${alias}`));
|
|
53
48
|
}
|
|
54
49
|
console.log(pc.dim(' Or push all at once: git push origin --all\n'));
|
|
55
50
|
}
|
package/src/commands/init.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import prompts from 'prompts';
|
|
2
2
|
import pc from 'picocolors';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
3
4
|
import {
|
|
4
5
|
promptStoreLoop,
|
|
5
6
|
promptPreviewWorkflows,
|
|
@@ -36,11 +37,25 @@ import {
|
|
|
36
37
|
setGitLabVariable,
|
|
37
38
|
} from '../lib/github-secrets.js';
|
|
38
39
|
|
|
40
|
+
function installThemeDependencies(cwd = process.cwd()) {
|
|
41
|
+
try {
|
|
42
|
+
execSync('npm install', { cwd, stdio: 'inherit' });
|
|
43
|
+
console.log(pc.green(' Installed theme dependencies (npm install).'));
|
|
44
|
+
return true;
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.log(pc.yellow(` npm install failed or skipped: ${err.message}`));
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
39
51
|
/**
|
|
40
52
|
* Run the full init flow: prompts, config write, git, branches, workflows.
|
|
41
53
|
* Used by both init (when not already inited or user confirms reinit) and reinit.
|
|
42
54
|
*/
|
|
43
55
|
async function runInitFlow() {
|
|
56
|
+
const hasPackageJson = !!readPkg();
|
|
57
|
+
const projectName = !hasPackageJson ? await promptProjectName() : undefined;
|
|
58
|
+
|
|
44
59
|
// 1. Collect stores from user
|
|
45
60
|
const stores = await promptStoreLoop();
|
|
46
61
|
const mode = stores.length > 1 ? 'multi' : 'single';
|
|
@@ -48,7 +63,6 @@ async function runInitFlow() {
|
|
|
48
63
|
const enableBuildWorkflows = await promptBuildWorkflows();
|
|
49
64
|
const enableDevKit = await promptDevKit();
|
|
50
65
|
const enableVSCodeTasks = enableDevKit ? await promptVSCodeDevTasks() : false;
|
|
51
|
-
const projectName = enableDevKit && !readPkg() ? await promptProjectName() : undefined;
|
|
52
66
|
const enableCommitlint = await promptCommitlint();
|
|
53
67
|
const enableCursorSkills = await promptCursorSkills();
|
|
54
68
|
|
|
@@ -111,6 +125,7 @@ async function runInitFlow() {
|
|
|
111
125
|
// 5. Create branches
|
|
112
126
|
if (mode === 'single') {
|
|
113
127
|
ensureStagingBranch();
|
|
128
|
+
createStoreBranches(stores[0].alias);
|
|
114
129
|
} else {
|
|
115
130
|
// Multi-store: staging branch + per-store branches
|
|
116
131
|
ensureStagingBranch();
|
|
@@ -158,6 +173,7 @@ async function runInitFlow() {
|
|
|
158
173
|
packageName: projectName || undefined,
|
|
159
174
|
});
|
|
160
175
|
console.log(pc.green(' Theme dev kit installed (local config + ignore defaults).'));
|
|
176
|
+
installThemeDependencies();
|
|
161
177
|
}
|
|
162
178
|
|
|
163
179
|
// Done
|
|
@@ -165,6 +181,7 @@ async function runInitFlow() {
|
|
|
165
181
|
|
|
166
182
|
if (mode === 'single') {
|
|
167
183
|
console.log(pc.dim(' Branches: main, staging'));
|
|
184
|
+
console.log(pc.dim(` staging-${stores[0].alias}, live-${stores[0].alias}`));
|
|
168
185
|
console.log(pc.dim(' Workflow: staging → main with versioning + nightly hotfix tagging'));
|
|
169
186
|
} else {
|
|
170
187
|
console.log(pc.dim(' Branches: main, staging'));
|
package/src/lib/dev-runtime.js
CHANGED
|
@@ -106,6 +106,24 @@ export function serveAssets({ cwd = process.cwd(), includeThemeCheck = true } =
|
|
|
106
106
|
})
|
|
107
107
|
: null;
|
|
108
108
|
|
|
109
|
+
let themeCheckRunning = false;
|
|
110
|
+
let themeCheckQueued = false;
|
|
111
|
+
const runThemeCheck = () => {
|
|
112
|
+
if (themeCheckRunning) {
|
|
113
|
+
themeCheckQueued = true;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
themeCheckRunning = true;
|
|
117
|
+
const child = runShopify(['theme', 'check'], { cwd, name: 'theme-check' });
|
|
118
|
+
child.on('exit', () => {
|
|
119
|
+
themeCheckRunning = false;
|
|
120
|
+
if (themeCheckQueued) {
|
|
121
|
+
themeCheckQueued = false;
|
|
122
|
+
runThemeCheck();
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
109
127
|
const themeCheckWatch =
|
|
110
128
|
includeThemeCheck
|
|
111
129
|
? watchTree({
|
|
@@ -118,11 +136,15 @@ export function serveAssets({ cwd = process.cwd(), includeThemeCheck = true } =
|
|
|
118
136
|
p.includes('/_styles/'),
|
|
119
137
|
debounceMs: 800,
|
|
120
138
|
onChange: () => {
|
|
121
|
-
|
|
139
|
+
runThemeCheck();
|
|
122
140
|
},
|
|
123
141
|
})
|
|
124
142
|
: null;
|
|
125
143
|
|
|
144
|
+
if (includeThemeCheck) {
|
|
145
|
+
runThemeCheck();
|
|
146
|
+
}
|
|
147
|
+
|
|
126
148
|
const cleanup = () => {
|
|
127
149
|
safeClose(scriptsWatch);
|
|
128
150
|
safeClose(themeCheckWatch);
|
package/src/lib/theme-dev-kit.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join, dirname } from 'node:path';
|
|
3
3
|
import { readPkg, writePkg, writeClimaybeConfig } from './config.js';
|
|
4
|
+
import { getLatestTagVersion } from './git.js';
|
|
4
5
|
|
|
5
6
|
const DEV_KIT_FILES = {
|
|
6
7
|
'.theme-check.yml': `root: .
|
|
7
8
|
|
|
8
|
-
extends: :
|
|
9
|
+
extends: theme-check:recommended
|
|
9
10
|
|
|
10
11
|
ignore:
|
|
11
12
|
- node_modules/*
|
|
@@ -109,6 +110,7 @@ const VSCODE_TASKS_CONTENT = `{
|
|
|
109
110
|
|
|
110
111
|
const GITIGNORE_BLOCK = `# climaybe: theme dev kit (managed)
|
|
111
112
|
.vscode
|
|
113
|
+
node_modules/
|
|
112
114
|
assets/style.css
|
|
113
115
|
assets/index.js
|
|
114
116
|
.shopify
|
|
@@ -132,7 +134,23 @@ function mergeGitignore(cwd = process.cwd()) {
|
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
function mergePackageJson({ packageName = 'shopify-theme', cwd = process.cwd() } = {}) {
|
|
135
|
-
|
|
137
|
+
let pkg = readPkg(cwd);
|
|
138
|
+
if (!pkg) {
|
|
139
|
+
let version = '0.1.0';
|
|
140
|
+
try {
|
|
141
|
+
const fromTags = getLatestTagVersion(cwd);
|
|
142
|
+
if (fromTags) version = fromTags;
|
|
143
|
+
} catch {
|
|
144
|
+
// not a git repo or no semver tags found
|
|
145
|
+
}
|
|
146
|
+
pkg = { name: packageName, version, private: true };
|
|
147
|
+
}
|
|
148
|
+
if (!pkg.description) {
|
|
149
|
+
pkg.description = 'Customizable modular development environment for blazing-fast Shopify theme creation';
|
|
150
|
+
}
|
|
151
|
+
if (!pkg.author) {
|
|
152
|
+
pkg.author = 'Electric Maybe <hello@electricmaybe.com>';
|
|
153
|
+
}
|
|
136
154
|
pkg.devDependencies = { ...(pkg.devDependencies || {}) };
|
|
137
155
|
|
|
138
156
|
// Ensure teammates can run climaybe + Tailwind after plain npm install.
|