Home / File/ index.ts — tailwindcss Source File

index.ts — tailwindcss Source File

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

File typescript CommandLineInterface Renderer 9 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  e757210f_6e73_5a13_a52e_f9675256ec53["index.ts"]
  fa5b7a74_b00e_9eb4_ab63_8b8413ceff3b["args.ts"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> fa5b7a74_b00e_9eb4_ab63_8b8413ceff3b
  8b37c683_f96f_08af_9c68_92efbcae38b7["Arg"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> 8b37c683_f96f_08af_9c68_92efbcae38b7
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277["renderer.ts"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277
  d51344bd_5caa_9aed_19fd_55a5425e524b["header"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> d51344bd_5caa_9aed_19fd_55a5425e524b
  d3ccc5ce_e370_63df_a97d_a2f004fd83ca["highlight"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> d3ccc5ce_e370_63df_a97d_a2f004fd83ca
  bc8f7bac_f1dc_50a4_9353_2ff3d403d524["indent"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> bc8f7bac_f1dc_50a4_9353_2ff3d403d524
  cba5c7c8_f044_d5aa_baf9_2a68fd6d7294["println"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> cba5c7c8_f044_d5aa_baf9_2a68fd6d7294
  c31510dc_31ef_7448_58a7_0d6f18e31e8d["wordWrap"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> c31510dc_31ef_7448_58a7_0d6f18e31e8d
  5e3a9e1b_c7c3_9356_dd16_9834c49660ab["picocolors"]
  e757210f_6e73_5a13_a52e_f9675256ec53 --> 5e3a9e1b_c7c3_9356_dd16_9834c49660ab
  f3e20782_7a7a_6d07_0472_a959db30007c["index.ts"]
  f3e20782_7a7a_6d07_0472_a959db30007c --> e757210f_6e73_5a13_a52e_f9675256ec53
  style e757210f_6e73_5a13_a52e_f9675256ec53 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import pc from 'picocolors'
import type { Arg } from '../../utils/args'
import { UI, header, highlight, indent, println, wordWrap } from '../../utils/renderer'

export function help({
  invalid,
  usage,
  options,
}: {
  invalid?: string
  usage?: string[]
  options?: Arg
}) {
  // Available terminal width
  let width = process.stdout.columns

  // Render header
  println(header())

  // Render the invalid command
  if (invalid) {
    println()
    println(`${pc.dim('Invalid command:')} ${invalid}`)
  }

  // Render usage
  if (usage && usage.length > 0) {
    println()
    println(pc.dim('Usage:'))
    for (let [idx, example] of usage.entries()) {
      // Split the usage example into the command and its options. This allows
      // us to wrap the options based on the available width of the terminal.
      let command = example.slice(0, example.indexOf('['))
      let options = example.slice(example.indexOf('['))

      // Make the options dimmed, to make them stand out less than the command
      // itself.
      options = options.replace(/\[.*?\]/g, (option) => pc.dim(option))

      // The space between the command and the options.
      let space = 1

      // Wrap the options based on the available width of the terminal.
      let lines = wordWrap(options, width - UI.indent - command.length - space)

      // Print an empty line between the usage examples if we need to split due
      // to width constraints. This ensures that the usage examples are visually
      // separated.
      //
      // E.g.: when enough space is available
      //
      // ```
      //   Usage:
      //     tailwindcss build [--input input.css] [--output output.css] [--watch] [options...]
      //     tailwindcss other [--watch] [options...]
      // ```
      //
      // E.g.: when not enough space is available
      //
      // ```
// ... (111 more lines)

Subdomains

Functions

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the CommandLineInterface domain, Renderer subdomain.
What functions are defined in index.ts?
index.ts defines 1 function(s): help.
What does index.ts depend on?
index.ts imports 9 module(s): Arg, args.ts, header, highlight, indent, picocolors, println, renderer.ts, and 1 more.
What files import index.ts?
index.ts is imported by 1 file(s): index.ts.
Where is index.ts in the architecture?
index.ts is located at packages/@tailwindcss-upgrade/src/commands/help/index.ts (domain: CommandLineInterface, subdomain: Renderer, directory: packages/@tailwindcss-upgrade/src/commands/help).

Analyze Your Own Codebase

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

Try Supermodel Free