MCPcopy Create free account
hub / github.com/formkit/formkit / createApp

Function createApp

packages/cli/src/createApp.ts:163–309  ·  view source on GitHub ↗
(
  appName?: string,
  options: Partial<CreateAppOptions> = {}
)

Source from the content-addressed store, hash-verified

161}
162
163export async function createApp(
164 appName?: string,
165 options: Partial<CreateAppOptions> = {}
166): Promise<void> {
167 if (!appName) {
168 const res = await prompts({
169 type: 'text',
170 name: 'name',
171 message: 'Please enter a directory name for the project:',
172 initial: 'formkit-app',
173 })
174 appName = res.name as string
175 }
176
177 const isEmpty = await isDirEmpty(resolve(cwd(), `./${appName}`))
178 if (!isEmpty) {
179 error('Directory is not empty. Please choose a different name.')
180 }
181
182 if (!options.framework) {
183 const res = await prompts({
184 type: 'select',
185 name: 'framework',
186 message: 'What framework would you like to use?',
187 choices: [
188 { title: 'Vite', value: 'vite' },
189 { title: 'Nuxt', value: 'nuxt' },
190 ],
191 initial: 1,
192 })
193 options.framework = res.framework as 'vite' | 'nuxt'
194 }
195
196 if (!options.lang && options.framework === 'vite') {
197 const res = await prompts({
198 type: 'select',
199 name: 'lang',
200 message: 'What language should be used?',
201 choices: [
202 { title: 'TypeScript', value: 'ts' },
203 { title: 'JavaScript', value: 'js' },
204 ],
205 initial: 1,
206 })
207 options.lang = res.lang as 'ts' | 'js'
208 }
209
210 if (!options.pro) {
211 const res = await prompts([
212 {
213 type: 'toggle',
214 name: 'install_pro',
215 message: 'Would you like to install FormKit Pro?',
216 active: 'yes',
217 initial: true,
218 inactive: 'no',
219 },
220 ])

Callers 3

main.jsFile · 0.85
main.tsFile · 0.85
setupFunction · 0.85

Calls 12

isDirEmptyFunction · 0.90
errorFunction · 0.90
greenFunction · 0.90
infoFunction · 0.90
selectProProjectFunction · 0.85
downloadThemeFunction · 0.85
setupViteConfigFunction · 0.85
addInitialAppFunction · 0.85
buildFormKitConfigFunction · 0.85
buildMainFunction · 0.85
setupNuxtConfigFunction · 0.85
addDependencyFunction · 0.70

Tested by

no test coverage detected