Nantes Université

Skip to content
Extraits de code Groupes Projets

feat(config-generation): generate config files for commands' options and arguments

Fusionnées Malo GRALL a demandé de fusionner 32-generate-config vers 24-use-config
17 fichiers
+ 298
39
Comparer les modifications
  • Côte à côte
  • En ligne
Fichiers
17
import { existsSync, readdirSync } from "fs"
import { join, resolve } from "path"
import chalk from 'chalk'
import * as chalk from 'chalk'
import { Problem } from "@evalassist/evalassist-lib/dist/core/exceptions"
export function projectsPaths(pathFrag = '', recursive = false): string[] {
export function projectsPaths (pathFrag = '', recursive = false): string[] {
const basePath = resolve(process.cwd(), pathFrag || '')
const isProject = (x: string) => existsSync(join(x, '.evalassist'))
@@ -31,13 +31,15 @@ export function projectsPaths(pathFrag = '', recursive = false): string[] {
}
export async function forEachProject(projectsPaths: string[],
action: (projectPath: string, opts? :{[key:string]:any},dockerOpts?:any) => any,
throwOnError = false) {
export async function forEachProject (projectsPaths: string[],
action: (projectPath: string, opts?: { [key: string]: any }, dockerOpts?: any) => any,
throwOnError = false) {
for (const projectPath of projectsPaths) {
const current: number = projectsPaths.indexOf(projectPath) + 1
// eslint-disable-next-line no-console
console.log(chalk.blue(`Project ${current}/${projectsPaths.length}${projectPath}`))
// eslint-disable-next-line no-console
console.group();
try {
await action(projectPath)
@@ -45,9 +47,11 @@ export async function forEachProject(projectsPaths: string[],
if (throwOnError) {
throw e
} else {
// eslint-disable-next-line no-console
console.error(chalk.red(`ERROR: ${e.message ? e.message : e}`))
}
} finally {
// eslint-disable-next-line no-console
console.groupEnd();
}
}
Chargement en cours