Skip to content

Commit 1eb73d1

Browse files
tylerjusflyIfycode
authored andcommitted
fix: removed white spaces and fixed a major error in template.ts
1 parent 069efe6 commit 1eb73d1

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/interfaces.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
interface TemplateQuestions {
2+
type: string;
3+
name: string;
4+
message: string;
5+
choices: string[];
6+
default: string;
7+
}

src/prompts/foldername.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const folderNameMissingOptionPrompt = async (options:any) => {
3737
if (valueMatch !== null) return value.match(/(\d+)/)?.map(Number)[0];
3838
}).filter(value => { return value !== undefined; }) as number[];
3939

40-
4140
let maxNumber = Math.max(...extractedNumbers);
4241

4342
let incrementFolderName = () => {

src/prompts/template.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import inquirer from 'inquirer';
22
import chalk from 'chalk';
33

4-
let skipPromptsModified = (options:any, defaultFolderName:string, notAmongTemplateCollection:any, defaultTemplate:string) => {
4+
let skipPromptsModified = (options: any, defaultFolderName: string, notAmongTemplateCollection: any, defaultTemplate: string) => {
55
if (notAmongTemplateCollection && (options.template !== undefined || options.template === undefined)) {
66
options.template = defaultTemplate;
77
}
@@ -17,8 +17,8 @@ let skipPromptsModified = (options:any, defaultFolderName:string, notAmongTempla
1717
return options;
1818
}
1919

20-
export const templateMissingOptionPrompt = async (options:any, folderNameAnswers:any, defaultFolderName:string) => {
21-
const templateQuestions = [];
20+
export const templateMissingOptionPrompt = async (options: any, folderNameAnswers: any, defaultFolderName: string) => {
21+
const templateQuestions: TemplateQuestions[] = [];
2222

2323
const apiTemplate = {
2424
ts: {
@@ -61,18 +61,18 @@ export const templateMissingOptionPrompt = async (options:any, folderNameAnswers
6161
});
6262
}
6363

64-
let templateAnswers:any;
64+
let templateAnswers: any;
6565

6666
if (options.skipPrompts) {
6767
options = skipPromptsModified(options, defaultFolderName, notAmongTemplateCollection, defaultTemplate);
68-
templateQuestions.template = defaultTemplate;
68+
(templateQuestions as any).template = defaultTemplate;
6969
templateAnswers = templateQuestions;
7070
}
7171

7272
if (!options.skipPrompts) templateAnswers = await inquirer.prompt(templateQuestions);
7373

7474
// Transform template name/answers back to abbrev name for cli to process it accordingly
75-
const transformTemplateName = (templateOption:any) => {
75+
const transformTemplateName = (templateOption: any) => {
7676
if (templateOption === defaultTemplate) templateAnswers.template = apiTemplate.ts.abbrev;
7777
if (templateOption === esmTemplate) templateAnswers.template = apiTemplate.esm.abbrev;
7878
if (templateOption === cjsTemplate) templateAnswers.template = apiTemplate.cjs.abbrev;

0 commit comments

Comments
 (0)