bluedither 1.0.22 → 1.0.24
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/cli/commands/install.js +59 -1
- package/package.json +1 -1
package/cli/commands/install.js
CHANGED
|
@@ -121,6 +121,26 @@ export default async function install(args) {
|
|
|
121
121
|
|
|
122
122
|
console.log(`Copied ${copied} files to ${bdDir}`);
|
|
123
123
|
|
|
124
|
+
// Also copy tuner assets + tokens to public/bluedither/ for Vite projects
|
|
125
|
+
const publicBdDir = resolve(targetDir, 'public', 'bluedither');
|
|
126
|
+
if (existsSync(resolve(targetDir, 'public')) || existsSync(resolve(targetDir, 'vite.config.js')) || existsSync(resolve(targetDir, 'vite.config.ts'))) {
|
|
127
|
+
mkdirSync(publicBdDir, { recursive: true });
|
|
128
|
+
const publicFiles = [
|
|
129
|
+
[resolve(bdDir, 'bluedither-tuner.js'), 'bluedither-tuner.js'],
|
|
130
|
+
[resolve(bdDir, 'bluedither-tuner.css'), 'bluedither-tuner.css'],
|
|
131
|
+
[resolve(bdDir, 'bluedither-tuner-inject.js'), 'bluedither-tuner-inject.js'],
|
|
132
|
+
[resolve(bdDir, 'tokens.json'), 'tokens.json'],
|
|
133
|
+
[resolve(bdDir, 'tokens.defaults.json'), 'tokens.defaults.json'],
|
|
134
|
+
[resolve(bdDir, 'dev-middleware.js'), 'dev-middleware.js'],
|
|
135
|
+
];
|
|
136
|
+
for (const [srcPath, destName] of publicFiles) {
|
|
137
|
+
if (existsSync(srcPath)) {
|
|
138
|
+
copyFileSync(srcPath, resolve(publicBdDir, destName));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
console.log(`Copied tuner assets to public/bluedither/`);
|
|
142
|
+
}
|
|
143
|
+
|
|
124
144
|
// Auto-wire Vite plugin if vite.config exists
|
|
125
145
|
autoWireVitePlugin(targetDir);
|
|
126
146
|
|
|
@@ -161,7 +181,24 @@ function autoWireVitePlugin(targetDir) {
|
|
|
161
181
|
const p = resolve(targetDir, v);
|
|
162
182
|
if (existsSync(p)) { configPath = p; break; }
|
|
163
183
|
}
|
|
164
|
-
|
|
184
|
+
|
|
185
|
+
// No vite config exists — check if vite is available and create one
|
|
186
|
+
if (!configPath) {
|
|
187
|
+
const pkgPath = resolve(targetDir, 'package.json');
|
|
188
|
+
const hasVite = existsSync(pkgPath) &&
|
|
189
|
+
JSON.parse(readFileSync(pkgPath, 'utf-8')).devDependencies?.vite;
|
|
190
|
+
|
|
191
|
+
if (hasVite) {
|
|
192
|
+
// Vite is installed but no config — create a minimal one with the plugin
|
|
193
|
+
configPath = resolve(targetDir, 'vite.config.js');
|
|
194
|
+
writeFileSync(configPath, `import { bluedither } from './bluedither/dev-middleware.js'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n plugins: [bluedither()],\n})\n`);
|
|
195
|
+
console.log(`Created vite.config.js with BlueDither plugin`);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// No vite at all — nothing to wire
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
165
202
|
|
|
166
203
|
const config = readFileSync(configPath, 'utf-8');
|
|
167
204
|
|
|
@@ -252,6 +289,27 @@ async function installFromRegistry(slug, targetDir) {
|
|
|
252
289
|
}
|
|
253
290
|
}
|
|
254
291
|
|
|
292
|
+
// Also copy tuner assets + tokens to public/bluedither/ for Vite projects
|
|
293
|
+
// This saves the AI agent from having to do this step manually
|
|
294
|
+
const publicBdDir = resolve(targetDir, 'public', 'bluedither');
|
|
295
|
+
if (existsSync(resolve(targetDir, 'public')) || existsSync(resolve(targetDir, 'vite.config.js')) || existsSync(resolve(targetDir, 'vite.config.ts'))) {
|
|
296
|
+
mkdirSync(publicBdDir, { recursive: true });
|
|
297
|
+
const publicFiles = [
|
|
298
|
+
[resolve(bdDir, 'bluedither-tuner.js'), 'bluedither-tuner.js'],
|
|
299
|
+
[resolve(bdDir, 'bluedither-tuner.css'), 'bluedither-tuner.css'],
|
|
300
|
+
[resolve(bdDir, 'bluedither-tuner-inject.js'), 'bluedither-tuner-inject.js'],
|
|
301
|
+
[resolve(bdDir, 'tokens.json'), 'tokens.json'],
|
|
302
|
+
[resolve(bdDir, 'tokens.defaults.json'), 'tokens.defaults.json'],
|
|
303
|
+
[resolve(bdDir, 'dev-middleware.js'), 'dev-middleware.js'],
|
|
304
|
+
];
|
|
305
|
+
for (const [srcPath, destName] of publicFiles) {
|
|
306
|
+
if (existsSync(srcPath)) {
|
|
307
|
+
copyFileSync(srcPath, resolve(publicBdDir, destName));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
console.log(` Copied tuner assets to public/bluedither/`);
|
|
311
|
+
}
|
|
312
|
+
|
|
255
313
|
// Detect framework and create Claude Code command
|
|
256
314
|
const { framework, typescript } = detectFramework(targetDir);
|
|
257
315
|
console.log(` Detected framework: ${framework}${typescript ? ' + TypeScript' : ''}`);
|