From 714cbd55f2d76b64ce70ed283ccee6caa7cea908 Mon Sep 17 00:00:00 2001 From: que01 Date: Thu, 15 Oct 2026 23:26:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E9=BD=90=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=8C=85=E4=B8=AD=E7=9A=84=20Taro=20=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=B7=A5=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/install-release.mjs | 20 ++++++++++++++++++ scripts/deploy/package-release.mjs | 34 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/deploy/install-release.mjs b/deploy/install-release.mjs index 7576a8a..9cd249c 100644 --- a/deploy/install-release.mjs +++ b/deploy/install-release.mjs @@ -369,6 +369,26 @@ try { ], 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); await backupDatabase(path.join(root, "shared/backups", manifest.version + ".dump")); await pruneBackups(path.join(root, "shared/backups")); diff --git a/scripts/deploy/package-release.mjs b/scripts/deploy/package-release.mjs index c74d127..7c224c5 100644 --- a/scripts/deploy/package-release.mjs +++ b/scripts/deploy/package-release.mjs @@ -1,4 +1,5 @@ import { createHash } from "node:crypto"; +import { existsSync } from "node:fs"; import { cp, mkdir, readFile, readdir, writeFile } from "node:fs/promises"; import path from "node:path"; 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() { if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,100}$/.test(version)) throw new Error("Invalid release version"); @@ -105,7 +127,19 @@ async function main() { ]) { await copyWorkspace(workspace); } + await copyTaroWorkspace(); 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"), { recursive: true, });