Sync one file to multiple destinations.
npm install @filesync/mirrorsSync one file to multiple destinations.
``bash`
npm install @filesync/mirrors
`bashSync files based on config
npx @filesync/mirrors
Configuration
Create
filesync.config.json in your project root:`json
{
"mirrors": [
{
"source": "**/README.ai.md",
"targets": ["AGENTS.md", ".github/copilot-instructions.md"]
}
]
}
`$3
- source: Glob pattern to find source files
- targets: Array of relative paths for mirror destinations (relative to each source file's directory)
$3
- If
--config is not provided, the CLI searches for filesync.config.json from the invocation directory upward.
- Syncing is always scoped to the invocation directory and below, even if the config file is found higher up.
- If no config is found, the CLI exits with a non-zero status and prints an error.Programmatic API
`typescript
import { syncMirrors } from "@filesync/mirrors";const results = await syncMirrors({
config: {
mirrors: [
{
source: "**/README.ai.md",
targets: ["AGENTS.md"],
},
],
},
dryRun: false,
});
`Exit Codes
-
0: Success (or no changes in --check mode)
- 1: Files out of sync (in --check` mode)