From a777583408f559f5e58f7f3ea53a6af857daee7c Mon Sep 17 00:00:00 2001 From: Andreas Lundqvist Date: Fri, 30 Sep 2022 16:53:34 +0200 Subject: [PATCH] clean up --- src/constants.ts | 35 --------------------------------- src/prompts/create/constants.ts | 35 +++++++++++++++++++++++++++++++++ src/prompts/create/handlers.ts | 2 +- src/prompts/create/index.ts | 3 +-- src/types.ts | 1 + 5 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 src/prompts/create/constants.ts diff --git a/src/constants.ts b/src/constants.ts index 16b24fee9..903cfd50a 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,38 +1,3 @@ -// https://github.com/marvinhagemeister/kolorist/blob/main/src/index.ts -import { blue, yellow, red, green } from 'kolorist'; - -import * as types from './types'; - -export const TEMPLATES_DIRECTORY = `${__dirname}/templates`; export const RENAMABLE_FILES_MAP: { [key: string]: string } = { _gitignore: '.gitignore', }; - -export const TEMPLATES: types.Template[] = [ - { - name: 'react', - color: yellow, - variants: [ - { - color: yellow, - name: 'react', - display: 'React JavaScript', - }, - { - color: blue, - name: 'react-ts', - display: 'React TypeScript', - }, - { - color: red, - name: 'vite-vanilla', - display: 'Vite JavaScript', - }, - { - color: green, - name: 'koa-ts', - display: 'Koa Typescript', - }, - ], - }, -]; diff --git a/src/prompts/create/constants.ts b/src/prompts/create/constants.ts new file mode 100644 index 000000000..d910c33b6 --- /dev/null +++ b/src/prompts/create/constants.ts @@ -0,0 +1,35 @@ +// https://github.com/marvinhagemeister/kolorist/blob/main/src/index.ts +import { blue, yellow, red, green } from 'kolorist'; + +import * as types from '../../types'; + +export const TEMPLATES_DIRECTORY = `${__dirname}/templates`; + +export const TEMPLATES: Array = [ + { + name: 'react', + color: yellow, + variants: [ + { + color: yellow, + name: 'react', + display: 'React JavaScript', + }, + { + color: blue, + name: 'react-ts', + display: 'React TypeScript', + }, + { + color: red, + name: 'vite-vanilla', + display: 'Vite JavaScript', + }, + { + color: green, + name: 'koa-ts', + display: 'Koa Typescript', + }, + ], + }, +]; diff --git a/src/prompts/create/handlers.ts b/src/prompts/create/handlers.ts index 39ef023c6..bf4fc3b2c 100644 --- a/src/prompts/create/handlers.ts +++ b/src/prompts/create/handlers.ts @@ -6,7 +6,7 @@ import { lightGreen } from 'kolorist'; import * as helpers from '../../helpers'; import * as utils from '../../utils'; -import { TEMPLATES_DIRECTORY } from '../../constants'; +import { TEMPLATES_DIRECTORY } from './constants'; const cwd = process.cwd(); diff --git a/src/prompts/create/index.ts b/src/prompts/create/index.ts index 8bc361d9d..b222c9ae3 100644 --- a/src/prompts/create/index.ts +++ b/src/prompts/create/index.ts @@ -1,9 +1,8 @@ import p from 'prompts'; -import fs from 'fs'; import { reset } from 'kolorist'; import * as utils from '../../utils'; -import { TEMPLATES } from '../../constants'; +import { TEMPLATES } from './constants'; import { makeTemplate } from './handlers'; export const create = () => p(steps).then(makeTemplate); diff --git a/src/types.ts b/src/types.ts index 1494d92bf..78a85c647 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,5 @@ import p from 'prompts'; + export type Template = { name: string; color: (color: string | number) => string;