-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(contented): QOL cleanup for
contented-pipeline-md
(#541)
<!-- Thanks for sending a pull request! --> #### What this PR does / why we need it: Clean up `contented-pipeline-md` so that downstream extending on top of this pipeline have an easier time working with files.
- Loading branch information
Showing
13 changed files
with
119 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
import { ContentedProcessor } from '@contentedjs/contented-processor'; | ||
import { Option } from 'clipanion'; | ||
|
||
import { BaseCommand } from './BaseCommand.js'; | ||
import { ContentedWalker } from './contented/ContentedWalker.js'; | ||
import { ContentedWatcher } from './contented/ContentedWatcher.js'; | ||
|
||
/** | ||
* `contented build` the dist | ||
*/ | ||
export class BuildCommand extends BaseCommand { | ||
static paths = [[`build`]]; | ||
|
||
watch = Option.Boolean(`--watch`, false); | ||
|
||
async execute() { | ||
const config = await this.loadConfig(); | ||
config.processor.outDir = config.processor.outDir ?? './dist'; | ||
|
||
const processor = new ContentedProcessor(config.processor); | ||
const walker = new ContentedWalker(processor); | ||
await walker.walk(); | ||
|
||
if (this.watch) { | ||
const watcher = new ContentedWatcher(processor); | ||
await watcher.watch(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,40 @@ | ||
import { ContentedProcessor } from '@contentedjs/contented-processor'; | ||
import { Option } from 'clipanion'; | ||
|
||
import { BaseCommand } from './BaseCommand.js'; | ||
import { ContentedPreview } from './contented/ContentedPreview.js'; | ||
import { ContentedWalker } from './contented/ContentedWalker.js'; | ||
import { ContentedWatcher } from './contented/ContentedWatcher.js'; | ||
|
||
/** | ||
* `contented generate` the preview website | ||
*/ | ||
export class GenerateCommand extends BaseCommand { | ||
static paths = [[`generate`]]; | ||
|
||
watch = Option.Boolean(`--watch`, false); | ||
|
||
async execute() { | ||
const config = await this.loadConfig(); | ||
config.processor.outDir = config.processor.outDir ?? '.contented'; | ||
|
||
const processor = new ContentedProcessor(config.processor); | ||
const walker = new ContentedWalker(processor); | ||
await walker.walk(); | ||
|
||
if (this.watch) { | ||
const watcher = new ContentedWatcher(processor); | ||
await watcher.watch(); | ||
} | ||
|
||
const preview = new ContentedPreview(config.preview); | ||
await preview.init(); | ||
await preview.install(); | ||
await preview.generate(); | ||
|
||
if (this.watch) { | ||
await preview.write(); | ||
} else { | ||
await preview.generate(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters