({
files,
entrypoint,
workPath,
config,
meta,
considerBuildCommand,
}: DownloadOptions)
| 67 | const libPathRegEx = /^node_modules|[/\\]node_modules[/\\]/; |
| 68 | |
| 69 | async function downloadInstallAndBundle({ |
| 70 | files, |
| 71 | entrypoint, |
| 72 | workPath, |
| 73 | config, |
| 74 | meta, |
| 75 | considerBuildCommand, |
| 76 | }: DownloadOptions) { |
| 77 | const downloadedFiles = await download(files, workPath, meta); |
| 78 | const entrypointFsDirname = join(workPath, dirname(entrypoint)); |
| 79 | const nodeVersion = await getNodeVersion( |
| 80 | entrypointFsDirname, |
| 81 | undefined, |
| 82 | config, |
| 83 | meta |
| 84 | ); |
| 85 | |
| 86 | const { |
| 87 | cliType, |
| 88 | lockfilePath, |
| 89 | lockfileVersion, |
| 90 | packageJsonPackageManager, |
| 91 | turboSupportsCorepackHome, |
| 92 | } = await scanParentDirs(entrypointFsDirname, true); |
| 93 | |
| 94 | const spawnEnv = getEnvForPackageManager({ |
| 95 | cliType, |
| 96 | lockfileVersion, |
| 97 | packageJsonPackageManager, |
| 98 | env: process.env, |
| 99 | turboSupportsCorepackHome, |
| 100 | projectCreatedAt: config.projectSettings?.createdAt, |
| 101 | }); |
| 102 | |
| 103 | const installCommand = config.projectSettings?.installCommand; |
| 104 | if (typeof installCommand === 'string' && considerBuildCommand) { |
| 105 | if (installCommand.trim()) { |
| 106 | console.log(`Running "install" command: \`${installCommand}\`...`); |
| 107 | await execCommand(installCommand, { |
| 108 | env: spawnEnv, |
| 109 | cwd: entrypointFsDirname, |
| 110 | }); |
| 111 | } else { |
| 112 | console.log(`Skipping "install" command...`); |
| 113 | } |
| 114 | } else { |
| 115 | await runNpmInstall( |
| 116 | entrypointFsDirname, |
| 117 | [], |
| 118 | { env: spawnEnv }, |
| 119 | meta, |
| 120 | config.projectSettings?.createdAt |
| 121 | ); |
| 122 | } |
| 123 | const entrypointPath = downloadedFiles[entrypoint].fsPath; |
| 124 | return { |
| 125 | entrypointPath, |
| 126 | entrypointFsDirname, |
no test coverage detected