当前位置: 首页 > news >正文

脚手架开发流程详解

开发流程

  • 创建npm项目
  • 创建脚手架入口文件,最上方添加
#!/usr/bin/env/ node
  • 配置package.json,添加bin属性
  • 编写脚手架代码
  • 将脚手架发布到npm

使用流程

  • 安装脚手架
npm install -g your-own-cli
  • 使用脚手架
your-own-cli

脚手架开发难点解析

  • 分包:将复杂的系统拆分成若干个模块
  • 命令注册:
vue create
vue add
vue invoke
  • 参数解析
vue command [options] <params>
  • options全称:–version、–help

  • options简写:-V、-h

  • 带params的options: --path /Users/sam/Desktop/vue-test

  • 帮助文档:
    global help:
    Usage
    Options
    Commands
    示例:vue 的帮助信息

Options:-V, --version                              output the version number-h, --help                                 display help for commandCommands:create [options] <app-name>                create a new project powered by vue-cli-serviceadd [options] <plugin> [pluginOptions]     install a plugin and invoke its generator in an already created projectinvoke [options] <plugin> [pluginOptions]  invoke the generator of a plugin in an already created projectinspect [options] [paths...]               inspect the webpack config in a project with vue-cli-serviceserve                                      alias of "npm run serve" in the current projectbuild                                      alias of "npm run build" in the current projectui [options]                               start and open the vue-cli uiinit [options] <template> <app-name>       generate a project from a remote template (legacy API, requires@vue/cli-init)config [options] [value]                   inspect and modify the configoutdated [options]                         (experimental) check for outdated vue cli service / pluginsupgrade [options] [plugin-name]            (experimental) upgrade vue cli service / pluginsmigrate [options] [plugin-name]            (experimental) run migrator for an already-installed cli plugininfo                                       print debugging information about your environmenthelp [command]                             display help for commandRun vue <command> --help for detailed usage of given command.
  • command help
    Usage
    Options
    vue create的帮助信息:
Usage: vue create [options] <app-name>create a new project powered by vue-cli-serviceOptions:-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

还有很多,比如:

  • 命令行交互
  • 日志打印
  • 命令行文字变色
  • 网络通信:HTTP/WebSocket
  • 文件处理
    等等…
http://www.lryc.cn/news/178625.html

相关文章:

  • 架构真题2021(四十三)
  • 数据统计和分析怎么做?spss如何做好数据分析?
  • 【多线程】线程安全的集合类
  • Goby 漏洞发布|Revive Adserver 广告管理系统 adxmlrpc.php 文件远程代码执行漏洞(CVE-2019-5434)
  • Docker(三)、Dockerfile探究
  • C++读取文件夹下多个文件,包括图片等等
  • DirectX 12 学习笔记 -结构
  • 【Redis】Redis 的学习教程(十二)之在 Redis使用 lua 脚本
  • 标准/扩展库中对象的导入与使用
  • 87、Redis 的 value 所支持的数据类型(String、List、Set、Zset、Hash)---->List相关命令
  • Celery结合flask完成异步任务与定时任务
  • 前端项目练习(练习-001-纯原生)
  • 基于微信小程序的游戏账号交易买卖平台设计与实现(源码+lw+部署文档+讲解等)
  • 2023 年 Bitget Wallet 测评
  • 医疗图像分割指标
  • 零代码编程:用ChatGPT批量修改文件夹名称中的大小写
  • webpack:详解cache模块常用配置
  • 云原生Kubernetes:Pod控制器
  • 数据库基础与MySQL入门
  • 探索Java爬虫框架:解锁网络数据之门
  • 智慧燃气平台的总体架构到底应怎样设计?
  • MonkeyRunner测试步骤
  • Konva基本处理流程和相关架构设计
  • 人工智能AI知多少?
  • leetcode1610. 可见点的最大数目(java)
  • Apache Flume
  • 【切片】基础不扎实引发的问题
  • CVE-2023-5129 libwebp堆缓冲区溢出漏洞影响分析
  • leetcode做题笔记155. 最小栈
  • 蓝海彤翔亮相2023新疆网络文化节重点项目“新疆动漫节”