我的网站开发技术经验总结 我的网站开发技术经验总结
首页

fangdown

我的网站开发技术经验总结
首页
  • 日记
  • 22
  • 06
fangdown
2022-06-07
目录

前端脚手架cli制作简单入门

# 前端脚手架cli制作简单入门

# 背景

有一个简单的前端项目模板, 需通过脚手架的方式进行创建

# 如何制作脚手架cli

准备资料

  • git项目模板

核心包

  • commander // 命令行
  • fs-extra // 文件系统
  • inquirer // 交互命令
  • axios // 请求工具
  • download-git-repo // 下载git

# 过程

  1. 脚手架命令开始

  2. 创建文件夹

    • 提示是否覆盖已有文件夹
    • 创建文件夹
  3. 创建核心

    • 获取模板库repos
    • 获取tag
    • 下载模板并复制到目标文件夹
  4. npm 发布

    • npm login
    • npm publish

# QA

github api 下载限制

解决方法: 换网络、或者用token

{

-   message: "API rate limit exceeded for xx.xx.xx.xx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
-   documentation_url: "<https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting>"

}
#脚手架
上次更新: 2022/06/07, 15:01:44
最近更新
01
多分支修复撞车的问题
05-01
02
如何成为架构师
01-23
03
服务器部署全过程
11-23
更多文章>
Theme by Vdoing | Copyright © 2019-2026 fangdown | 粤ICP备19079809号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式