Skip to content

Commit 3f3a720

Browse files
fix(deps): update dependency cpy to v9 (#5011)
1 parent 19b45ee commit 3f3a720

File tree

11 files changed

+265
-3753
lines changed

11 files changed

+265
-3753
lines changed

package-lock.json

Lines changed: 235 additions & 3719 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"ava": "^4.0.0",
125125
"c8": "^7.12.0",
126126
"copyfiles": "^2.4.1",
127-
"cpy": "^8.1.0",
127+
"cpy": "^9.0.0",
128128
"fast-safe-stringify": "^2.0.7",
129129
"get-bin-path": "^6.0.0",
130130
"get-node": "^12.0.0",

packages/build/tests/plugins_list/tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test('Use plugins cached in .netlify/plugins/', async (t) => {
7171
test('Do not use plugins cached in .netlify/plugins/ if outdated', async (t) => {
7272
const pluginsDir = `${FIXTURES_DIR}/plugins_cache_outdated/.netlify/plugins`
7373
await removeDir(pluginsDir)
74-
await cpy('**', '../plugins', { cwd: `${pluginsDir}-old`, parents: true })
74+
await cpy('**', '../plugins', { cwd: `${pluginsDir}-old` })
7575
try {
7676
await runWithApiMock(t, 'plugins_cache_outdated')
7777
} finally {

packages/cache-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"license": "MIT",
5252
"dependencies": {
53-
"cpy": "^8.1.0",
53+
"cpy": "^9.0.0",
5454
"get-stream": "^6.0.0",
5555
"globby": "^13.0.0",
5656
"junk": "^4.0.0",

packages/cache-utils/src/fs.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { promises as fs, Stats } from 'fs'
2-
import { basename, dirname } from 'path'
2+
import { basename, dirname, join } from 'path'
33

44
import cpy from 'cpy'
55
import { Options, globby } from 'globby'
@@ -18,17 +18,18 @@ export const moveCacheFile = async function (src: string, dest: string, move = f
1818
return moveFile(src, dest, { overwrite: false })
1919
}
2020

21-
const { srcGlob, ...options } = await getSrcGlob(src)
22-
if (srcGlob) {
23-
return cpy(srcGlob, dirname(dest), { ...options, parents: true, overwrite: false })
21+
const { srcGlob, dest: matchedDest, ...options } = await getSrcAndDest(src, dirname(dest))
22+
if (srcGlob && matchedDest) {
23+
return cpy(srcGlob, matchedDest, { ...options, overwrite: false })
2424
}
2525
}
2626

2727
/**
2828
* Non-existing files and empty directories are always skipped
2929
*/
3030
export const hasFiles = async function (src: string): Promise<boolean> {
31-
const { srcGlob, isDir, ...options } = await getSrcGlob(src)
31+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
32+
const { srcGlob, isDir, dest, ...options } = await getSrcAndDest(src, '')
3233
return srcGlob !== undefined && !(await isEmptyDir(srcGlob, isDir, options))
3334
}
3435

@@ -45,6 +46,7 @@ const isEmptyDir = async function (globPattern: string, isDir: boolean, options:
4546

4647
type GlobOptions = {
4748
srcGlob?: string
49+
dest?: string
4850
isDir: boolean
4951
cwd: string
5052
dot?: boolean
@@ -53,7 +55,7 @@ type GlobOptions = {
5355
/**
5456
* Get globbing pattern with files to move/copy
5557
*/
56-
const getSrcGlob = async function (src: string): Promise<GlobOptions> {
58+
const getSrcAndDest = async function (src: string, dest: string): Promise<GlobOptions> {
5759
const srcStat = await getStat(src)
5860

5961
if (srcStat === undefined) {
@@ -66,13 +68,14 @@ const getSrcGlob = async function (src: string): Promise<GlobOptions> {
6668

6769
const baseOptions: GlobOptions = {
6870
srcGlob: srcBasename,
71+
dest,
6972
isDir,
7073
cwd,
7174
dot: true, // collect .dot directories as well
7275
}
7376

7477
if (isDir) {
75-
return { ...baseOptions, srcGlob: `${srcBasename}/**` }
78+
return { ...baseOptions, srcGlob: `${srcBasename}/**`, dest: join(dest, srcBasename) }
7679
}
7780

7881
return baseOptions

packages/functions-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"license": "MIT",
5252
"dependencies": {
5353
"@netlify/zip-it-and-ship-it": "9.5.0",
54-
"cpy": "^8.1.0",
54+
"cpy": "^9.0.0",
5555
"path-exists": "^5.0.0"
5656
},
5757
"devDependencies": {

packages/functions-utils/src/main.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { promises as fs } from 'fs'
2-
import { basename, dirname } from 'path'
2+
import { basename, dirname, join } from 'path'
33

44
import { listFunctions, listFunctionsFiles } from '@netlify/zip-it-and-ship-it'
55
import cpy from 'cpy'
@@ -21,18 +21,18 @@ export const add = async function (src?: string, dist?: string, { fail = default
2121
}
2222

2323
const srcBasename = basename(src)
24-
const srcGlob = await getSrcGlob(src, srcBasename)
25-
await cpy(srcGlob, dist, { cwd: dirname(src), parents: true, overwrite: true })
24+
const [srcGlob, dest] = await getSrcAndDest(src, srcBasename, dist)
25+
await cpy(srcGlob, dest, { cwd: dirname(src), overwrite: true })
2626
}
2727

28-
const getSrcGlob = async function (src, srcBasename) {
28+
const getSrcAndDest = async function (src: string, srcBasename: string, dist: string): Promise<[string, string]> {
2929
const srcStat = await fs.stat(src)
3030

3131
if (srcStat.isDirectory()) {
32-
return `${srcBasename}/**`
32+
return [`${srcBasename}/**`, join(dist, srcBasename)]
3333
}
3434

35-
return srcBasename
35+
return [srcBasename, dist]
3636
}
3737

3838
export const list = async function (functionsSrc, { fail = defaultFail } = {} as any) {

packages/testing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@types/node": "^18.14.2",
2323
"ava": "^4.0.0",
2424
"c8": "^7.12.0",
25-
"cpy": "^8.1.0",
25+
"cpy": "^9.0.0",
2626
"execa": "^6.0.0",
2727
"fast-safe-stringify": "^2.0.7",
2828
"figures": "^4.0.0",

packages/testing/src/fixture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class Fixture {
147147
} = { git: true },
148148
): Promise<this> {
149149
this.copyRootDir = normalize(createRepoDir(copyRoot.git))
150-
await cpy('**', this.copyRootDir, { cwd: this.repositoryRoot, parents: true })
150+
await cpy('./**', this.copyRootDir, { cwd: this.repositoryRoot })
151151

152152
if (copyRoot.branch !== undefined) {
153153
await execaCommand(`git checkout -b ${copyRoot.branch}`, { cwd: this.copyRootDir })

renovate.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["github>netlify/renovate-config:esm"],
4+
"ignorePresets": [":prHourlyLimit2"],
5+
"semanticCommits": "enabled",
6+
"dependencyDashboard": true,
7+
"automerge": true
8+
}

renovate.json5

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)