Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improves node_modules copy time #2209

Closed
wants to merge 16 commits into from
Closed
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/cli/src/utils/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
writeFileSync,
writeJsonSync,
} from 'fs-extra'
import { execSync } from 'child_process'

import path from 'path'

Expand Down Expand Up @@ -75,7 +76,7 @@
}

function copyPublicFiles() {
const allowList = ["json", "txt", "xml", "ico", "public"]
const allowList = ['json', 'txt', 'xml', 'ico', 'public']
try {
if (existsSync(`${userDir}/public`)) {
copySync(`${userDir}/public`, `${tmpDir}/public`, {
Expand All @@ -84,7 +85,7 @@
const allow = allowList.some((ext) => src.endsWith(ext))

return allow
}
},
})
console.log(`${chalk.green('success')} - Public files copied`)
}
Expand Down Expand Up @@ -254,7 +255,12 @@

function copyUserNodeModules() {
try {
copySync(userNodeModulesDir, tmpNodeModulesDir)
// Create .tar file with all user's `node_modules` content
execSync(`tar -cf ${tmpNodeModulesDir}.tar ${userNodeModulesDir}`)
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed

// Extract `node_modules` content to the temporary directory
execSync(`tar -xf ${tmpNodeModulesDir}.tar -C ${tmpNodeModulesDir}`)
Fixed Show fixed Hide fixed

console.log(
`${chalk.green('success')} - ${chalk.dim('node_modules')} files copied`
)
Expand Down
Loading