From 1984ec379baf1254567cb691eed127250a289f15 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 21:54:00 +0000 Subject: [PATCH 1/2] fix(deps): update dependency tempy to v3 --- npm-shrinkwrap.json | 120 ++++++++++++++++++++++++++++++++++++-------- package.json | 2 +- 2 files changed, 99 insertions(+), 23 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 09143a4ea81..13c9a3536b2 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -102,7 +102,7 @@ "string-similarity": "^4.0.4", "strip-ansi-control-characters": "^2.0.0", "tabtab": "^3.0.2", - "tempy": "^1.0.0", + "tempy": "^3.0.0", "terminal-link": "^2.1.1", "through2-filter": "^3.0.0", "through2-map": "^3.0.0", @@ -22204,16 +22204,40 @@ } }, "node_modules/tempy": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tempy/-/tempy-1.0.1.tgz", - "integrity": "sha512-biM9brNqxSc04Ee71hzFbryD11nX7VPhQQY32AdDmjFvodsRFz/3ufeoTZ6uYkRFfGo188tENcASNs3vTdsM0w==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.0.0.tgz", + "integrity": "sha512-B2I9X7+o2wOaW4r/CWMkpOO9mdiTRCxXNgob6iGvPmfPWgH/KyUD6Uy5crtWBxIBe3YrNZKR2lSzv1JJKWD4vA==", "dependencies": { - "del": "^6.0.0", - "is-stream": "^2.0.0", + "is-stream": "^3.0.0", "temp-dir": "^2.0.0", - "type-fest": "^0.16.0", - "unique-string": "^2.0.0" + "type-fest": "^2.12.2", + "unique-string": "^3.0.0" + }, + "engines": { + "node": ">=14.16" }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/crypto-random-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", + "integrity": "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==", + "dependencies": { + "type-fest": "^1.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/crypto-random-string/node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", "engines": { "node": ">=10" }, @@ -22221,12 +22245,37 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/tempy/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tempy/node_modules/type-fest": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.16.0.tgz", - "integrity": "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", "engines": { - "node": ">=10" + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/unique-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", + "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", + "dependencies": { + "crypto-random-string": "^4.0.0" + }, + "engines": { + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -40725,21 +40774,48 @@ "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==" }, "tempy": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tempy/-/tempy-1.0.1.tgz", - "integrity": "sha512-biM9brNqxSc04Ee71hzFbryD11nX7VPhQQY32AdDmjFvodsRFz/3ufeoTZ6uYkRFfGo188tENcASNs3vTdsM0w==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.0.0.tgz", + "integrity": "sha512-B2I9X7+o2wOaW4r/CWMkpOO9mdiTRCxXNgob6iGvPmfPWgH/KyUD6Uy5crtWBxIBe3YrNZKR2lSzv1JJKWD4vA==", "requires": { - "del": "^6.0.0", - "is-stream": "^2.0.0", + "is-stream": "^3.0.0", "temp-dir": "^2.0.0", - "type-fest": "^0.16.0", - "unique-string": "^2.0.0" + "type-fest": "^2.12.2", + "unique-string": "^3.0.0" }, "dependencies": { + "crypto-random-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", + "integrity": "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==", + "requires": { + "type-fest": "^1.0.1" + }, + "dependencies": { + "type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==" + } + } + }, + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==" + }, "type-fest": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.16.0.tgz", - "integrity": "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg==" + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==" + }, + "unique-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", + "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", + "requires": { + "crypto-random-string": "^4.0.0" + } } } }, diff --git a/package.json b/package.json index c6471a5ca0a..a3375033594 100644 --- a/package.json +++ b/package.json @@ -167,7 +167,7 @@ "string-similarity": "^4.0.4", "strip-ansi-control-characters": "^2.0.0", "tabtab": "^3.0.2", - "tempy": "^1.0.0", + "tempy": "^3.0.0", "terminal-link": "^2.1.1", "through2-filter": "^3.0.0", "through2-map": "^3.0.0", From ce4c53cc38f51963c8caf5b35d5db70c9c584198 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Wed, 8 Feb 2023 23:05:53 +0100 Subject: [PATCH 2/2] chore: update api --- src/lib/functions/runtimes/go/index.mjs | 4 ++-- src/utils/deploy/deploy-site.mjs | 4 ++-- tests/integration/500.command.dev.test.cjs | 9 ++++++--- tests/integration/utils/mock-execa.cjs | 5 ++--- tests/unit/utils/deploy/hash-fns.test.mjs | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib/functions/runtimes/go/index.mjs b/src/lib/functions/runtimes/go/index.mjs index 87d674e6959..8814d14a5bf 100644 --- a/src/lib/functions/runtimes/go/index.mjs +++ b/src/lib/functions/runtimes/go/index.mjs @@ -2,7 +2,7 @@ import { dirname, extname } from 'path' import { platform } from 'process' -import tempy from 'tempy' +import { temporaryFile } from 'tempy' import execa from '../../../../utils/execa.mjs' import { runFunctionsProxy } from '../../local-proxy.mjs' @@ -41,7 +41,7 @@ const checkGoInstallation = async ({ cwd }) => { export const getBuildFunction = ({ func }) => { const functionDirectory = dirname(func.mainFile) - const binaryPath = tempy.file(isWindows ? { extension: 'exe' } : undefined) + const binaryPath = temporaryFile(isWindows ? { extension: 'exe' } : undefined) return () => build({ binaryPath, functionDirectory }) } diff --git a/src/utils/deploy/deploy-site.mjs b/src/utils/deploy/deploy-site.mjs index 1425f80b6a2..99f0ae66b74 100644 --- a/src/utils/deploy/deploy-site.mjs +++ b/src/utils/deploy/deploy-site.mjs @@ -1,7 +1,7 @@ import { rm } from 'fs/promises' import cleanDeep from 'clean-deep' -import tempy from 'tempy' +import { temporaryDirectory } from 'tempy' import { deployFileNormalizer, getDistPathIfExists, isEdgeFunctionFile } from '../../lib/edge-functions/deploy.mjs' import { warn } from '../command-helpers.mjs' @@ -45,7 +45,7 @@ export const deploySite = async ( /* default to noop */ }, syncFileLimit = DEFAULT_SYNC_LIMIT, - tmpDir = tempy.directory(), + tmpDir = temporaryDirectory(), rootDir, } = {}, ) => { diff --git a/tests/integration/500.command.dev.test.cjs b/tests/integration/500.command.dev.test.cjs index a509df87394..5b00ab04ab6 100644 --- a/tests/integration/500.command.dev.test.cjs +++ b/tests/integration/500.command.dev.test.cjs @@ -7,7 +7,6 @@ const avaTest = require('ava') const { isCI } = require('ci-info') const FormData = require('form-data') const getPort = require('get-port') -const tempy = require('tempy') const { withDevServer } = require('./utils/dev-server.cjs') const got = require('./utils/got.cjs') @@ -395,7 +394,9 @@ test('Runs build plugins with the `onPreDev` event', async (t) => { }, }; ` - const pluginDirectory = await tempy.directory() + + const { temporaryDirectory } = await import('tempy') + const pluginDirectory = await temporaryDirectory() await fs.writeFile(path.join(pluginDirectory, 'manifest.yml'), pluginManifest) await fs.writeFile(path.join(pluginDirectory, 'index.js'), pluginSource) @@ -440,7 +441,9 @@ test('Handles errors from the `onPreDev` event', async (t) => { }, }; ` - const pluginDirectory = await tempy.directory() + + const { temporaryDirectory } = await import('tempy') + const pluginDirectory = await temporaryDirectory() await fs.writeFile(path.join(pluginDirectory, 'manifest.yml'), pluginManifest) await fs.writeFile(path.join(pluginDirectory, 'index.js'), pluginSource) diff --git a/tests/integration/utils/mock-execa.cjs b/tests/integration/utils/mock-execa.cjs index d53373657ef..2d7adb3c8cb 100644 --- a/tests/integration/utils/mock-execa.cjs +++ b/tests/integration/utils/mock-execa.cjs @@ -1,14 +1,13 @@ const { rm, writeFile } = require('fs').promises const { pathToFileURL } = require('url') -const tempy = require('tempy') - // Saves to disk a JavaScript file with the contents provided and returns // an environment variable that replaces the `execa` module implementation. // A cleanup method is also returned, allowing the consumer to remove the // mock file. const createMock = async (contents) => { - const path = tempy.file({ extension: 'js' }) + const { temporaryFile } = await import('tempy') + const path = temporaryFile({ extension: 'js' }) await writeFile(path, contents) diff --git a/tests/unit/utils/deploy/hash-fns.test.mjs b/tests/unit/utils/deploy/hash-fns.test.mjs index 5054ced118a..4e6d7dea91c 100644 --- a/tests/unit/utils/deploy/hash-fns.test.mjs +++ b/tests/unit/utils/deploy/hash-fns.test.mjs @@ -1,4 +1,4 @@ -import tempy from 'tempy' +import { temporaryDirectory } from 'tempy' import { expect, test } from 'vitest' import { DEFAULT_CONCURRENT_HASH } from '../../../../src/utils/deploy/constants.mjs' @@ -21,7 +21,7 @@ test('Hashes files in a folder', async () => { const expectedFunctions = ['hello', 'goodbye'] const { fnShaMap, functions } = await hashFns(`${builder.directory}/functions`, { - tmpDir: tempy.directory(), + tmpDir: temporaryDirectory(), concurrentHash: DEFAULT_CONCURRENT_HASH, statusCb() {}, })