iconfont-update-cli
Advanced tools
+2
-2
@@ -66,5 +66,5 @@ /* | ||
| updatePath: updatePath, | ||
| fileAbsolutePath: path.join(__dirname, updatePath), | ||
| fileAbsolutePath: path.join(_process.cwd(), updatePath), | ||
| previewLocalPath: path.join( | ||
| __dirname, | ||
| _process.cwd(), | ||
| updatePath + "/demo_index.html" | ||
@@ -71,0 +71,0 @@ ), |
+16
-16
@@ -7,3 +7,3 @@ /* | ||
| * @LastEditors: zhouxd | ||
| * @LastEditTime: 2023-03-05 23:35:37 | ||
| * @LastEditTime: 2023-03-06 01:12:25 | ||
| */ | ||
@@ -32,3 +32,3 @@ const path = require("path"); | ||
| const dirName = pathArr.pop(); | ||
| updatePath = pathArr.join("/") + '/'; | ||
| updatePath = pathArr.join("/") + "/"; | ||
| spinner.succeed(chalk.green("打开浏览器")); | ||
@@ -77,3 +77,3 @@ spinner.start(chalk.blue("进入登录页")); | ||
| behavior: "allow", //允许下载请求 | ||
| downloadPath: path.join(__dirname,updatePath), //设置下载路径,必须为绝对路径,不然报错 | ||
| downloadPath: path.join(_process.cwd(), updatePath), //设置下载路径,必须为绝对路径,不然报错 | ||
| }); | ||
@@ -90,3 +90,3 @@ spinner.start(chalk.blue("下载图标库")); | ||
| const startDate = Date.now(); | ||
| const zipPath = path.join(__dirname, updatePath + "download.zip"); | ||
| const zipPath = path.join(_process.cwd(), updatePath + "download.zip"); | ||
| while (!fs.existsSync(zipPath)) { | ||
@@ -105,4 +105,4 @@ // 等一秒钟 | ||
| await compressing.zip.uncompress( | ||
| path.join(__dirname, updatePath + "download.zip"), | ||
| path.join(__dirname, updatePath) | ||
| path.join(_process.cwd(), updatePath + "download.zip"), | ||
| path.join(_process.cwd(), updatePath) | ||
| ); | ||
@@ -114,7 +114,7 @@ spinner.succeed(chalk.green("解压zip")); | ||
| const isExistZip = fs.existsSync( | ||
| path.join(__dirname, updatePath + "download.zip") | ||
| path.join(_process.cwd(), updatePath + "download.zip") | ||
| ); | ||
| if (isExistZip) { | ||
| //删除zip文件 | ||
| fs.unlinkSync(path.join(__dirname, updatePath + "download.zip")); | ||
| fs.unlinkSync(path.join(_process.cwd(), updatePath + "download.zip")); | ||
| spinner.succeed(chalk.green("删除download.zip")); | ||
@@ -124,6 +124,6 @@ } | ||
| const isexist = fs.existsSync( | ||
| path.join(__dirname, updatePath + dirName) | ||
| path.join(_process.cwd(), updatePath + dirName) | ||
| ); | ||
| if (!isexist) { | ||
| fs.mkdirSync(path.join(__dirname,updatePath + dirName)); | ||
| fs.mkdirSync(path.join(_process.cwd(), updatePath + dirName)); | ||
| } | ||
@@ -133,17 +133,17 @@ spinner.start(chalk.blue("删除旧的newFont文件夹")); | ||
| const files = fs.readdirSync( | ||
| path.join(__dirname, updatePath + dirName) | ||
| path.join(_process.cwd(), updatePath + dirName) | ||
| ); | ||
| files.forEach((file) => { | ||
| fs.unlinkSync(path.join(__dirname, updatePath + dirName, file)); | ||
| fs.unlinkSync(path.join(_process.cwd(), updatePath + dirName, file)); | ||
| }); | ||
| fs.rmdirSync(path.join(__dirname, updatePath + dirName)); | ||
| fs.rmdirSync(path.join(_process.cwd(), updatePath + dirName)); | ||
| spinner.succeed(chalk.green("删除旧的newFont文件夹")); | ||
| spinner.start(chalk.blue("重命名文件夹")); | ||
| const dir = fs.readdirSync(path.join(__dirname, updatePath)); | ||
| const dir = fs.readdirSync(path.join(_process.cwd(), updatePath)); | ||
| dir.forEach((dir) => { | ||
| if (dir.startsWith("font_")) { | ||
| fs.renameSync( | ||
| path.join(__dirname, updatePath, dir), | ||
| path.join(__dirname, updatePath, dirName) | ||
| path.join(_process.cwd(), updatePath, dir), | ||
| path.join(_process.cwd(), updatePath, dirName) | ||
| ); | ||
@@ -150,0 +150,0 @@ } |
+1
-1
| { | ||
| "name": "iconfont-update-cli", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "iconfont图标库更新", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
21449
0.38%