qdmp-cli 0.1.8 → 0.1.9

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.
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm publish:*)",
5
+ "Bash(npm whoami:*)"
6
+ ]
7
+ }
8
+ }
package/actions.js CHANGED
@@ -144,7 +144,9 @@ export const initConfigAction = async (option) => {
144
144
  try {
145
145
  const qdmpJsonPath = `${process.cwd()}/qdmp.json`;
146
146
  if (fs.existsSync(qdmpJsonPath)) {
147
- return error("配置文件已存在,请勿重复初始化");
147
+ return error(
148
+ "配置文件已存在,请勿重复初始化。或手动删除 qdmp.json 后重新初始化",
149
+ );
148
150
  }
149
151
  const appId = option.appId;
150
152
  if (!appId) return error("未配置应用ID,请使用-a参数指定应用ID");
@@ -161,26 +163,36 @@ export const initConfigAction = async (option) => {
161
163
  error(e.message);
162
164
  }
163
165
  };
164
- export const buildAction = async (option) => {
166
+ export const buildAction = async () => {
165
167
  try {
166
- switch (option.type) {
167
- case "emp":
168
+ const qdmpJsonPath = `${process.cwd()}/qdmp.json`;
169
+ if (!fs.existsSync(qdmpJsonPath)) {
170
+ error("未找到 qdmp.json,请先执行 qdmp init 初始化项目");
171
+ return;
172
+ }
173
+ const config = JSON.parse(fs.readFileSync(qdmpJsonPath, "utf8"));
174
+ switch (config.loader) {
175
+ case "EMP":
168
176
  info("开始构建...");
169
- const buildResult = shell.exec("taro build --type weapp");
177
+ const buildResult = shell.exec("npm run build");
170
178
  if (buildResult.code !== 0) {
171
179
  throw new Error("构建失败");
172
180
  }
173
181
  shell.cd("dist");
174
- const dmccResult = shell.exec("dmcc build --no-app-id-dir");
182
+ const dmccResult = shell.exec("npx dmcc build --no-app-id-dir");
175
183
  if (dmccResult.code !== 0) {
176
- throw new Error("dmcc 构建失败");
184
+ throw new Error(
185
+ "dmcc 构建失败,请保证 npm run build 产物是一个标准的微信小程序",
186
+ );
177
187
  }
178
188
  shell.cd("..");
179
189
  success("构建完成");
180
190
  break;
181
191
 
182
192
  default:
183
- error("不支持的构建类型");
193
+ error(
194
+ `不支持的构建类型:${option.loader} 如果是空请检查qdmp.json配置文件是否正确`,
195
+ );
184
196
  break;
185
197
  }
186
198
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdmp-cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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
+ }