@@ -20,32 +20,36 @@ import { AssemblerHooks } from './hooks.js'
20
20
import type { BundlerOptions } from './types.js'
21
21
import { run , parseConfig , copyFiles } from './helpers.js'
22
22
23
- type SupportedPackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'
23
+ type SupportedPackageManager = 'npm' | 'yarn' | 'yarn@berry' | ' pnpm' | 'bun'
24
24
25
25
/**
26
26
* List of package managers we support in order to
27
27
* copy lockfiles
28
28
*/
29
29
const SUPPORT_PACKAGE_MANAGERS : {
30
30
[ K in SupportedPackageManager ] : {
31
- lockFile : string
31
+ packageManagerFiles : string [ ]
32
32
installCommand : string
33
33
}
34
34
} = {
35
- npm : {
36
- lockFile : 'package-lock.json' ,
35
+ ' npm' : {
36
+ packageManagerFiles : [ 'package-lock.json' ] ,
37
37
installCommand : 'npm ci --omit="dev"' ,
38
38
} ,
39
- yarn : {
40
- lockFile : 'yarn.lock' ,
39
+ ' yarn' : {
40
+ packageManagerFiles : [ 'yarn.lock' ] ,
41
41
installCommand : 'yarn install --production' ,
42
42
} ,
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' ] ,
45
49
installCommand : 'pnpm i --prod' ,
46
50
} ,
47
- bun : {
48
- lockFile : 'bun.lockb' ,
51
+ ' bun' : {
52
+ packageManagerFiles : [ 'bun.lockb' ] ,
49
53
installCommand : 'bun install --production' ,
50
54
} ,
51
55
}
@@ -264,7 +268,9 @@ export class Bundler {
264
268
* Step 6: Copy meta files to the build directory
265
269
*/
266
270
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' ]
268
274
this . #logger. info ( 'copying meta files to the output directory' )
269
275
await this . #copyMetaFiles( outDir , pkgFiles )
270
276
0 commit comments