Conversation
|
|
| ); | ||
| } | ||
|
|
||
| function dirname(filePath: string): string { |
There was a problem hiding this comment.
The dirname function is already available in node:path
|
|
||
| async action() { | ||
| const {output, langs, defaultLang, name, header} = this.config; | ||
| const lang = defaultLang || langs[0]; |
There was a problem hiding this comment.
If you pass --langs ru --default-lang en, then .yfm will write lang: en, even though en is not in langs. You need to check:
if (defaultLang && !langs.includes(defaultLang)) {
throw new Error(`--default-lang "${defaultLang}" is not in --langs [${langs.join(', ')}]`);
}
| export function yfmConfig(langs: string[], defaultLang: string): string { | ||
| if (langs.length > 1) { | ||
| const langList = langs.map((l) => `'${l}'`).join(', '); | ||
| return `lang: ${defaultLang}\nlangs: [${langList}]\n`; |
There was a problem hiding this comment.
a comment with a link to documentation for only one language?
| header: boolean; | ||
| }; | ||
|
|
||
| export type InitConfig = BaseConfig & { |
There was a problem hiding this comment.
Are InitArgs and InitConfig the same types?
| header: boolean; | ||
| }; | ||
|
|
||
| @withConfigDefaults(() => ({ |
There was a problem hiding this comment.
default ru? have we had this somewhere before? if not, it's better to en
| return `lang: ${defaultLang}\nlangs: [${langList}]\n`; | ||
| } | ||
|
|
||
| return `# YFM project config\n# Docs: https://diplodoc.com/docs/ru/project/config\n\nlang: ${defaultLang}\n`; |
There was a problem hiding this comment.
a link to the ru doc?



An init command has been added to yfm, allowing you to create an empty documentation template.