qdmp-cli 0.1.9 → 0.1.10

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": "qdmp-cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "qdmp-cli",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -31,4 +31,4 @@
31
31
  "engines": {
32
32
  "node": ">=20"
33
33
  }
34
- }
34
+ }
package/utils/common.js CHANGED
@@ -18,13 +18,18 @@ export const getUploadPath = (appId, code) => {
18
18
  * @returns appId
19
19
  */
20
20
  export function getAppId(env = "prod") {
21
+ const fieldName = env === "prod" ? "appId" : "devAppId";
21
22
  try {
22
23
  const qdmpJsonPath = `${process.cwd()}/qdmp.json`;
23
24
  const data = fs.readFileSync(path.resolve(qdmpJsonPath), "utf8");
24
25
  const qdmpJson = JSON.parse(data);
25
- return env === "prod" ? qdmpJson?.appId || "" : qdmpJson?.devAppId || "";
26
+ const appId = qdmpJson?.[fieldName] || "";
27
+ if (!appId) {
28
+ error(`未授权应用,请在根目录下qdmp.json配置对应的${fieldName}`);
29
+ }
30
+ return appId;
26
31
  } catch (e) {
27
- error("未授权应用,请在根目录下qdmp.json配置对应的appId");
32
+ error(`未授权应用,请在根目录下qdmp.json配置对应的${fieldName}`);
28
33
  }
29
34
  }
30
35
 
@@ -153,16 +158,16 @@ async function copyAndSetEmpDistFolder(appId, code) {
153
158
  JSON.stringify({
154
159
  appId,
155
160
  version: code,
156
- })
161
+ }),
157
162
  );
158
163
  } else {
159
164
  const qdmpJson = JSON.parse(
160
- fs.readFileSync(`${WORKSPACE_DIR}/dist/main/qdmp.json`, "utf8")
165
+ fs.readFileSync(`${WORKSPACE_DIR}/dist/main/qdmp.json`, "utf8"),
161
166
  );
162
167
  qdmpJson.version = code;
163
168
  fs.writeFileSync(
164
169
  `${WORKSPACE_DIR}/dist/main/qdmp.json`,
165
- JSON.stringify(qdmpJson)
170
+ JSON.stringify(qdmpJson),
166
171
  );
167
172
  }
168
173
  success("文件复制完成");
@@ -1,8 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm publish:*)",
5
- "Bash(npm whoami:*)"
6
- ]
7
- }
8
- }