Explicación detallada del proceso de desarrollo de andamios.

Proceso de desarrollo

  • Crear proyecto npm
  • Cree el archivo de entrada de andamios y agréguelo en la parte superior
#!/usr/bin/env/ node
  • Configure package.json y agregue el atributo bin
  • Escribir código de andamio
  • Publicar el andamio en npm

manual

  • instalar andamios
npm install -g your-own-cli
  • Utilice andamios
your-own-cli

Análisis de las dificultades en el desarrollo de andamios

  • Subcontratación: dividir un sistema complejo en varios módulos
  • Registro de comando:
vue create
vue add
vue invoke
  • Análisis de parámetros
vue command [options] <params>
  • El nombre completo de las opciones: –version, –help

  • abreviatura de opciones: -V, -h

  • Opciones con parámetros: --path /Users/sam/Desktop/vue-test

  • Documento de ayuda:
    ayuda global: Comandos de opciones
    de uso Ejemplo: información de ayuda para vue


Options:
  -V, --version                              output the version number
  -h, --help                                 display help for command

Commands:
  create [options] <app-name>                create a new project powered by vue-cli-service
  add [options] <plugin> [pluginOptions]     install a plugin and invoke its generator in an already created project
  invoke [options] <plugin> [pluginOptions]  invoke the generator of a plugin in an already created project
  inspect [options] [paths...]               inspect the webpack config in a project with vue-cli-service
  serve                                      alias of "npm run serve" in the current project
  build                                      alias of "npm run build" in the current project
  ui [options]                               start and open the vue-cli ui
  init [options] <template> <app-name>       generate a project from a remote template (legacy API, requires
                                             @vue/cli-init)
  config [options] [value]                   inspect and modify the config
  outdated [options]                         (experimental) check for outdated vue cli service / plugins
  upgrade [options] [plugin-name]            (experimental) upgrade vue cli service / plugins
  migrate [options] [plugin-name]            (experimental) run migrator for an already-installed cli plugin
  info                                       print debugging information about your environment
  help [command]                             display help for command

  Run vue <command> --help for detailed usage of given command.
  • comando ayuda Opciones
    de uso vue crear información de ayuda:

Usage: vue create [options] <app-name>

create a new project powered by vue-cli-service

Options:
  -p, --preset <presetName>       Skip prompts and use saved or remote preset
  -d, --default                   Skip prompts and use default preset
  -i, --inlinePreset <json>       Skip prompts and use inline JSON string as preset
  -m, --packageManager <command>  Use specified npm client when installing dependencies
  -r, --registry <url>            Use specified npm registry when installing dependencies (only for npm)
  -g, --git [message]             Force git initialization with initial commit message
  -n, --no-git                    Skip git initialization
  -f, --force                     Overwrite target directory if it exists
  --merge                         Merge target directory if it exists
  -c, --clone                     Use git clone when fetching remote preset
  -x, --proxy <proxyUrl>          Use specified proxy when creating project
  -b, --bare                      Scaffold project without beginner instructions
  --skipGetStarted                Skip displaying "Get started" instructions
  -h, --help                      display help for command

Hay muchos más, como por ejemplo:

  • Interacción de línea de comando
  • Impresión de registros
  • El texto de la línea de comando cambia de color
  • Comunicación de red: HTTP/WebSocket
  • Procesamiento de archivos
    , etc.

Supongo que te gusta

Origin blog.csdn.net/bus_lupe/article/details/133394712
Recomendado
Clasificación