aircitytype 1.1.4 → 1.1.6

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.
@@ -676,6 +676,7 @@ interface Marker {
676
676
  deleteByGroupId(groupId: string, fn?: () => void): void;
677
677
  showByGroupId(groupId: string, fn?: () => void): void;
678
678
  hideByGroupId(groupId: string, fn?: () => void): void;
679
+ showPopupWindow(id:string):void;
679
680
  focus(id: string, o1?: number, o2?: number, rotation?: number[]): any;
680
681
  show(ids: string[] | string, fn?: () => void): void;
681
682
  hide(ids: string[] | string, fn?: () => void): void;
package/main.js CHANGED
@@ -3,7 +3,8 @@ console.log("start install!");
3
3
 
4
4
  const fs = require("fs");
5
5
  const fse = require("fs-extra");
6
- const path = require('path');
6
+ const path = require("path");
7
+ const { parse } = require("jsonc-parser");
7
8
 
8
9
  const source = "./node_modules/aircitytype/aircity";
9
10
  const target = "./node_modules/@types/aircity";
@@ -31,21 +32,20 @@ fs.access(source, fs.constants.F_OK, (err) => {
31
32
  }
32
33
  });
33
34
 
34
-
35
35
  // 定义JSON文件路径
36
- const tsconfigPath = path.join(process.cwd(), 'tsconfig.json');
37
- const jsconfigPath = path.join(process.cwd(), 'jsconfig.json');
36
+ const tsconfigPath = path.join(process.cwd(), "tsconfig.json");
37
+ const jsconfigPath = path.join(process.cwd(), "jsconfig.json");
38
38
 
39
39
  // 函数用于检查文件是否存在并解析存在的那个文件
40
40
  function checkAndParseConfigFiles(callback) {
41
41
  const filesToCheck = [
42
- { path: tsconfigPath, name: 'tsconfig.json' },
43
- { path: jsconfigPath, name: 'jsconfig.json' }
42
+ { path: tsconfigPath, name: "tsconfig.json" },
43
+ { path: jsconfigPath, name: "jsconfig.json" },
44
44
  ];
45
45
 
46
46
  function checkNextFile(index) {
47
47
  if (index >= filesToCheck.length) {
48
- console.log('没有找到 tsconfig.json 或 jsconfig.json 文件');
48
+ console.log("没有找到 tsconfig.json 或 jsconfig.json 文件");
49
49
  return;
50
50
  }
51
51
 
@@ -67,17 +67,17 @@ function checkAndParseConfigFiles(callback) {
67
67
 
68
68
  // 解析并处理 JSON 文件
69
69
  function parseJsonFile(filePath, callback) {
70
- fs.readFile(filePath, 'utf8', (err, data) => {
70
+ fs.readFile(filePath, "utf8", (err, data) => {
71
71
  if (err) {
72
72
  console.error(`读取 ${filePath} 文件时出错:`, err);
73
73
  return;
74
74
  }
75
75
 
76
- console.log(data)
76
+ console.log(data);
77
77
 
78
78
  let jsonData;
79
79
  try {
80
- jsonData = JSON.parse(data);
80
+ jsonData = parse(data);
81
81
  } catch (parseErr) {
82
82
  console.error(`解析 ${filePath} 文件时出错:`, parseErr);
83
83
  return;
@@ -85,26 +85,26 @@ function parseJsonFile(filePath, callback) {
85
85
 
86
86
  console.log(`解析的配置文件内容:`, jsonData);
87
87
 
88
- // 检查和修改配置
89
- modifyCompilerOptions(jsonData);
88
+ // 检查和修改配置
89
+ modifyCompilerOptions(jsonData);
90
90
 
91
- // 将修改后的 JSON 对象转换为字符串并写回文件
91
+ // 将修改后的 JSON 对象转换为字符串并写回文件
92
92
  const updatedJsonString = JSON.stringify(jsonData, null, 2);
93
- fs.writeFile(filePath, updatedJsonString, 'utf8', (writeErr) => {
93
+ fs.writeFile(filePath, updatedJsonString, "utf8", (writeErr) => {
94
94
  if (writeErr) {
95
95
  console.error(`写入 ${filePath} 文件时出错:`, writeErr);
96
96
  return;
97
97
  }
98
98
  console.log(`${filePath} 文件已成功更新`);
99
-
99
+
100
100
  // 执行回调函数(如果有)
101
- if (callback && typeof callback === 'function') {
101
+ if (callback && typeof callback === "function") {
102
102
  callback(jsonData, filePath);
103
103
  }
104
104
  });
105
105
 
106
106
  // 执行回调函数(如果有)
107
- if (callback && typeof callback === 'function') {
107
+ if (callback && typeof callback === "function") {
108
108
  callback(jsonData, filePath);
109
109
  }
110
110
  });
@@ -116,7 +116,6 @@ checkAndParseConfigFiles((jsonData, filePath) => {
116
116
  console.log(`完成解析 ${filePath}`);
117
117
  });
118
118
 
119
-
120
119
  // 修改 compilerOptions 中的 types 数组
121
120
  function modifyCompilerOptions(jsonData) {
122
121
  if (!jsonData.compilerOptions) {
@@ -130,12 +129,10 @@ function modifyCompilerOptions(jsonData) {
130
129
  const typesArray = jsonData.compilerOptions.types;
131
130
 
132
131
  // 如果 types 数组中没有 'aircity',则添加
133
- if (!typesArray.includes('aircity')) {
134
- typesArray.push('aircity');
132
+ if (!typesArray.includes("aircity")) {
133
+ typesArray.push("aircity");
135
134
  console.log('已添加 "aircity" 到 types 数组');
136
135
  } else {
137
136
  console.log('"aircity" 已存在于 types 数组中');
138
137
  }
139
138
  }
140
-
141
-
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "test": "echo \"Error: no test specified\" && exit 1"
6
6
  },
7
7
  "keywords": [],
8
- "author": "strex@qq.com",
8
+ "author": "strex@qq.com",
9
9
  "license": "ISC",
10
10
  "repository": {
11
11
  "type": "git",
@@ -14,5 +14,8 @@
14
14
  "bin": {
15
15
  "installdts": "./main.js"
16
16
  },
17
- "version": "1.1.4"
17
+ "version": "1.1.6",
18
+ "dependencies": {
19
+ "jsonc-parser": "^3.3.1"
20
+ }
18
21
  }