mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
29 lines
710 B
TypeScript
29 lines
710 B
TypeScript
import { prompt } from 'inquirer';
|
|
import { challengeTypes } from '../../../shared-dist/config/challenge-types.js';
|
|
|
|
const taskChallenges = [
|
|
challengeTypes.multipleChoice,
|
|
challengeTypes.fillInTheBlank,
|
|
challengeTypes.generic
|
|
];
|
|
|
|
export const newTaskPrompts = async (): Promise<{
|
|
challengeType: string;
|
|
}> => {
|
|
const challengeType = await prompt<{ value: string }>({
|
|
name: 'value',
|
|
message: 'What type of task challenge is this?',
|
|
type: 'list',
|
|
choices: Object.entries(challengeTypes)
|
|
.filter(entry => taskChallenges.includes(entry[1]))
|
|
.map(([key, value]) => ({
|
|
name: key,
|
|
value
|
|
}))
|
|
});
|
|
|
|
return {
|
|
challengeType: challengeType.value
|
|
};
|
|
};
|