koguma 2.3.5 → 2.3.7
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/index.ts +19 -0
- package/package.json +1 -1
- package/src/admin/_bundle.ts +1 -1
package/cli/index.ts
CHANGED
|
@@ -521,6 +521,25 @@ async function cmdDev(): Promise<void> {
|
|
|
521
521
|
try {
|
|
522
522
|
const config = await loadSiteConfig(root);
|
|
523
523
|
devSync = startDevSync(root, dbName, config.contentTypes, { silent: true });
|
|
524
|
+
|
|
525
|
+
// Inject KOGUMA_DEV_SYNC into .dev.vars so the workerd runtime
|
|
526
|
+
// (which doesn't inherit process env) can access it via c.env.
|
|
527
|
+
const devVarsPath = resolve(root, KOGUMA_DIR, '.dev.vars');
|
|
528
|
+
let existing = '';
|
|
529
|
+
if (existsSync(devVarsPath)) {
|
|
530
|
+
existing = readFileSync(devVarsPath, 'utf-8');
|
|
531
|
+
}
|
|
532
|
+
// Remove any stale KOGUMA_DEV_SYNC line, then append the fresh one
|
|
533
|
+
const cleaned = existing
|
|
534
|
+
.split('\n')
|
|
535
|
+
.filter(l => !l.startsWith('KOGUMA_DEV_SYNC='))
|
|
536
|
+
.join('\n')
|
|
537
|
+
.replace(/\n+$/, '');
|
|
538
|
+
const newContent = cleaned
|
|
539
|
+
? `${cleaned}\nKOGUMA_DEV_SYNC=${devSync.syncUrl}\n`
|
|
540
|
+
: `KOGUMA_DEV_SYNC=${devSync.syncUrl}\n`;
|
|
541
|
+
writeFileSync(devVarsPath, newContent);
|
|
542
|
+
|
|
524
543
|
sDevSync.stop('Dev sync active (file watcher + sync server)');
|
|
525
544
|
} catch (e) {
|
|
526
545
|
sDevSync.stop('Dev sync failed');
|