@@ -4,7 +4,11 @@ import GithubClient, {
44 NewTreeRequestItem ,
55 RepoContent ,
66} from "./github/client" ;
7- import MetadataStore , { FileMetadata , Metadata } from "./metadata-store" ;
7+ import MetadataStore , {
8+ FileMetadata ,
9+ Metadata ,
10+ MANIFEST_FILE_NAME ,
11+ } from "./metadata-store" ;
812import EventsListener from "./events-listener" ;
913import { GitHubSyncSettings } from "./settings/settings" ;
1014import Logger from "./logger" ;
@@ -93,7 +97,7 @@ export default class SyncManager {
9397 // So we create a the manifest file as the first commit, since we're going
9498 // to create that in any case right after this.
9599 await this . client . createFile (
96- `${ this . vault . configDir } /github-sync-metadata.json ` ,
100+ `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } ` ,
97101 "" ,
98102 "Initial commit" ,
99103 ) ;
@@ -144,7 +148,7 @@ export default class SyncManager {
144148 if (
145149 this . settings . syncConfigDir &&
146150 filePath . startsWith ( this . vault . configDir ) &&
147- filePath !== `${ this . vault . configDir } /github-sync-metadata.json `
151+ filePath !== `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } `
148152 ) {
149153 // Include files in the config dir only if the user has enabled it.
150154 // The metadata file must always be synced.
@@ -239,7 +243,7 @@ export default class SyncManager {
239243 async sync ( ) {
240244 await this . logger . info ( "Starting sync" ) ;
241245 const { files, sha : treeSha } = await this . client . getRepoContent ( ) ;
242- const manifest = files [ `${ this . vault . configDir } /github-sync-metadata.json ` ] ;
246+ const manifest = files [ `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } ` ] ;
243247
244248 if ( manifest === undefined ) {
245249 await this . logger . error ( "Remote manifest is missing" , { files, treeSha } ) ;
@@ -512,8 +516,7 @@ export default class SyncManager {
512516 return actions . filter ( ( action : SyncAction ) => {
513517 return (
514518 ! action . filePath . startsWith ( this . vault . configDir ) ||
515- action . filePath ===
516- `${ this . vault . configDir } /github-sync-metadata.json`
519+ action . filePath === `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } `
517520 ) ;
518521 } ) ;
519522 }
@@ -536,8 +539,8 @@ export default class SyncManager {
536539 this . metadataStore . save ( ) ;
537540
538541 // Update manifest in list of new tree items
539- delete treeFiles [ `${ this . vault . configDir } /github-sync-metadata.json ` ] . sha ;
540- treeFiles [ `${ this . vault . configDir } /github-sync-metadata.json ` ] . content =
542+ delete treeFiles [ `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } ` ] . sha ;
543+ treeFiles [ `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } ` ] . content =
541544 JSON . stringify ( this . metadataStore . data ) ;
542545
543546 // Create the new tree
@@ -639,9 +642,9 @@ export default class SyncManager {
639642 // Must be the first time we run, initialize the metadata store
640643 // with itself and all files in the vault.
641644 this . metadataStore . data . files [
642- `${ this . vault . configDir } /github-sync-metadata.json `
645+ `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } `
643646 ] = {
644- path : `${ this . vault . configDir } /github-sync-metadata.json ` ,
647+ path : `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } ` ,
645648 sha : null ,
646649 dirty : false ,
647650 justDownloaded : false ,
@@ -708,7 +711,7 @@ export default class SyncManager {
708711
709712 // Remove all them from the metadata store
710713 files . forEach ( ( filePath : string ) => {
711- if ( filePath === `${ this . vault . configDir } /github-sync-metadata.json ` ) {
714+ if ( filePath === `${ this . vault . configDir } /${ MANIFEST_FILE_NAME } ` ) {
712715 // We don't want to remove the metadata file even if it's in the config dir
713716 return ;
714717 }
0 commit comments