@@ -20,32 +20,36 @@ import { AssemblerHooks } from './hooks.js'
2020import type { BundlerOptions } from './types.js'
2121import { run , parseConfig , copyFiles } from './helpers.js'
2222
23- type SupportedPackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'
23+ type SupportedPackageManager = 'npm' | 'yarn' | 'yarn@berry' | ' pnpm' | 'bun'
2424
2525/**
2626 * List of package managers we support in order to
2727 * copy lockfiles
2828 */
2929const SUPPORT_PACKAGE_MANAGERS : {
3030 [ K in SupportedPackageManager ] : {
31- lockFile : string
31+ packageManagerFiles : string [ ]
3232 installCommand : string
3333 }
3434} = {
35- npm : {
36- lockFile : 'package-lock.json' ,
35+ ' npm' : {
36+ packageManagerFiles : [ 'package-lock.json' ] ,
3737 installCommand : 'npm ci --omit="dev"' ,
3838 } ,
39- yarn : {
40- lockFile : 'yarn.lock' ,
39+ ' yarn' : {
40+ packageManagerFiles : [ 'yarn.lock' ] ,
4141 installCommand : 'yarn install --production' ,
4242 } ,
43- pnpm : {
44- lockFile : 'pnpm-lock.yaml' ,
43+ 'yarn@berry' : {
44+ packageManagerFiles : [ 'yarn.lock' , '.yarn/**/*' , '.yarnrc.yml' ] ,
45+ installCommand : 'yarn workspaces focus --production' ,
46+ } ,
47+ 'pnpm' : {
48+ packageManagerFiles : [ 'pnpm-lock.yaml' ] ,
4549 installCommand : 'pnpm i --prod' ,
4650 } ,
47- bun : {
48- lockFile : 'bun.lockb' ,
51+ ' bun' : {
52+ packageManagerFiles : [ 'bun.lockb' ] ,
4953 installCommand : 'bun install --production' ,
5054 } ,
5155}
@@ -264,7 +268,9 @@ export class Bundler {
264268 * Step 6: Copy meta files to the build directory
265269 */
266270 const pkgManager = await this . #getPackageManager( client )
267- const pkgFiles = pkgManager ? [ 'package.json' , pkgManager . lockFile ] : [ 'package.json' ]
271+ const pkgFiles = pkgManager
272+ ? [ 'package.json' , ...pkgManager . packageManagerFiles ]
273+ : [ 'package.json' ]
268274 this . #logger. info ( 'copying meta files to the output directory' )
269275 await this . #copyMetaFiles( outDir , pkgFiles )
270276
0 commit comments