(config: GlobalConfig)
| 37 | * Save global configuration to ~/.config/tianji/config.json |
| 38 | */ |
| 39 | export async function saveGlobalConfig(config: GlobalConfig): Promise<void> { |
| 40 | try { |
| 41 | await fs.ensureDir(GLOBAL_CONFIG_DIR); |
| 42 | await fs.writeJson(GLOBAL_CONFIG_PATH, config, { spaces: 2 }); |
| 43 | } catch (error) { |
| 44 | throw new Error(`Failed to save global config: ${error}`); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Load project configuration from .tianjirc in current directory |