iconfont-update-cli
Advanced tools
+25
-9
@@ -7,3 +7,3 @@ /* | ||
| * @LastEditors: zhouxd | ||
| * @LastEditTime: 2023-03-05 15:04:18 | ||
| * @LastEditTime: 2023-03-06 12:08:00 | ||
| */ | ||
@@ -14,5 +14,5 @@ const chalk = require("chalk"); | ||
| const writeConfig = require("../utils/writeConfig"); | ||
| const { getInitInput } = require("../utils/getUserInput"); | ||
| const { getInitInput, getInitPathInput } = require("../utils/getUserInput"); | ||
| module.exports = async () => { | ||
| const { phoneNumber, password, updatePath } = await getInitInput(); | ||
| const { phoneNumber, password } = await getInitInput(); | ||
| const { spinner, browser, page } = await createBrowser(); | ||
@@ -61,4 +61,20 @@ spinner.start(chalk.blue("查询参与项目的图标库信息")); | ||
| }); | ||
| const list = projectIdList.map((item) => { | ||
| spinner.succeed(chalk.green("您参与项目开发的图标库信息如下:")); | ||
| let showTableArr = projectIdList; | ||
| // 打印参与项目列表 | ||
| showTableArr = showTableArr.map((item) => { | ||
| return { | ||
| 仓库名: item.name, | ||
| 仓库ID: item.id, | ||
| }; | ||
| }); | ||
| console.log(); | ||
| console.table(showTableArr); | ||
| // 根据列表,初始化存入更新路径 | ||
| const list = []; | ||
| for (let item of projectIdList) { | ||
| let updatePath = await getInitPathInput(item); | ||
| list.push({ | ||
| id: item.id, | ||
@@ -69,5 +85,5 @@ name: item.name, | ||
| updatePath: updatePath, | ||
| fileAbsolutePath: path.join(_process.cwd(), updatePath), | ||
| fileAbsolutePath: path.join(process.cwd(), updatePath), | ||
| previewLocalPath: path.join( | ||
| _process.cwd(), | ||
| process.cwd(), | ||
| updatePath + "/demo_index.html" | ||
@@ -78,7 +94,7 @@ ), | ||
| item.id, | ||
| }; | ||
| }); | ||
| spinner.succeed(chalk.green("查询参与项目的图标库信息")); | ||
| }); | ||
| } | ||
| const jsonData = JSON.stringify({ list }); | ||
| writeConfig(jsonData); | ||
| console.log() | ||
| console.log( | ||
@@ -85,0 +101,0 @@ chalk.yellowBright( |
+5
-4
@@ -7,3 +7,3 @@ /* | ||
| * @LastEditors: zhouxd | ||
| * @LastEditTime: 2023-03-03 13:58:17 | ||
| * @LastEditTime: 2023-03-06 12:02:40 | ||
| */ | ||
@@ -16,7 +16,8 @@ const readConfig = require("../utils/readConfig"); | ||
| return { | ||
| '仓库名': item.name, | ||
| '仓库ID': item.id, | ||
| 仓库名: item.name, | ||
| 仓库ID: item.id, | ||
| 本地更新路径: item.fileAbsolutePath, | ||
| }; | ||
| }); | ||
| console.table([...projectArr], ["仓库名", "仓库ID"]); | ||
| console.table(projectArr); | ||
| }; |
+1
-1
| { | ||
| "name": "iconfont-update-cli", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "iconfont图标库更新", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
| const inquirer = require("inquirer"); | ||
| const chalk = require("chalk"); | ||
| const readConfig = require("../utils/readConfig"); | ||
@@ -7,3 +8,3 @@ let phoneNumber = ""; | ||
| let updateId = '' | ||
| let updateId = ""; | ||
| let previewPath = ""; | ||
@@ -26,2 +27,8 @@ let comparePath = {}; | ||
| ]); | ||
| return { | ||
| phoneNumber: phoneNumber.input, | ||
| password: password.input, | ||
| }; | ||
| } | ||
| async function getInitPathInput(item) { | ||
| updatePath = await inquirer.prompt([ | ||
@@ -31,11 +38,8 @@ { | ||
| type: "input", | ||
| message: "请输入本地图标库更新路径:", | ||
| default: "/public/static/newFont", | ||
| message: `请输入 ${chalk.blue(item.name)} 本地图标库更新路径:`, | ||
| default: | ||
| item.id == "3622752" ? "/public/static/newfont" : "/ui/font", | ||
| }, | ||
| ]); | ||
| return { | ||
| phoneNumber: phoneNumber.input, | ||
| password: password.input, | ||
| updatePath: updatePath.input, | ||
| }; | ||
| return updatePath.input; | ||
| } | ||
@@ -101,2 +105,3 @@ async function getUpdateInput() { | ||
| getInitInput, | ||
| getInitPathInput, | ||
| getUpdateInput, | ||
@@ -103,0 +108,0 @@ getPreviewInput, |
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.
22082
2.95%570
3.64%