qdmp-cli 0.1.17 → 0.1.18

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/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  千岛小程序开发平台命令行工具
4
4
 
5
+ ## 环境要求
6
+
7
+ 使用 Node.js `22.12+`、`24.11+` 或 `26+`,推荐使用最新 LTS 版本。
5
8
 
6
9
  ## ✨ 功能特性
7
10
  - 项目初始化与模板选择
package/actions.js CHANGED
@@ -174,6 +174,20 @@ export const initConfigAction = async (option) => {
174
174
  error(e.message);
175
175
  }
176
176
  };
177
+ const assertCompilerNodeVersion = (version = process.versions.node) => {
178
+ const [major, minor] = version.split(".").map(Number);
179
+ const supported =
180
+ (major === 22 && minor >= 12) ||
181
+ (major === 24 && minor >= 11) ||
182
+ major >= 26;
183
+
184
+ if (!supported) {
185
+ throw new Error(
186
+ `当前 Node.js ${version} 不受 EMP 编译器支持,请使用 Node.js 22.12+、24.11+ 或 26+`,
187
+ );
188
+ }
189
+ };
190
+
177
191
  export const buildAction = async () => {
178
192
  try {
179
193
  const qdmpJsonPath = `${process.cwd()}/qdmp.json`;
@@ -184,6 +198,7 @@ export const buildAction = async () => {
184
198
  const config = JSON.parse(fs.readFileSync(qdmpJsonPath, "utf8"));
185
199
  switch (config.loader) {
186
200
  case "EMP":
201
+ assertCompilerNodeVersion();
187
202
  info("开始构建...");
188
203
  const buildResult = shell.exec("npm run build");
189
204
  if (buildResult.code !== 0) {
@@ -212,7 +227,7 @@ export const buildAction = async () => {
212
227
  );
213
228
  } catch (e) {
214
229
  throw new Error(
215
- "dmcc 构建失败,请保证 npm run build 产物是一个标准的微信小程序",
230
+ `EMP 编译器执行失败,请根据上方原始日志排查依赖或构建产物:${e?.message || "未知错误"}`,
216
231
  );
217
232
  }
218
233
  success("构建完成");