File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/create/src/utils Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -99,4 +99,16 @@ export function getTemplatesList(projectType: ProjectType) {
9999 return VANILLA_TEMPLATES as VanillaTemplate [ ] ;
100100}
101101
102- //
102+ /**
103+ * Tests is the template given is a valid template, and returns it as a template if it is
104+ * @param type expected type of the template
105+ * @param maybe_template the template string to test
106+ * @returns the template string if it is valid, undefined if not
107+ */
108+ export function isValidTemplate ( type : "vanilla" , maybe_template : string ) : VanillaTemplate ;
109+ export function isValidTemplate ( type : "start" , maybe_template : string ) : StartTemplate ;
110+ export function isValidTemplate ( type : "library" , maybe_template : string ) : LibraryTemplate ;
111+ export function isValidTemplate ( type : ProjectType , maybe_template : string ) {
112+ const templates = getTemplatesList ( type ) ;
113+ return templates . find ( t => t === maybe_template )
114+ }
You can’t perform that action at this time.
0 commit comments