@@ -5,15 +5,17 @@ import path from "node:path";
5
5
const args = process . argv . slice ( 2 ) ;
6
6
const tsc = process . env . CI || args . includes ( "--tsc" ) ;
7
7
8
+ // pnpm workspaces do not understand Deno projects and vice versa so we need a way to specify which projects need their node_modules updating
9
+ const denoNodeModulesPaths = args
10
+ . find ( ( arg ) => arg . includes ( "--deno-node-modules-paths=" ) )
11
+ ?. split ( "=" ) [ 1 ]
12
+ . split ( "," ) ;
13
+ console . log ( "denoNodeModulesPaths" , denoNodeModulesPaths ) ;
14
+
8
15
const ROOT_DIR = process . cwd ( ) ;
9
16
const PACKAGES_PATH = path . join ( ROOT_DIR , "packages" ) ;
10
17
const DEFAULT_BUILD_PATH = path . join ( ROOT_DIR , "build" ) ;
11
18
12
- // pnpm workspaces do not understand Deno projects and vice versa so we need to specify which projects need their node_modules updating
13
- const DENO_NODE_MODULES_PATHS = [
14
- path . join ( ROOT_DIR , "integration/helpers/vite-deno-template/node_modules" ) ,
15
- ] ;
16
-
17
19
let activeOutputDir = DEFAULT_BUILD_PATH ;
18
20
if ( process . env . LOCAL_BUILD_DIRECTORY ) {
19
21
let appDir = path . resolve ( process . env . LOCAL_BUILD_DIRECTORY ) ;
@@ -64,25 +66,27 @@ async function copyBuildToDist() {
64
66
let copyQueue = [ ] ;
65
67
for ( let pkg of packages ) {
66
68
try {
67
- // Copy entire build artifact to node_modules dir for each Deno project that requires it
68
- for ( let denoNodeModulesPath of DENO_NODE_MODULES_PATHS ) {
69
- let destPath = path . join ( denoNodeModulesPath , pkg . nodeModulesPath ) ;
70
- if ( await fse . pathExists ( destPath ) ) {
71
- copyQueue . push (
72
- ( async ( ) => {
73
- console . log (
74
- chalk . yellow (
75
- ` 🛠 🦕 Copying ${ path . relative (
76
- ROOT_DIR ,
77
- pkg . build
78
- ) } to ${ path . relative ( ROOT_DIR , destPath ) } `
79
- )
80
- ) ;
81
- fse . copy ( pkg . build , destPath , {
82
- recursive : true ,
83
- } ) ;
84
- } ) ( )
85
- ) ;
69
+ if ( denoNodeModulesPaths ) {
70
+ // Copy entire build artifact to node_modules dir for each Deno project that requires it
71
+ for ( let denoNodeModulesPath of denoNodeModulesPaths ) {
72
+ let destPath = path . join ( denoNodeModulesPath , pkg . nodeModulesPath ) ;
73
+ if ( await fse . pathExists ( destPath ) ) {
74
+ copyQueue . push (
75
+ ( async ( ) => {
76
+ console . log (
77
+ chalk . yellow (
78
+ ` 🛠 🦕 Copying ${ path . relative (
79
+ ROOT_DIR ,
80
+ pkg . build
81
+ ) } to ${ path . relative ( ROOT_DIR , destPath ) } `
82
+ )
83
+ ) ;
84
+ fse . copy ( pkg . build , destPath , {
85
+ recursive : true ,
86
+ } ) ;
87
+ } ) ( )
88
+ ) ;
89
+ }
86
90
}
87
91
}
88
92
0 commit comments