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

+41 -1
View File
@@ -1,4 +1,4 @@
import { resolve } from "node:path";
import { relative, resolve } from "node:path";
import { fileURLToPath } from "node:url";
export const REPOSITORY_ROOT = fileURLToPath(new URL("../../../../..", import.meta.url));
@@ -12,3 +12,43 @@ export function miniappArtifactRoot(configured = process.env.MINIAPP_ARTIFACT_RO
export function miniappProjectPath(templatePackageKey: string): string {
return resolve(miniappArtifactRoot(), templatePackageKey, "weapp");
}
export function miniappReleaseOutputRoot(
brandSlug: string,
templateKey: string,
templateVersion: string,
attemptId: string,
): string {
for (const [label, value] of [
["brand slug", brandSlug],
["template key", templateKey],
["template version", templateVersion],
["attempt id", attemptId],
] as const) {
if (!/^[a-zA-Z0-9._-]+$/.test(value))
throw new Error(`Invalid ${label} for miniapp artifact path`);
}
return resolve(
miniappArtifactRoot(),
"releases",
brandSlug,
`${templateKey}@${templateVersion}`,
attemptId,
);
}
export function miniappReleaseProjectPath(
brandSlug: string,
templateKey: string,
templateVersion: string,
attemptId: string,
): string {
return resolve(
miniappReleaseOutputRoot(brandSlug, templateKey, templateVersion, attemptId),
"weapp",
);
}
export function miniappTaroOutputRoot(outputRoot: string): string {
return relative(resolve(REPOSITORY_ROOT, "apps/taro"), outputRoot);
}