bluedither 1.0.8 → 1.0.10
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/publish.js +11 -0
- package/fine-tuner/server.js +20 -2
- package/package.json +1 -1
package/cli/commands/publish.js
CHANGED
|
@@ -195,6 +195,16 @@ export default async function publish(args) {
|
|
|
195
195
|
console.log('\nStep 8: Publishing theme...');
|
|
196
196
|
const tokens = JSON.parse(readFileSync(resolve(dir, config.tokens), 'utf-8'));
|
|
197
197
|
|
|
198
|
+
// Read template HTML if available
|
|
199
|
+
let templateHtml = null;
|
|
200
|
+
for (const tmplPath of ['template/index.html', 'theme/template/index.html']) {
|
|
201
|
+
const full = resolve(dir, tmplPath);
|
|
202
|
+
if (existsSync(full)) {
|
|
203
|
+
templateHtml = readFileSync(full, 'utf-8');
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
198
208
|
const theme = await publishTheme({
|
|
199
209
|
name: config.name,
|
|
200
210
|
slug,
|
|
@@ -202,6 +212,7 @@ export default async function publish(args) {
|
|
|
202
212
|
tokens_json: tokens,
|
|
203
213
|
package_path: packagePath,
|
|
204
214
|
screenshot_url: screenshotUrl,
|
|
215
|
+
template_html: templateHtml,
|
|
205
216
|
}, creds.access_token);
|
|
206
217
|
|
|
207
218
|
console.log(`
|
package/fine-tuner/server.js
CHANGED
|
@@ -276,8 +276,26 @@ const server = createServer((req, res) => {
|
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
-
server.
|
|
280
|
-
|
|
279
|
+
server.on('error', (err) => {
|
|
280
|
+
if (err.code === 'EADDRINUSE') {
|
|
281
|
+
const nextPort = server._bdPort + 1;
|
|
282
|
+
if (nextPort > PORT + 20) {
|
|
283
|
+
console.error(`\n ✗ Could not find an available port (tried ${PORT}–${nextPort - 1}).\n`);
|
|
284
|
+
process.exit(1);
|
|
285
|
+
}
|
|
286
|
+
server._bdPort = nextPort;
|
|
287
|
+
server.listen(nextPort);
|
|
288
|
+
} else {
|
|
289
|
+
throw err;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
server.on('listening', () => {
|
|
294
|
+
const actualPort = server.address().port;
|
|
295
|
+
console.log(`\n BlueDither Fine-Tuner running at http://localhost:${actualPort}\n`);
|
|
281
296
|
console.log(` Tokens: ${TOKENS_PATH}`);
|
|
282
297
|
console.log(` Edit in browser → hit Commit → tokens.json updated on disk.\n`);
|
|
283
298
|
});
|
|
299
|
+
|
|
300
|
+
server._bdPort = PORT;
|
|
301
|
+
server.listen(PORT);
|