Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed May 30, 2024
1 parent dbff57e commit 5ddb52a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
6 changes: 3 additions & 3 deletions playground/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { Manifest } from 'vite'
import { normalizePath } from 'vite'
import { fromComment } from 'convert-source-map'
import { expect } from 'vitest'
import type { ExecaChildProcess } from 'execa'
import type { ResultPromise as ExecaResultPromise } from 'execa'
import { isBuild, isWindows, page, testDir } from './vitestSetup'

export * from './vitestSetup'
Expand Down Expand Up @@ -304,7 +304,7 @@ export const formatSourcemapForSnapshot = (map: any): any => {

// helper function to kill process, uses taskkill on windows to ensure child process is killed too
export async function killProcess(
serverProcess: ExecaChildProcess,
serverProcess: ExecaResultPromise,
): Promise<void> {
if (isWindows) {
try {
Expand All @@ -314,6 +314,6 @@ export async function killProcess(
console.error('failed to taskkill:', e)
}
} else {
serverProcess.kill('SIGTERM', { forceKillAfterTimeout: 2000 })
serverProcess.kill('SIGTERM')
}
}
21 changes: 8 additions & 13 deletions scripts/releaseUtils.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import { readdirSync, writeFileSync } from 'node:fs'
import path from 'node:path'
import colors from 'picocolors'
import type { Options as ExecaOptions, ExecaReturnValue } from 'execa'
import type { Options as ExecaOptions, ResultPromise } from 'execa'
import { execa } from 'execa'
import fs from 'fs-extra'

export async function run(
export function run<EO extends ExecaOptions>(
bin: string,
args: string[],
opts: ExecaOptions = {},
): Promise<ExecaReturnValue> {
return execa(bin, args, { stdio: 'inherit', ...opts })
opts?: EO,
): ResultPromise<EO & (keyof EO extends 'stdio' ? {} : { stdio: 'inherit' })> {
return execa(bin, args, { stdio: 'inherit', ...opts }) as any
}

export async function getLatestTag(pkgName: string): Promise<string> {
const tags = (await run('git', ['tag'], { stdio: 'pipe' })).stdout
.split(/\n/)
.filter(Boolean)
const prefix = pkgName === 'vite' ? 'v' : `${pkgName}@`
return tags
.filter((tag) => tag.startsWith(prefix))
.sort()
.reverse()[0]
const pkgJson = await fs.readJson(`packages/${pkgName}/package.json`)
const version = pkgJson.version
return `${pkgName}@${version}`
}

export async function logRecentCommits(pkgName: string): Promise<void> {
Expand Down

0 comments on commit 5ddb52a

Please sign in to comment.