Skip to content

fix(deps): update dependency tempy to v3 #5389

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

Merged
merged 3 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
120 changes: 98 additions & 22 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/functions/runtimes/go/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 })
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/deploy/deploy-site.mjs
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -45,7 +45,7 @@ export const deploySite = async (
/* default to noop */
},
syncFileLimit = DEFAULT_SYNC_LIMIT,
tmpDir = tempy.directory(),
tmpDir = temporaryDirectory(),
rootDir,
} = {},
) => {
Expand Down
9 changes: 6 additions & 3 deletions tests/integration/500.command.dev.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/utils/mock-execa.cjs
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/utils/deploy/hash-fns.test.mjs
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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() {},
})
Expand Down