@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.
Files changed (3) hide show
  1. package/config.js +8 -0
  2. package/package.json +1 -1
  3. 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubling/compound-sync",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Bidirectional sync between Compound and local markdown files",
5
5
  "type": "module",
6
6
  "bin": {
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
- const onDisk = { projectId, orgs: orgEntries };
360
- fs.writeFileSync(CONFIG_PATH, JSON.stringify(onDisk, null, 2) + '\n');
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('');