2.1.6 • Published 1 year ago

@mucpsing/cli v2.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

简介|Introductions

因为组内的项目都是我搭建的,特意写一个脚手架,可以快速生成一些项目结构,快速添加一些常用脚本到项目中。

目录|Index

  1. 简介|Introductions
  2. 主要功能|Base
  3. 安装|Install
  4. 使用|Usage
  5. 配置|Settings
  6. 联系方式|contact

安装|Install

npm i -g @mucpsing/cli

使用|Usage

$ cps -h
Usage: index [options]

Options:
  -t, --template [tempaletName]  下载常用模板 .cpsrc.template
  -a, --add <script>             添加常用工具函数 .cpsrc.add
  -u, --upload <imgPath>         上传图片到gitee/github仓库, 对应配置 .cpsrc.upload
  -s, --server [port]            对应配置 .cpsrc.upload.server.port
  -tr, --tree                    生成当前目录的文件数
  --test [any]                   测试命令

  -h, --help                     display help for command

主要功能|Base

  • 下载模板

    • 当前默认的仓库组织:

    • 支持自定义仓库组织

    • 添加强制拉取线上数据功能(默认每天首次获取线上,后续采用本地缓存)

  • 关联Typora图片上传

    • 通过粘贴图片自动上传
    • 关联到本地仓库
    • 首先复制图片到仓库,然后调用git远程同步
  • 生成当前目录的目录结构图

    • 一键批量替换md文件内图片链接
    • 去除.py文件注释块(#"""),去除测试部分代码(__name__=='__main__'

1. 下载常用模板|Template

only Command

$ cps

npm.io

with Flag:

$ cps <flag>

cps --template
#or
cps -t

npm.io

with Flag And Options:

$ cps <flag> [<option1>, [<option2>]]

cps --template <仓库名称[可选]> <本地保存路径[可选]>
# or
cps -t
# or
cps --template node-ts myProjectName

npm.io

2. Typora 图片上传关联|Upload

  • 配置 .cpsrcupload.lcoal.path字段,绑定本地图片仓库路径

    // ~/.cpsrc
    {
      "upload": {
        "auto_push":true, // 上传的图片的同时push到远程
    
        // 关联本地图片仓库目录,图片实际复制目录
        // 比如我的图片仓库地址是: https://gitee.com/capsion/markdown-image
        // 实际图片都是存放在 仓库的image目录下,所以本地的仓库也存在image
        "path": "D:/CPS/MyProject/markdown-image/image/",
    
        // 本地服务器配置
        // 根据path的dirname会自动生成态路由: http://localhonst:port/{image}/*.png|jpg
        "server": {
          "enable":true,
          "port": "45462"
        }
    }
  • Typora > 偏好配置 > 图像

    • 插入图片时: 选择"上传图片"

    • 上传服务: 选择 "自定义命令" (Custom Command)

    • 命令处填写: cps -u 或者 cps --upload npm.io

      npm.io

3. 生成目录树

  • 示例 tree.txt
【Root】                                     
   ├─ bin/                                 
   |   |-- app.mjs                         
   |   `-- app.cjs                         
   ├─ build/                                                   
   ├─ docs/                                # xxxxx
   ├─ screenshot/                          # xxxxx
   ├─ src/                                 # xxxxx
   |   ├─ core/                            
   |   |   `-- .gitkeep                    
   |   ├─ types/                           
   |   |   `-- index.ts                    
   |   ├─ utils/                           
   |   |   `-- index.ts                    
   |   |-- index.ts                        
   |   |-- custom-env.d.ts                 
   |   `-- app.ts                          
   ├─ __tests__/                           
   |   `-- .gitkeep                        
   |-- yarn.lock                           
   |-- tsconfig.json                       
   |-- tree.txt                            
   |-- rollup.config.ts                    
   |-- README.md                           
   |-- package.json                        
   |-- package-lock.json                   
   |-- LICENSE                             
   |-- git-push-fast.bat                   
   |-- git-push-costom.bat                 
   |-- git-pull.bat                        
   |-- git-load.bat                        
   |-- api-extractor.json                  
   `-- .gitignore                          

配置|Settings

  • ~/.cpsrc

    默认核心配置文件,插件自动创建

    {
      "template": {
        "org_name": "cps-cli-template",
        "org_url": "https://gitee.com/cps-cli-template",
        "org_path": "C:\\Users\\M2-WIN10\\.cpsrc.org_info",
        "org_add_time": "2022-04-05",
        "org_modify_time": "2022-05-02"
      },
      "upload": {
        "auto_push":true,
        "path": "D:/CPS/MyProject/markdown-image/image/",
        "server":{
          "enable":true, // 开启本地服务期,返回 http://127.0.0.1/xxxx/*.png 图片格式
          "port":"45462"
        }
      }
    }
  • ~/.cpsrc.org_info

    仓库组织的离线数据缓存,因为gitee获取组织仓库的Api有每日请求次数限制,所以每天只拉取一次线上数据,然后缓存到本地,以json格式存储。

// 接口: https://gitee.com/api/v5/orgs/${org_name}/repos 返回的json数据结果:
{
  ...each_repo_name:{ ../ }
}

联系方式|Contact

  • 373704015 (qq、wechat、email)
2.1.6

1 year ago

2.1.5

1 year ago

2.1.4

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.3

2 years ago

2.0.8

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago