@doubling/compound-sync 1.4.0 → 1.4.1
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/config.js +8 -0
- package/package.json +1 -1
- package/sync.js +4 -4
package/config.js
CHANGED
|
@@ -93,3 +93,11 @@ export function loadConfig(absPath) {
|
|
|
93
93
|
const raw = JSON.parse(fs.readFileSync(absPath, 'utf-8'));
|
|
94
94
|
return normalizeConfig(raw);
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
// Write a config object to disk. Creates the parent directory chain if
|
|
98
|
+
// it doesn't already exist (so callers can target paths like
|
|
99
|
+
// ~/.config/compound-sync/work.json without manual mkdir).
|
|
100
|
+
export function saveConfig(absPath, configObject) {
|
|
101
|
+
fs.mkdirSync(path.dirname(absPath), { recursive: true });
|
|
102
|
+
fs.writeFileSync(absPath, JSON.stringify(configObject, null, 2) + '\n');
|
|
103
|
+
}
|
package/package.json
CHANGED
package/sync.js
CHANGED
|
@@ -33,7 +33,7 @@ import http from 'http';
|
|
|
33
33
|
import { exec } from 'child_process';
|
|
34
34
|
import { fileURLToPath } from 'url';
|
|
35
35
|
import { pushFileToCloud, deleteFileFromCloud, readFileContent } from './dual-write.js';
|
|
36
|
-
import { resolveConfigPath, loadConfig } from './config.js';
|
|
36
|
+
import { resolveConfigPath, loadConfig, saveConfig } from './config.js';
|
|
37
37
|
import {
|
|
38
38
|
scopeFromLocalPath,
|
|
39
39
|
teamFolderName,
|
|
@@ -355,9 +355,9 @@ async function setupConfig() {
|
|
|
355
355
|
orgEntries.push({ orgId: org.id, localPath: resolvedPath });
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
// Save config (no credentials stored)
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
// Save config (no credentials stored). saveConfig creates parent dirs
|
|
359
|
+
// so paths like ~/.config/compound-sync/work.json work without manual mkdir.
|
|
360
|
+
saveConfig(CONFIG_PATH, { projectId, orgs: orgEntries });
|
|
361
361
|
console.log('');
|
|
362
362
|
console.log(`Config saved to ${CONFIG_PATH}`);
|
|
363
363
|
console.log('');
|