Skip to content
Draft
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
16 changes: 6 additions & 10 deletions src/utils/deploy/hash-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,25 @@ import { createHash } from 'node:crypto'

import tomlify from 'tomlify-j0.4'

// @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
export const hashConfig = ({ config }) => {
if (!config) throw new Error('Missing config option')
import type { NormalizedCachedConfigConfig } from '../command-helpers.js'

export const hashConfig = ({ config }: { config: NormalizedCachedConfigConfig }) => {
const configString = serializeToml(config)

const hash = createHash('sha1').update(configString).digest('hex')

return {
assetType: 'file',
assetType: 'file' as const,
body: configString,
hash,
normalizedPath: 'netlify.toml',
}
}

// @ts-expect-error TS(7006) FIXME: Parameter 'object' implicitly has an 'any' type.
export const serializeToml = function (object) {
export const serializeToml = function (object: unknown) {
return tomlify.toToml(object, { space: 2, replace: replaceTomlValue })
}

// `tomlify-j0.4` serializes integers as floats, e.g. `200.0`.
// This is a problem with `redirects[*].status`.
// @ts-expect-error TS(7006) FIXME: Parameter 'key' implicitly has an 'any' type.
const replaceTomlValue = function (key, value) {
const replaceTomlValue = function (key: string, value: unknown) {
return Number.isInteger(value) ? String(value) : false
}
86 changes: 60 additions & 26 deletions src/utils/deploy/upload-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,56 @@

import backoff from 'backoff'
import pMap from 'p-map'
import type { NetlifyAPI } from '@netlify/api'

import { UPLOAD_INITIAL_DELAY, UPLOAD_MAX_DELAY, UPLOAD_RANDOM_FACTOR } from './constants.js'

// @ts-expect-error TS(7006) FIXME: Parameter 'api' implicitly has an 'any' type.
const uploadFiles = async (api, deployId, uploadList, { concurrentUpload, maxRetry, statusCb }) => {
if (!concurrentUpload || !statusCb || !maxRetry) throw new Error('Missing required option concurrentUpload')
export interface FileObject {
assetType: 'file' | 'function'
body?: string | Buffer | fs.ReadStream
filepath?: string
invocationMode?: string
normalizedPath: string
runtime?: string
timeout?: number
}

interface UploadStatus {
type: 'upload'
msg: string
phase: 'start' | 'progress' | 'stop'
}

interface UploadOptions {
concurrentUpload: number
maxRetry: number
statusCb: (status: UploadStatus) => void
}

const uploadFiles = async (
api: Pick<NetlifyAPI, 'uploadDeployFile' | 'uploadDeployFunction'>,
deployId: string,
uploadList: FileObject[],
{ concurrentUpload, maxRetry, statusCb }: UploadOptions,
) => {
statusCb({
type: 'upload',
msg: `Uploading ${uploadList.length} files`,
phase: 'start',
})

// @ts-expect-error TS(7006) FIXME: Parameter 'fileObj' implicitly has an 'any' type.
const uploadFile = async (fileObj, index) => {
const uploadFile = async (fileObj: FileObject, index: number) => {
const { assetType, body, filepath, invocationMode, normalizedPath, runtime, timeout } = fileObj

const readStreamCtor = () => body ?? fs.createReadStream(filepath)
const readStreamCtor = () => {
if (body) {
return body
}
if (filepath) {
return fs.createReadStream(filepath)
}
throw new Error(`Missing body or filepath for asset ${normalizedPath}`)
}

statusCb({
type: 'upload',
Expand All @@ -30,8 +63,8 @@
case 'file': {
response = await retryUpload(
() =>
api.uploadDeployFile({
(api as unknown as NetlifyAPI).uploadDeployFile({
body: readStreamCtor,

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (ubuntu-latest, 22.x)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (ubuntu-latest, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (ubuntu-latest, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / typecheck

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (ubuntu-latest, 22)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (ubuntu-latest, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 22, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (ubuntu-latest, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 22, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 24, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 22, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 24, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 24, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 22, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 20.12.2, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (macOS-latest, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (macOS-latest, 22.x)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 24, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 22, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 20.12.2, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (macOS-latest, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (macOS-latest, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (macOS-latest, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (macOS-latest, 22)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 22, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 20.12.2, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 24, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 24, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 20.12.2, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 20.12.2, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 24, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 20.12.2, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 22, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 22, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 24, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 20.12.2, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 20.12.2, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (windows-2025, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E Windows tests (windows-2025, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (windows-2025, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E Windows tests (windows-2025, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 22, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 20.12.2, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 24, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 20.12.2, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 22, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 24, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 22, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 20.12.2, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 20.12.2, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E Windows tests (windows-2025, 22)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 22, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 24, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 67 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 24, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.
deployId,
path: encodeURI(normalizedPath),
}),
Expand All @@ -40,10 +73,9 @@
break
}
case 'function': {
// @ts-expect-error TS(7006) FIXME: Parameter 'retryCount' implicitly has an 'any' typ... Remove this comment to see the full error message
response = await retryUpload((retryCount) => {
const params = {
response = await retryUpload((retryCount: number) => {
const params: Parameters<NetlifyAPI['uploadDeployFunction']>[0] & { xNfRetryCount?: number } = {
body: readStreamCtor,

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (ubuntu-latest, 22.x)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (ubuntu-latest, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (ubuntu-latest, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / typecheck

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (ubuntu-latest, 22)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (ubuntu-latest, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 22, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (ubuntu-latest, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 22, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 24, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 22, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 24, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 24, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 22, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 20.12.2, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (macOS-latest, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (macOS-latest, 22.x)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 24, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 22, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 20.12.2, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (macOS-latest, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (macOS-latest, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (macOS-latest, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E (macOS-latest, 22)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 22, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 20.12.2, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 24, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 24, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 20.12.2, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 20.12.2, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (ubuntu-latest, 24, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 20.12.2, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 22, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 22, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 24, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 20.12.2, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (macOS-latest, 20.12.2, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (windows-2025, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E Windows tests (windows-2025, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Unit (windows-2025, 20.12.2)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E Windows tests (windows-2025, 24)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 22, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 20.12.2, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 24, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 20.12.2, 2/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 22, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 24, 4/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 22, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 20.12.2, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 20.12.2, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / E2E Windows tests (windows-2025, 22)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 22, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 24, 1/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.

Check failure on line 78 in src/utils/deploy/upload-files.ts

View workflow job for this annotation

GitHub Actions / Integration (windows-2025, 24, 3/4)

Type '() => string | Buffer<ArrayBufferLike> | fs.ReadStream' is not assignable to type 'ReadStream | (() => ReadStream) | undefined'.
deployId,
invocationMode,
timeout,
Expand All @@ -52,18 +84,16 @@
}

if (retryCount > 0) {
// @ts-expect-error TS(2339) FIXME: Property 'xNfRetryCount' does not exist on type '{... Remove this comment to see the full error message
params.xNfRetryCount = retryCount
}

return api.uploadDeployFunction(params)
return (api as unknown as NetlifyAPI).uploadDeployFunction(params)
}, maxRetry)
break
}
default: {
const error = new Error('File Object missing assetType property')
// @ts-expect-error TS(2339) FIXME: Property 'fileObj' does not exist on type 'Error'.
error.fileObj = fileObj
Object.assign(error, { fileObj })
throw error
}
}
Expand All @@ -80,11 +110,9 @@
return results
}

// @ts-expect-error TS(7006) FIXME: Parameter 'uploadFn' implicitly has an 'any' type.
const retryUpload = (uploadFn, maxRetry) =>
const retryUpload = <T>(uploadFn: (retryCount: number) => Promise<T>, maxRetry: number): Promise<T> =>
new Promise((resolve, reject) => {
// @ts-expect-error TS(7034) FIXME: Variable 'lastError' implicitly has type 'any' in ... Remove this comment to see the full error message
let lastError
let lastError: unknown

const fibonacciBackoff = backoff.fibonacci({
randomisationFactor: UPLOAD_RANDOM_FACTOR,
Expand All @@ -102,18 +130,25 @@
lastError = error

// We don't need to retry for 400 or 422 errors
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
if (error.status === 400 || error.status === 422) {
reject(error)
return
if (error && typeof error === 'object' && 'status' in error) {
const { status } = error as { status: number }
if (status === 400 || status === 422) {
reject(error)
return
}

// observed errors: 408, 401 (4** swallowed), 502
if (status > 400) {
fibonacciBackoff.backoff()
return
}
}

// observed errors: 408, 401 (4** swallowed), 502
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
if (error.status > 400 || error.name === 'FetchError') {
if (error && typeof error === 'object' && 'name' in error && error.name === 'FetchError') {
fibonacciBackoff.backoff()
return
}

reject(error)
return
}
Expand All @@ -130,7 +165,6 @@
fibonacciBackoff.on('ready', tryUpload)

fibonacciBackoff.on('fail', () => {
// @ts-expect-error TS(7005) FIXME: Variable 'lastError' implicitly has an 'any' type.
reject(lastError)
})

Expand Down
36 changes: 23 additions & 13 deletions src/utils/deploy/util.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { sep } from 'path'

import type { NetlifyAPI } from '@netlify/api'
import pWaitFor from 'p-wait-for'

import { DEPLOY_POLL } from './constants.js'
import type { FileObject } from './upload-files.js'

type Deploy = Awaited<ReturnType<NetlifyAPI['getSiteDeploy']>>

// normalize windows paths to unix paths
export const normalizePath = (relname: string): string => {
Expand All @@ -13,10 +17,14 @@ export const normalizePath = (relname: string): string => {
}

// poll an async deployId until its done diffing
// @ts-expect-error TS(7006) FIXME: Parameter 'api' implicitly has an 'any' type.
export const waitForDiff = async (api, deployId, siteId, timeout) => {
export const waitForDiff = async (
api: NetlifyAPI,
deployId: string,
siteId: string,
timeout: number,
): Promise<Deploy> => {
// capture ready deploy during poll
let deploy
let deploy: Deploy

const loadDeploy = async () => {
const siteDeploy = await api.getSiteDeploy({ siteId, deployId })
Expand All @@ -25,8 +33,7 @@ export const waitForDiff = async (api, deployId, siteId, timeout) => {
// https://github.com/netlify/bitballoon/blob/master/app/models/deploy.rb#L21-L33
case 'error': {
const deployError = new Error(siteDeploy.error_message || `Deploy ${deployId} had an error`)
// @ts-expect-error TS(2339) FIXME: Property 'deploy' does not exist on type 'Error'.
deployError.deploy = siteDeploy
Object.assign(deployError, { deploy: siteDeploy })
throw deployError
}
case 'prepared':
Expand All @@ -51,23 +58,27 @@ export const waitForDiff = async (api, deployId, siteId, timeout) => {
},
})

// @ts-expect-error TS(2454) FIXME: Variable 'deploy' is used before being assigned.
return deploy
}

// Poll a deployId until its ready
// @ts-expect-error TS(7006) FIXME: Parameter 'api' implicitly has an 'any' type.
export const waitForDeploy = async (api, deployId, siteId, timeout) => {
export const waitForDeploy = async (
api: NetlifyAPI,
deployId: string,
siteId: string,
timeout: number,
): Promise<Deploy> => {
// capture ready deploy during poll
let deploy
let deploy: Deploy

const loadDeploy = async () => {
const siteDeploy = await api.getSiteDeploy({ siteId, deployId })
switch (siteDeploy.state) {
// https://github.com/netlify/bitballoon/blob/master/app/models/deploy.rb#L21-L33
case 'error': {
const deployError = new Error(siteDeploy.error_message || `Deploy ${deployId} had an error`)
// @ts-expect-error TS(2339) FIXME: Property 'deploy' does not exist on type 'Error'.
deployError.deploy = siteDeploy
Object.assign(deployError, { deploy: siteDeploy })
throw deployError
}
case 'ready': {
Expand All @@ -92,13 +103,12 @@ export const waitForDeploy = async (api, deployId, siteId, timeout) => {
},
})

// @ts-expect-error TS(2454) FIXME: Variable 'deploy' is used before being assigned.
return deploy
}

// Transform the fileShaMap and fnShaMap into a generic shaMap that file-uploader.js can use
// @ts-expect-error TS(7006) FIXME: Parameter 'required' implicitly has an 'any' type.
export const getUploadList = (required, shaMap) => {
export const getUploadList = (required?: string[] | null, shaMap?: Record<string, FileObject[]> | null) => {
if (!required || !shaMap) return []
// @ts-expect-error TS(7006) FIXME: Parameter 'sha' implicitly has an 'any' type.
return required.flatMap((sha) => shaMap[sha])
}
63 changes: 36 additions & 27 deletions src/utils/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ const ENV_VAR_SOURCES = {
name: 'project settings',
printFn: chalk.blue,
},
}
} as const

const ERROR_CALL_TO_ACTION =
"Double-check your login status with 'netlify status' or contact support with details of your error."

// @ts-expect-error TS(7031) FIXME: Binding element 'site' implicitly has an 'any' typ... Remove this comment to see the full error message
const validateSiteInfo = ({ site, siteInfo }) => {
const validateSiteInfo = ({ site, siteInfo }: { site: { id?: string }; siteInfo: SiteInfo }) => {
if (isEmpty(siteInfo)) {
return logAndThrowError(
`Failed to retrieve project information for project ${chalk.yellow(site.id)}. ${ERROR_CALL_TO_ACTION}`,
Expand Down Expand Up @@ -78,10 +77,9 @@ const getAccounts = async ({ api }: { api: NetlifyAPI }) => {
}
}

// @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
const getAddons = async ({ api, site }) => {
const getAddons = async ({ api, site }: { api: NetlifyAPI; site: { id?: string } }) => {
try {
const addons = await api.listServiceInstancesForSite({ siteId: site.id })
const addons = await api.listServiceInstancesForSite({ siteId: site.id || '' })
return addons
} catch (error_) {
return logAndThrowError(
Expand All @@ -92,13 +90,16 @@ const getAddons = async ({ api, site }) => {
}
}

// @ts-expect-error TS(7031) FIXME: Binding element 'addons' implicitly has an 'any' t... Remove this comment to see the full error message
const getAddonsInformation = ({ addons, siteInfo }) => {
const getAddonsInformation = ({
addons,
siteInfo,
}: {
addons: Awaited<ReturnType<NetlifyAPI['listServiceInstancesForSite']>>
siteInfo: SiteInfo
}): { urls: Record<string, string>; env: Record<string, string> } => {
const urls = Object.fromEntries(
// @ts-expect-error TS(7006) FIXME: Parameter 'addon' implicitly has an 'any' type.
addons.map((addon) => [addon.service_slug, `${siteInfo.ssl_url}${addon.service_path}`]),
)
// @ts-expect-error TS(7006) FIXME: Parameter 'addon' implicitly has an 'any' type.
const env = Object.assign({}, ...addons.map((addon) => addon.env))
return { urls, env }
}
Expand Down Expand Up @@ -181,21 +182,28 @@ export const getSiteInformation = async ({
}
}

// @ts-expect-error TS(7006) FIXME: Parameter 'source' implicitly has an 'any' type.
const getEnvSourceName = (source) => {
// @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
const { name = source, printFn = chalk.green } = ENV_VAR_SOURCES[source] || {}

return printFn(name)
const getEnvSourceName = (source: string) => {
if (source in ENV_VAR_SOURCES) {
const envVarSource = ENV_VAR_SOURCES[source as keyof typeof ENV_VAR_SOURCES]
return envVarSource.printFn(envVarSource.name)
}
return chalk.green(source)
}

/**
* @param {{devConfig: any, env: Record<string, { sources: string[], value: string}>, site: any}} param0
*/
// @ts-expect-error TS(7031) FIXME: Binding element 'devConfig' implicitly has an 'any... Remove this comment to see the full error message
export const getDotEnvVariables = async ({ devConfig, env, site }): Promise<EnvironmentVariables> => {
const dotEnvFiles = await loadDotEnvFiles({ envFiles: devConfig.envFiles, projectDir: site.root })
// @ts-expect-error TS(2339) FIXME: Property 'env' does not exist on type '{ warning: ... Remove this comment to see the full error message
export const getDotEnvVariables = async ({
devConfig,
env,
site,
}: {
devConfig: { envFiles?: string[]; env_files?: string[] } & Record<string, unknown>
env: EnvironmentVariables
site: { root?: string }
}): Promise<EnvironmentVariables> => {
const dotEnvFiles = await loadDotEnvFiles({
envFiles: devConfig.envFiles || devConfig.env_files,
// eslint-disable-next-line no-restricted-properties
projectDir: site.root || process.cwd(),
})
dotEnvFiles.forEach(({ env: fileEnv, file }) => {
const newSourceName = `${file} file`

Expand Down Expand Up @@ -272,11 +280,12 @@ export const acquirePort = async ({
return acquiredPort
}

// @ts-expect-error TS(7006) FIXME: Parameter 'fn' implicitly has an 'any' type.
export const processOnExit = (fn) => {
const signals = ['SIGINT', 'SIGTERM', 'SIGQUIT', 'SIGHUP', 'exit']
export const processOnExit = (fn: (...args: unknown[]) => void | Promise<void>) => {
const signals = ['SIGINT', 'SIGTERM', 'SIGQUIT', 'SIGHUP', 'exit'] as const
signals.forEach((signal) => {
process.on(signal, fn)
process.on(signal, (...args) => {
void fn(...args)
})
})
}

Expand Down
Loading
Loading