Home / File/ index.ts — vite Source File

index.ts — vite Source File

Architecture documentation for index.ts, a typescript file in the vite codebase. 9 imports, 0 dependents.

File typescript ProjectScaffolder CLIPrompts 9 imports 22 functions

Entity Profile

Dependency Diagram

graph LR
  ebed723b_f143_390f_439d_dfaa680d6d16["index.ts"]
  e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> e6032fbc_44cf_58d6_868d_dd15106c18c5
  51e96894_3556_ed5c_1ede_97d449867adf["node:path"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> 51e96894_3556_ed5c_1ede_97d449867adf
  6feed3e8_55b8_cce7_b5ef_e40b872585f7["node:url"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> 6feed3e8_55b8_cce7_b5ef_e40b872585f7
  2dd48a01_733b_e717_9c4b_f4fe7eb42567["node:child_process"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> 2dd48a01_733b_e717_9c4b_f4fe7eb42567
  4b6c8853_2812_b8f0_6998_2e15bbc9c835["cross-spawn"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> 4b6c8853_2812_b8f0_6998_2e15bbc9c835
  700bf11b_14a9_563d_6345_96e4a5732aea["mri"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> 700bf11b_14a9_563d_6345_96e4a5732aea
  30b15026_0cb0_ef93_d1ef_4f106966e6f4["prompts"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> 30b15026_0cb0_ef93_d1ef_4f106966e6f4
  bff4f846_ab01_b5ba_74d4_c1608e434d2c["picocolors"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> bff4f846_ab01_b5ba_74d4_c1608e434d2c
  8cbc4a05_1962_56e1_7bec_88e944320eaa["detect-agent"]
  ebed723b_f143_390f_439d_dfaa680d6d16 --> 8cbc4a05_1962_56e1_7bec_88e944320eaa
  style ebed723b_f143_390f_439d_dfaa680d6d16 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import type { SpawnOptions } from 'node:child_process'
import spawn from 'cross-spawn'
import mri from 'mri'
import * as prompts from '@clack/prompts'
import colors from 'picocolors'
import { determineAgent } from '@vercel/detect-agent'

const {
  blue,
  blueBright,
  cyan,
  green,
  greenBright,
  magenta,
  red,
  redBright,
  reset,
  underline,
  yellow,
} = colors

const argv = mri<{
  template?: string
  help?: boolean
  overwrite?: boolean
  immediate?: boolean
  interactive?: boolean
}>(process.argv.slice(2), {
  boolean: ['help', 'overwrite', 'immediate', 'interactive'],
  alias: { h: 'help', t: 'template', i: 'immediate' },
  string: ['template'],
})
const cwd = process.cwd()

// prettier-ignore
const helpMessage = `\
Usage: create-vite [OPTION]... [DIRECTORY]

Create a new Vite project in JavaScript or TypeScript.
When running in TTY, the CLI will start in interactive mode.

Options:
  -t, --template NAME                   use a specific template
  -i, --immediate                       install dependencies and start dev
  --interactive / --no-interactive      force interactive / non-interactive mode

Available templates:
${yellow    ('vanilla-ts          vanilla'       )}
${green     ('vue-ts              vue'           )}
${cyan      ('react-ts            react'         )}
${cyan      ('react-compiler-ts   react-compiler')}
${cyan      ('react-swc-ts        react-swc'     )}
${magenta   ('preact-ts           preact'        )}
${redBright ('lit-ts              lit'           )}
${red       ('svelte-ts           svelte'        )}
${blue      ('solid-ts            solid'         )}
${blueBright('qwik-ts             qwik'          )}`
// ... (890 more lines)

Subdomains

Dependencies

  • cross-spawn
  • detect-agent
  • mri
  • node:child_process
  • node:fs
  • node:path
  • node:url
  • picocolors
  • prompts

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the vite codebase, written in typescript. It belongs to the ProjectScaffolder domain, CLIPrompts subdomain.
What functions are defined in index.ts?
index.ts defines 22 function(s): TEMPLATES, copy, copyDir, editFile, emptyDir, formatTargetDir, getFullCustomCommand, getInstallCommand, getLabel, getRunCommand, and 12 more.
What does index.ts depend on?
index.ts imports 9 module(s): cross-spawn, detect-agent, mri, node:child_process, node:fs, node:path, node:url, picocolors, and 1 more.
Where is index.ts in the architecture?
index.ts is located at packages/create-vite/src/index.ts (domain: ProjectScaffolder, subdomain: CLIPrompts, directory: packages/create-vite/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free