1
0
mirror of synced 2025-11-09 13:27:27 +00:00

refactor(CLI): modularize more, test more

This commit is contained in:
Jason Dreyzehner
2018-03-11 00:00:24 -05:00
parent e406917ff8
commit a0541f9f9b
14 changed files with 877 additions and 445 deletions

View File

@@ -1,11 +1,11 @@
import { prompt, Question } from 'inquirer';
import { Runner, TypescriptStarterOptions, validateName } from './primitives';
import { Runner, TypescriptStarterUserOptions, validateName } from './utils';
export async function inquire(): Promise<TypescriptStarterOptions> {
export async function inquire(): Promise<TypescriptStarterUserOptions> {
const packageNameQuestion: Question = {
filter: (answer: string) => answer.trim(),
message: 'Enter the new package name:',
name: 'name',
name: 'projectName',
type: 'input',
validate: validateName
};
@@ -81,10 +81,10 @@ export async function inquire(): Promise<TypescriptStarterOptions> {
runnerQuestion,
typeDefsQuestion
]).then(answers => {
const { definitions, description, name, runner } = answers as {
const { definitions, description, projectName, runner } = answers as {
readonly definitions?: TypeDefinitions;
readonly description: string;
readonly name: string;
readonly projectName: string;
readonly runner: Runner;
};
return {
@@ -95,12 +95,12 @@ export async function inquire(): Promise<TypescriptStarterOptions> {
)
: false,
install: true,
name,
nodeDefinitions: definitions
? [TypeDefinitions.Node, TypeDefinitions.NodeAndDOM].includes(
definitions
)
: false,
projectName,
runner
};
});