bluedither 1.0.22 → 1.0.23
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 +18 -1
- package/package.json +1 -1
package/cli/commands/install.js
CHANGED
|
@@ -161,7 +161,24 @@ function autoWireVitePlugin(targetDir) {
|
|
|
161
161
|
const p = resolve(targetDir, v);
|
|
162
162
|
if (existsSync(p)) { configPath = p; break; }
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
|
|
165
|
+
// No vite config exists — check if vite is available and create one
|
|
166
|
+
if (!configPath) {
|
|
167
|
+
const pkgPath = resolve(targetDir, 'package.json');
|
|
168
|
+
const hasVite = existsSync(pkgPath) &&
|
|
169
|
+
JSON.parse(readFileSync(pkgPath, 'utf-8')).devDependencies?.vite;
|
|
170
|
+
|
|
171
|
+
if (hasVite) {
|
|
172
|
+
// Vite is installed but no config — create a minimal one with the plugin
|
|
173
|
+
configPath = resolve(targetDir, 'vite.config.js');
|
|
174
|
+
writeFileSync(configPath, `import { bluedither } from './bluedither/dev-middleware.js'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n plugins: [bluedither()],\n})\n`);
|
|
175
|
+
console.log(`Created vite.config.js with BlueDither plugin`);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// No vite at all — nothing to wire
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
165
182
|
|
|
166
183
|
const config = readFileSync(configPath, 'utf-8');
|
|
167
184
|
|