fix: 补齐发布包中的 Taro 构建工程
This commit is contained in:
1 parent
50753db79d
commit
714cbd55f2
2 files changed
+54
No files matched your search
@@ -369,6 +369,26 @@ try {
|
|||||||
],
|
],
|
||||||
release,
|
release,
|
||||||
);
|
);
|
||||||
|
run(
|
||||||
|
"env",
|
||||||
|
[
|
||||||
|
"NODE_ENV=development",
|
||||||
|
"pnpm",
|
||||||
|
"--filter",
|
||||||
|
"@personal-brand/taro",
|
||||||
|
"--filter",
|
||||||
|
"@personal-brand/template-acheng-campus-food",
|
||||||
|
"--filter",
|
||||||
|
"@personal-brand/template-linjing-editorial",
|
||||||
|
"--filter",
|
||||||
|
"@personal-brand/template-atelier-solopreneur",
|
||||||
|
"install",
|
||||||
|
"--frozen-lockfile",
|
||||||
|
"--prefer-offline",
|
||||||
|
"--ignore-scripts",
|
||||||
|
],
|
||||||
|
release,
|
||||||
|
);
|
||||||
run("pnpm", ["--filter", "@personal-brand/api", "exec", "prisma", "generate"], release);
|
run("pnpm", ["--filter", "@personal-brand/api", "exec", "prisma", "generate"], release);
|
||||||
await backupDatabase(path.join(root, "shared/backups", manifest.version + ".dump"));
|
await backupDatabase(path.join(root, "shared/backups", manifest.version + ".dump"));
|
||||||
await pruneBackups(path.join(root, "shared/backups"));
|
await pruneBackups(path.join(root, "shared/backups"));
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { createHash } from "node:crypto";
|
import { createHash } from "node:crypto";
|
||||||
|
import { existsSync } from "node:fs";
|
||||||
import { cp, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
import { cp, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
@@ -81,6 +82,27 @@ async function copyWorkspace(workspace) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function copyTaroWorkspace() {
|
||||||
|
const source = path.join(root, "apps/taro");
|
||||||
|
const target = path.join(output, "apps/taro");
|
||||||
|
await mkdir(target, { recursive: true });
|
||||||
|
await cp(path.join(source, "package.json"), path.join(target, "package.json"));
|
||||||
|
await cp(path.join(source, "src"), path.join(target, "src"), { recursive: true });
|
||||||
|
await cp(path.join(source, "config"), path.join(target, "config"), { recursive: true });
|
||||||
|
await cp(path.join(source, "tsconfig.json"), path.join(target, "tsconfig.json"));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyTemplatePackage(directoryName) {
|
||||||
|
const source = path.join(root, "packages", directoryName);
|
||||||
|
const target = path.join(output, "packages", directoryName);
|
||||||
|
await mkdir(target, { recursive: true });
|
||||||
|
await cp(path.join(source, "package.json"), path.join(target, "package.json"));
|
||||||
|
await cp(path.join(source, "template.json"), path.join(target, "template.json"));
|
||||||
|
await cp(path.join(source, "miniapp"), path.join(target, "miniapp"), { recursive: true });
|
||||||
|
await cp(path.join(source, "taro"), path.join(target, "taro"), { recursive: true });
|
||||||
|
await cp(path.join(source, "tsconfig.json"), path.join(target, "tsconfig.json"));
|
||||||
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$/.test(version))
|
if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$/.test(version))
|
||||||
throw new Error("Invalid release version");
|
throw new Error("Invalid release version");
|
||||||
@@ -105,7 +127,19 @@ async function main() {
|
|||||||
]) {
|
]) {
|
||||||
await copyWorkspace(workspace);
|
await copyWorkspace(workspace);
|
||||||
}
|
}
|
||||||
|
await copyTaroWorkspace();
|
||||||
await cp(adminDist, path.join(output, "apps/admin/dist"), { recursive: true });
|
await cp(adminDist, path.join(output, "apps/admin/dist"), { recursive: true });
|
||||||
|
for (const entry of await readdir(path.join(root, "packages"), { withFileTypes: true })) {
|
||||||
|
const templateDirectory = path.join(root, "packages", entry.name);
|
||||||
|
if (
|
||||||
|
entry.isDirectory() &&
|
||||||
|
entry.name.startsWith("template-") &&
|
||||||
|
existsSync(path.join(templateDirectory, "template.json")) &&
|
||||||
|
existsSync(path.join(templateDirectory, "taro/index.tsx"))
|
||||||
|
) {
|
||||||
|
await copyTemplatePackage(entry.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
await cp(path.join(root, "apps/api/prisma/assets"), path.join(output, "seed-media"), {
|
await cp(path.join(root, "apps/api/prisma/assets"), path.join(output, "seed-media"), {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user