1
0
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-12-11 00:21:24 +01:00

feat(cli): add --all option to run test command

This commit is contained in:
Divlo
2021-10-13 21:43:45 +02:00
parent aeff95e691
commit 0a27b9e1a1
47 changed files with 1657 additions and 1773 deletions

View File

@@ -73,9 +73,7 @@ class Template {
public async solution (options: TemplateSolutionOptions): Promise<void> {
const { destination, githubUser, name, challengeName, programmingLanguageName } = options
const templateLanguagePath = path.join(TEMPLATE_SOLUTION_PATH, programmingLanguageName)
if (!(await isExistingPath(templateLanguagePath))) {
throw new Error('This programming language is not supported yet.')
}
await this.verifySupportedProgrammingLanguage(programmingLanguageName)
await fs.promises.mkdir(destination, { recursive: true })
await copyDirectory(templateLanguagePath, destination)
await copyDirectory(TEMPLATE_SOLUTION_BASE_PATH, destination)
@@ -95,6 +93,13 @@ class Template {
destination
})
}
public async verifySupportedProgrammingLanguage (language: string): Promise<void> {
const templateLanguagePath = path.join(TEMPLATE_SOLUTION_PATH, language)
if (!(await isExistingPath(templateLanguagePath))) {
throw new Error('This programming language is not supported yet.')
}
}
}
export const template = new Template()