1.0.2 • Published 4 years ago

superid-cli-utils v1.0.2

Weekly downloads
5
License
MIT
Repository
-
Last release
4 years ago

Features

  • SuperId内部工具集,通过命令行提供一些功能的快捷支持,提高开发效率。
  • 基于Typescript,Commander开发,由father-build封装打包。

Install

npm install -g superid-cli-utils
# or, with yarn
yarn add global superid-cli-utils

# 安装完成后需要重启bash或者执行命令刷新环境变量才可以联想该命令行
# 默认Node安装时配置了npm的环境变量,使用yarn或者出现无法联想的情况
# 需要把yarn/npm对应的全局node_modules执行目录加入到环境变量Path才可以进行联想

# Mac
source /etc/profile

Usage

# Use global command 'superid' to get usage
superid -h
# or
superid --help

Develope

# install dependencies
yarn install

# Use father build to package and process with the typescript.
father build

# debug with output file in dist
node --inspect-brk dist/app.js -d <superid-root> [command]

Commands

全局参数说明:

  • -d --directory \<directory> 在非superid-web根目录下执行superid时需要指定项目根路径(否则会以当前目录进行操作导致出现不可预知的错误)

svg-generator

基于蓝湖下载的设计SVG文件转换成直接可用的React SVG组件,操作步骤: 1. 参考Install安装superid命令行 2. 下载蓝湖设计的svg文件到本地路径 3. 命令行输入superid svg-generator 后将文件拖到i-term获取该文件路径作为参数,然后输入SVG图片名 4. 自行配置可选参数,执行命令,文件会生成到指定路径(注意:如果生成Svg组件文件已存在会被覆盖)

参数说明:

  • -c --clearfill 蓝湖下载的SVG默认会填fill属性导致CSS的fill不能生效,颜色自行控制的场景可以配置该选项剔除fill属性。
  • -p --position \<position> 默认svg会放到superid-web/src/@superid/public/svgs目录下,可以指定web/forum/restaurant/font/tss对应项目的子仓(行业线仓暂时没有svg放置场景,需要时要修改SVG_PATH来兼容)

Test

目前svg-generator已经补充了测试用例,后续用例可以参考该文件,以.test.ts结尾并放置到test目录下

npm run test
# or
father test