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

前端架构: 脚手架开发流程中的难点梳理

脚手架的开发流程


1 )开发流程

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

2 )使用流程

  • 安装脚手架

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

    • your-own-cli

3 )脚手架开发难点

  • 分包: 将复杂的系统拆分成若干个模块,并且合并成一个复杂系统
  • 命令注册,如:
    • $ vue create
    • $ vue add
    • $ vue invoke
    • 这里需要了解,如何注册命令,以及执行命令
  • 参数解析
    • 如:vue command [options] <params>
    • options全称: --version, --help
    • options简写:-V, -h
    • 带params的options: --path /Users/xxx/…/vue-test
    • 帮助文档:
      • global help 是指对主命令进行帮助
        • Usage
        • Options
        • Commands
      • vue的帮助文档示例,这个属于 global help
        $ vue
        Usage: vue <command> [options]Options:-V, --version                              output the version number-h, --help                                 output usage informationCommands: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 [options] [entry]                    serve a .js or .vue file in development mode with zero configbuild [options] [entry]                    build a .js or .vue file in production mode with zero configui [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 configupgrade [semverLevel]                      upgrade vue cli service / plugins (default semverLevel: minor)info                                       print debugging information about your environmentRun vue <command> --help for detailed usage of given command.
        
        • 可见,可通过 vue -V, 或 vue -h 可查看具体的信息
        • global help 只能表示主命令的用法,对于子命令,也同样需要
      • command help 子命令帮助
        • Usage
        • Options
      • 子命令的帮助信息,举例
        $ vue create
        Usage: 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-c, --clone                     Use git clone when fetching remote preset-x, --proxy                     Use specified proxy when creating project-b, --bare                      Scaffold project without beginner instructions--skipGetStarted                Skip displaying "Get started" instructions-h, --help                      output usage informationMissing required argument <app-name>.
        
    • 同样,还有很多,如:
      • 命令行交互: 可以选择
      • 日志打印: 标准打印
      • 命令行文字变色: 错误红色,警告黄色
      • 网络通信:HTTP/WebSocket
      • 文件处理
http://www.lryc.cn/news/300430.html

相关文章:

  • django中配置使用websocket
  • Rust复合类型详解
  • 学习 JavaScript 闭包
  • VScode中配置 C/C++ 环境 | IT拯救者
  • 基于Python实现Midjourney集成到(个人/公司)平台中
  • 蓝桥杯刷题--python-6
  • node+vue3+mysql前后分离开发范式——实现对数据库表的增删改查
  • 【Android】使用Apktool反编译Apk文件
  • (04)Hive的相关概念——order by 、sort by、distribute by 、cluster by
  • Django模板(二)
  • 勒索病毒最新变种.faust勒索病毒来袭,如何恢复受感染的数据?
  • python 人脸检测器
  • 机器学习与深度学习
  • 算法训练营day27(补),贪心算法1
  • [office] excel2003限定单元格输入值范围教程 #微信#经验分享
  • OLED显示红外遥控键码
  • LabVIEW智能温度监控系统
  • 专业140+总分420+浙江大学842信号系统与数字电路考研经验电子信息与通信,真题,大纲,参考书。
  • C语言学习day15:数组强化训练
  • 缓存穿透、缓存击穿与缓存雪崩
  • 一周学会Django5 Python Web开发-项目配置settings.py文件-模版配置
  • CF1845 D. Rating System [思维题+数形结合]
  • HeidiSQL安装配置(基于小皮面板(phpstudy))连接MySQL
  • 【蓝桥2013】错误票据
  • nvm对node版本进行管理及疑难解决,vue项目搭建与启动
  • Redisson分布式锁 原理 + 运用 记录
  • Spring Boot 笔记 021 项目部署
  • 新技术革命开始了,Sora一出,所有的视频人、电影人都下岗
  • 【FPGA开发】Modelsim和Vivado的使用
  • 现代浏览器对 es模块 【esm】原生支持