feat: 收口小程序构建上传阶段

This commit is contained in:
que01 committed 2026-10-17 18:01:38 +08:00
1 parent 6420b85019
commit ec16fff70e
23 files changed
+1185 -104

No files matched your search

+21
View File
@@ -5,6 +5,8 @@ import { test } from "node:test";
import {
miniappArtifactRoot,
miniappProjectPath,
miniappReleaseProjectPath,
miniappReleaseOutputRoot,
REPOSITORY_ROOT,
} from "../src/modules/admin/miniapp-artifact.js";
@@ -40,3 +42,22 @@ test("显式配置的产物根目录按仓库根目录解析相对路径", () =>
);
assert.equal(miniappArtifactRoot("/srv/miniapp"), resolve("/srv/miniapp"));
});
test("发布产物路径隔离品牌、模板版本和 attempt", () => {
const root = miniappReleaseOutputRoot("brand-a", "linjing-editorial", "1.0.4", "attempt-1");
assert.equal(
root,
resolve(REPOSITORY_ROOT, "apps/taro/dist/releases/brand-a/linjing-editorial@1.0.4/attempt-1"),
);
assert.equal(
miniappReleaseProjectPath("brand-a", "linjing-editorial", "1.0.4", "attempt-1"),
`${root}/weapp`,
);
});
test("发布产物路径拒绝可能越界的品牌或模板字段", () => {
assert.throws(
() => miniappReleaseOutputRoot("../brand", "food", "1.0.0", "attempt-1"),
/Invalid brand slug/,
);
});