mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-12-11 00:21:24 +01:00
fix(cli): changes to templates/docker, should run all affected tests
This commit is contained in:
@@ -5,7 +5,6 @@ import { replaceInFile } from 'replace-in-file'
|
||||
import date from 'date-and-time'
|
||||
|
||||
import { copyDirectory } from '../utils/copyDirectory'
|
||||
import { isExistingPath } from '../utils/isExistingPath'
|
||||
|
||||
const TEMPLATE_PATH = path.join(__dirname, '..', '..', 'templates')
|
||||
const TEMPLATE_DOCKER_PATH = path.join(TEMPLATE_PATH, 'docker')
|
||||
@@ -94,9 +93,14 @@ class Template {
|
||||
})
|
||||
}
|
||||
|
||||
public async getProgrammingLanguages (): Promise<string[]> {
|
||||
const languages = await fs.promises.readdir(TEMPLATE_SOLUTION_PATH)
|
||||
return languages.filter(language => language !== 'base')
|
||||
}
|
||||
|
||||
public async verifySupportedProgrammingLanguage (language: string): Promise<void> {
|
||||
const templateLanguagePath = path.join(TEMPLATE_SOLUTION_PATH, language)
|
||||
if (!(await isExistingPath(templateLanguagePath))) {
|
||||
const languages = await this.getProgrammingLanguages()
|
||||
if (!languages.includes(language)) {
|
||||
throw new Error('This programming language is not supported yet.')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user