Skip to content

Commit c7d2b76

Browse files
committed
refactor: use fs.cp promises API instead of cpSync
Use async fs.cp() instead of sync cpSync() for better performance and consistency with async/await patterns.
1 parent b1dc44d commit c7d2b76

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/cli-with-sentry/scripts/build.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copies data/ and images from packages/cli.
55
*/
66

7-
import { cpSync } from 'node:fs'
7+
import { promises as fs } from 'node:fs'
88
import { spawn } from 'node:child_process'
99
import path from 'node:path'
1010
import { fileURLToPath } from 'node:url'
@@ -57,7 +57,7 @@ async function main() {
5757

5858
// Copy data directory from packages/cli.
5959
logger.log(`${colors.blue('ℹ')} Copying data/ from packages/cli...`)
60-
cpSync(path.join(cliPath, 'data'), path.join(rootPath, 'data'), {
60+
await fs.cp(path.join(cliPath, 'data'), path.join(rootPath, 'data'), {
6161
recursive: true,
6262
})
6363
logger.log(`${colors.green('✓')} Copied data/`)
@@ -66,7 +66,7 @@ async function main() {
6666
logger.log(`${colors.blue('ℹ')} Copying images from repo root...`)
6767
const images = ['logo-dark.png', 'logo-light.png']
6868
for (const image of images) {
69-
cpSync(path.join(repoRoot, image), path.join(rootPath, image))
69+
await fs.cp(path.join(repoRoot, image), path.join(rootPath, image))
7070
}
7171
logger.log(`${colors.green('✓')} Copied images`)
7272
} catch (error) {

packages/cli/scripts/copy-logos.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @fileoverview Copy logo images from repo root to packages/cli.
44
*/
55

6-
import { cpSync } from 'node:fs'
6+
import { promises as fs } from 'node:fs'
77
import path from 'node:path'
88
import { fileURLToPath } from 'node:url'
99

@@ -14,7 +14,7 @@ const repoRoot = path.resolve(__dirname, '../../..')
1414
const images = ['logo-dark.png', 'logo-light.png']
1515

1616
for (const image of images) {
17-
cpSync(path.join(repoRoot, image), path.join(packageRoot, image))
17+
await fs.cp(path.join(repoRoot, image), path.join(packageRoot, image))
1818
}
1919

2020
console.log('✓ Copied logos from repo root')

0 commit comments

Comments
 (0)