}
catch {};
await this._shift();
- await this._ensurePostsDirectoryExists(join(this.postsDirectory, '0'));
- await this.update(postLocation);
+ const firstDirectory = join(this.postsDirectory, '0');
+ await rm(firstDirectory, { recursive: true, force: true });
+ await this._ensurePostsDirectoryExists(firstDirectory);
+ await this._update(postLocation);
}
/**
await this.syncDown();
}
catch {};
- const metadata = await this._getMetadata();
- await this._ensurePostsDirectoryExists();
- await this._copyPost(postLocation);
- await this._writeMetadata(metadata);
-
- await this._archive(postLocation);
-
- await this.generate();
- try {
- await this.syncUp();
- }
- catch {};
+ const metadata = await this._update();
}
/**
* @instance
*/
async syncDown() {
+ internals.debuglog('Pulling remote state');
await Remote.syncDown(this.remoteConfig, this.blogDirectory)
+ internals.debuglog('Pulled remote state');
}
/**
* @instance
*/
async syncUp() {
+ internals.debuglog('Pushing remote state');
await Remote.syncUp(this.remoteConfig, this.blogDirectory)
+ internals.debuglog('Pushed remote state');
}
+ // Adds the passed path to slot 0, and generates files.
+
+ async _update(postLocation) {
+
+ const metadata = await this._getMetadata();
+ await this._ensurePostsDirectoryExists();
+ await this._copyPost(postLocation);
+ await this._writeMetadata(metadata);
+
+ await this._archive(postLocation);
+
+ await this.generate();
+ try {
+ await this.syncUp();
+ }
+ catch {};
+ }
+
+
// Parses Gemini for each page, copies assets and generates index.
async generate() {