bluedither 1.0.16 → 1.0.17

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.
@@ -121,6 +121,9 @@ export default async function install(args) {
121
121
 
122
122
  console.log(`Copied ${copied} files to ${bdDir}`);
123
123
 
124
+ // Auto-wire Vite plugin if vite.config exists
125
+ autoWireVitePlugin(targetDir);
126
+
124
127
  // Generate Claude Code command file
125
128
  const claudeDir = resolve(targetDir, '.claude', 'commands');
126
129
  mkdirSync(claudeDir, { recursive: true });
@@ -145,14 +148,46 @@ $ARGUMENTS
145
148
  To apply the theme, use Claude Code:
146
149
  /apply-theme [description of your site]
147
150
 
148
- To customize visually, add this to your HTML:
149
- <script src="./bluedither/bluedither-tuner-inject.js"></script>
150
-
151
- For auto-saving, run in a separate terminal:
152
- npx bluedither tune --save-only
151
+ The tuner panel loads automatically in dev mode.
152
+ Click "Commit Changes" to save tweaks to tokens.json.
153
153
  `);
154
154
  }
155
155
 
156
+ function autoWireVitePlugin(targetDir) {
157
+ // Find vite.config file
158
+ const variants = ['vite.config.js', 'vite.config.ts', 'vite.config.mjs', 'vite.config.mts'];
159
+ let configPath = null;
160
+ for (const v of variants) {
161
+ const p = resolve(targetDir, v);
162
+ if (existsSync(p)) { configPath = p; break; }
163
+ }
164
+ if (!configPath) return;
165
+
166
+ const config = readFileSync(configPath, 'utf-8');
167
+
168
+ // Skip if already wired
169
+ if (config.includes('bluedither')) return;
170
+
171
+ // Add import and plugin
172
+ const importLine = `import { bluedither } from './bluedither/dev-middleware.js'\n`;
173
+ let updated = importLine + config;
174
+
175
+ // Add bluedither() to plugins array
176
+ updated = updated.replace(
177
+ /plugins:\s*\[([^\]]*)\]/,
178
+ (match, inner) => {
179
+ const trimmed = inner.trim();
180
+ if (trimmed.endsWith(',')) {
181
+ return `plugins: [${trimmed} bluedither()]`;
182
+ }
183
+ return `plugins: [${trimmed}, bluedither()]`;
184
+ }
185
+ );
186
+
187
+ writeFileSync(configPath, updated);
188
+ console.log(`Wired BlueDither plugin into ${basename(configPath)}`);
189
+ }
190
+
156
191
  async function installFromRegistry(slug, targetDir) {
157
192
  console.log(`\n Installing theme "${slug}" from marketplace...\n`);
158
193
 
@@ -221,6 +256,9 @@ async function installFromRegistry(slug, targetDir) {
221
256
  const { framework, typescript } = detectFramework(targetDir);
222
257
  console.log(` Detected framework: ${framework}${typescript ? ' + TypeScript' : ''}`);
223
258
 
259
+ // Auto-wire Vite plugin
260
+ autoWireVitePlugin(targetDir);
261
+
224
262
  const claudeDir = resolve(targetDir, '.claude', 'commands');
225
263
  mkdirSync(claudeDir, { recursive: true });
226
264
 
@@ -243,10 +281,7 @@ $ARGUMENTS
243
281
  To apply the theme, use Claude Code:
244
282
  /apply-theme [description of your site]
245
283
 
246
- To customize visually, add this to your HTML:
247
- <script src="./bluedither/bluedither-tuner-inject.js"><\/script>
248
-
249
- For auto-saving, run in a separate terminal:
250
- npx bluedither tune --save-only
284
+ The tuner panel loads automatically in dev mode.
285
+ Click "Commit Changes" to save tweaks to tokens.json.
251
286
  `);
252
287
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bluedither",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "A bold, dithered-shader hero theme for Claude Code — skill + fine-tuner",
5
5
  "type": "module",
6
6
  "bin": {