UNPKG

jiuye-cli

Version:

A simple CLI for scaffolding Jiuye projects.

20 lines (17 loc) 668 B
const path = require('path') module.exports = { // UNIX (以“.”或者"/"开头) WINDOWS(以形如:“C:”的方式开头) isLocalPath (templatePath) { return /^[./]|(^[a-zA-Z]:)/.test(templatePath) }, // templatePath是否为绝对路径,是则返回templatePath 否则转换成绝对路径并规范化 getTemplatePath (templatePath) { /** * path.isAbsolute(templatePath) //判断是否为绝对路径 * process.cwd() //当前执行node命令时候的文件夹地址 */ return path.isAbsolute(templatePath) ? templatePath : path.normalize(path.join(process.cwd(), templatePath)) } }