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.
- package/.claude/settings.local.json +8 -0
- package/actions.js +20 -8
- package/package.json +2 -2
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 (
|
|
166
|
+
export const buildAction = async () => {
|
|
165
167
|
try {
|
|
166
|
-
|
|
167
|
-
|
|
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("
|
|
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(
|
|
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) {
|