mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 22:14:50 +00:00
fix(release): bundle zod for shumai webapp and keep it external for workers
This commit is contained in:
@@ -165,6 +165,7 @@ async function buildPlatformPackages(
|
|||||||
entrypoint: string,
|
entrypoint: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
plugins: any[] = [],
|
plugins: any[] = [],
|
||||||
|
external?: string[],
|
||||||
) {
|
) {
|
||||||
for (const target of targets) {
|
for (const target of targets) {
|
||||||
const dirName = `${appName}-${target.platform}-${target.arch}`
|
const dirName = `${appName}-${target.platform}-${target.arch}`
|
||||||
@@ -180,6 +181,7 @@ async function buildPlatformPackages(
|
|||||||
binaryName,
|
binaryName,
|
||||||
bunTarget: target.bunTarget,
|
bunTarget: target.bunTarget,
|
||||||
plugins,
|
plugins,
|
||||||
|
external,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Generate package.json for platform-specific package
|
// Generate package.json for platform-specific package
|
||||||
@@ -209,6 +211,7 @@ async function buildMainPackage({
|
|||||||
entrypoint,
|
entrypoint,
|
||||||
plugins = [],
|
plugins = [],
|
||||||
extraDependencies = {},
|
extraDependencies = {},
|
||||||
|
external = commonExternal,
|
||||||
}: {
|
}: {
|
||||||
appName: string
|
appName: string
|
||||||
description: string
|
description: string
|
||||||
@@ -217,6 +220,7 @@ async function buildMainPackage({
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
plugins?: any[]
|
plugins?: any[]
|
||||||
extraDependencies?: Record<string, string>
|
extraDependencies?: Record<string, string>
|
||||||
|
external?: string[]
|
||||||
}) {
|
}) {
|
||||||
console.log(`\n📄 Packaging wrapper app ${appName}...`)
|
console.log(`\n📄 Packaging wrapper app ${appName}...`)
|
||||||
const mainOutDir = path.join(distDir, appName)
|
const mainOutDir = path.join(distDir, appName)
|
||||||
@@ -235,7 +239,7 @@ async function buildMainPackage({
|
|||||||
minify: true,
|
minify: true,
|
||||||
naming: `${appName}-app.[ext]`,
|
naming: `${appName}-app.[ext]`,
|
||||||
plugins,
|
plugins,
|
||||||
external: commonExternal,
|
external,
|
||||||
define: {
|
define: {
|
||||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||||
},
|
},
|
||||||
@@ -489,13 +493,15 @@ const shumaiPlugins = [
|
|||||||
}),
|
}),
|
||||||
tailwindPlugin,
|
tailwindPlugin,
|
||||||
]
|
]
|
||||||
await buildPlatformPackages('shumai', dummyRunnerPath)
|
const shumaiExternal = commonExternal.filter((dep) => dep !== 'zod')
|
||||||
|
await buildPlatformPackages('shumai', dummyRunnerPath, shumaiPlugins, shumaiExternal)
|
||||||
await buildMainPackage({
|
await buildMainPackage({
|
||||||
appName: 'shumai',
|
appName: 'shumai',
|
||||||
description: 'A fullstack AI-powered media workspace and workflow engine',
|
description: 'A fullstack AI-powered media workspace and workflow engine',
|
||||||
hasPrisma: true,
|
hasPrisma: true,
|
||||||
entrypoint: './apps/web/src/index.ts',
|
entrypoint: './apps/web/src/index.ts',
|
||||||
plugins: shumaiPlugins,
|
plugins: shumaiPlugins,
|
||||||
|
external: shumaiExternal,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 3. Build shumai-agent (Agent app & platform binaries)
|
// 3. Build shumai-agent (Agent app & platform binaries)
|
||||||
|
|||||||
Reference in New Issue
Block a user