@zwa73/utils 1.0.149 → 1.0.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/utils",
3
- "version": "1.0.149",
3
+ "version": "1.0.150",
4
4
  "description": "my utils",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +1,5 @@
1
1
  const path = require('path');
2
2
  const { UtilFT } = require("../index");
3
- const readline = require('readline');
4
3
 
5
4
  const PACKAGE_PATH = path.join(__dirname,'..','package.json');
6
5
  const VERSION_PATH = path.join(__dirname,"..","..","version.json");
@@ -33,11 +32,10 @@ function showUpgradeMessages(prevVersion, currentVersion) {
33
32
  // 遍历infoTable中的所有版本
34
33
  for (const version in INFO_TABLE) {
35
34
  const versionNumber = versionToNumber(version);
36
- //console.log(versionNumber,prevVersionNumber,currentVersionNumber)
37
35
  // 如果用户的上一个版本低于这个版本,而当前版本高于或等于这个版本
38
36
  if (versionNumber > prevVersionNumber && versionNumber <= currentVersionNumber) {
39
37
  // 显示这个版本的提示信息
40
- console.log(INFO_TABLE[version]);
38
+ process.stdout.write(INFO_TABLE[version]);
41
39
  hasOut=true;
42
40
  }
43
41
  }
@@ -50,21 +48,13 @@ async function main(){
50
48
  const currentVersion = packageTable.version;
51
49
  await UtilFT.ensurePathExists(VERSION_PATH);
52
50
  const versionTable = await UtilFT.loadJSONFile(VERSION_PATH,{default:{}});
53
- const prevVersion = versionTable[PKG_NAME]?.version ?? "0.0.0";
51
+ const prevVersion = versionTable[PKG_NAME]?.version ?? "10000.0.0";
52
+
53
+ process.stdout.write(`${currentVersion} 版本已安装`);
54
54
 
55
- console.log(`${currentVersion} 版本已安装`);
56
- // 使用这个函数来显示升级信息
57
55
  const hasOut = showUpgradeMessages(prevVersion, currentVersion);
58
56
 
59
57
  const ntable = Object.assign({},versionTable,{[PKG_NAME]:{version:currentVersion}});
60
58
  await UtilFT.writeJSONFile(VERSION_PATH, ntable);
61
-
62
- if(!hasOut) return;
63
- const rl = readline.createInterface({
64
- input: process.stdin,
65
- output: process.stdout
66
- });
67
- setTimeout(()=>rl.close(),5000);
68
- rl.question('按任意键继续...', () => rl.close());
69
59
  }
70
60
  main()