-
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.
- Loading branch information
1 parent
4b15217
commit 922c855
Showing
11 changed files
with
1,304 additions
and
264 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { readFileSync, existsSync } from 'fs'; | ||
import yaml from 'js-yaml'; | ||
import chalk from 'chalk'; | ||
|
||
export default async function loadBookConfig(bookPath) { | ||
const bookConfigPath = bookPath; | ||
|
||
if (!existsSync(bookConfigPath)) { | ||
console.error(chalk.red('book.config.yml not found in the current working directory.')); | ||
process.exit(1); | ||
} | ||
|
||
try { | ||
const bookConfig = yaml.load(readFileSync(bookConfigPath, 'utf8')); | ||
return bookConfig; | ||
} catch (error) { | ||
console.error(chalk.redBright('Error loading book.config.yml:'), chalk.redBright(error)); | ||
process.exit(1); | ||
} | ||
} |
Oops, something went wrong.