You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
npmrun eb77dac973 fixed bug 2 years ago
dist 克隆失败删除临时文件夹 2 years ago
example 初始化提交 3 years ago
scripts 初始化提交 3 years ago
src 克隆失败删除临时文件夹 2 years ago
templates fixed bug 2 years ago
types 初始化提交 3 years ago
.editorconfig 初始化提交 3 years ago
.gitignore 增加typedoc 2 years ago
README.MD fixed bug 2 years ago
package.json fixed bug 2 years ago
pnpm-lock.yaml 增加typedoc 2 years ago
rollup.config.js 初始化提交 3 years ago
tsconfig.json 完善功能 3 years ago
typedoc.json 增加typedoc 2 years ago

README.MD

安装

npm i @noderun/pp -g

帮助

pp -h

Options:
  -v, --version                 output the version number
  -h --help                     显示帮助信息

Commands:
  login <token>                 本地保存Gitee的私人令牌
  whoami                        查看私人令牌
  logout                        删除私人令牌
  sync [options]                同步模板列表
  list [options]                查看所有模板列表
  check                         查看配置文件
  add [options] <url> <name>    添加一个模板仓库
  remove <name>                 删除一个模板仓库
  clone <name> <target>         克隆模板仓库
  copy [options] <templateDir>  简单文件夹克隆
  ask <templateDir>             命令行交互测试
  help [command]                display help for command

命令行交互

在根目录新建一个pp.ask.js,内容如下:

module.exports = (inquirer) => {
  return [
    {
      type: "checkbox",
      message: "选择一个框架",
      name: "framework",
      choices: [
        new inquirer.Separator(" = Vue = "),
        {
          name: "element"
        },
        {
          name: "Ham",
        }
      ],
      validate(answer) {
        if (answer.length < 1) {
          return "You must choose at least one topping.";
        }
        return true;
      },
    },
  ];
};

通过之后变量会应用于模板中,模板采用的是ejs渲染,只需要在需要替换的地方使用ejs语法 <%= locals.toppings || '' %>就行了, 如果需要测试inquirer,使用pp ask 文件夹(文件夹是指子目录有pp.ask.js的文件夹)

同步

  • 在gitee创建私人令牌,权限包括gist的操作
  • 复制token,执行pp sync同步到gist

注意操作gist的是description的pp的,请注意跟你的gist不要重复 pp sync需要手动执行

命令行管理模板项目

  • 增删查模板列表
  • 克隆项目到本地
  • 克隆时ejs模板变量渲染
  • 代码整理
  • 同步功能
  • 可展示表格pp list --table
  • 增加inquirer自定义项目变量(beta)
  • 命令行交互
  • 本地模板命令行交互测试

注意

  • 记得同步就行,冲突比对暂时没有好的想法