Explicação detalhada do processo de desenvolvimento de andaimes

Processo de desenvolvimento

  • Criar projeto npm
  • Crie o arquivo de entrada do andaime e adicione-o no topo
#!/usr/bin/env/ node
  • Configure package.json e adicione o atributo bin
  • Escreva o código do andaime
  • Publique o andaime no npm

manual

  • Instalar andaimes
npm install -g your-own-cli
  • Use andaimes
your-own-cli

Análise de Dificuldades no Desenvolvimento de Andaimes

  • Subcontratação: dividir um sistema complexo em vários módulos
  • Registro de comando:
vue create
vue add
vue invoke
  • Análise de parâmetros
vue command [options] <params>
  • O nome completo das opções: –version, –help

  • abreviatura das opções: -V, -h

  • Opções com parâmetros: --path /Users/sam/Desktop/vue-test

  • Documento de ajuda:
    ajuda global: Exemplo de comandos de opções
    de uso : informações de ajuda 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 help Opções
    de uso vue create informações de ajuda:

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

Existem muitos mais, como:

  • Interação de linha de comando
  • Impressão de registros
  • O texto da linha de comando muda de cor
  • Comunicação de rede: HTTP/WebSocket
  • Processamento de arquivos
    etc...

Acho que você gosta

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