Skip to content

Commit 020d09f

Browse files
committed
fix: add serializeCommand
1 parent 73c2f04 commit 020d09f

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

utils.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
Task,
1212
} from './types.ts'
1313
import { REGISTRY_ADDRESS, startRegistry } from './registry.ts'
14-
import { detect, AGENTS, getCommand } from '@antfu/ni'
14+
import { detect, AGENTS, getCommand, serializeCommand } from '@antfu/ni'
1515
import actionsCore from '@actions/core'
1616

1717
const isGitHubActions = !!process.env.GITHUB_ACTIONS
@@ -194,7 +194,7 @@ function toCommand(
194194
} else if (typeof task === 'string') {
195195
if (scripts[task] != null) {
196196
const runTaskWithAgent = getCommand(agent, 'run', [task])
197-
await $`${runTaskWithAgent}`
197+
await $`${serializeCommand(runTaskWithAgent)}`
198198
} else {
199199
await $`${task}`
200200
}
@@ -206,7 +206,7 @@ function toCommand(
206206
task.script,
207207
...(task.args ?? []),
208208
])
209-
await $`${runTaskWithAgent}`
209+
await $`${serializeCommand(runTaskWithAgent)}`
210210
} else {
211211
throw new Error(
212212
`invalid task, script "${task.script}" does not exist in package.json`,
@@ -264,11 +264,9 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
264264
}
265265
options.agent = detectedAgent
266266
}
267-
if (!AGENTS[options.agent]) {
267+
if (!AGENTS.includes(options.agent)) {
268268
throw new Error(
269-
`Invalid agent ${options.agent}. Allowed values: ${Object.keys(
270-
AGENTS,
271-
).join(', ')}`,
269+
`Invalid agent ${options.agent}. Allowed values: ${AGENTS.join(', ')}`,
272270
)
273271
}
274272

@@ -324,7 +322,7 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
324322

325323
if (verify && test) {
326324
const frozenInstall = getCommand(agent, 'frozen')
327-
await $`${frozenInstall}`
325+
await $`${serializeCommand(frozenInstall)}`
328326
await beforeBuildCommand?.(pkg.scripts)
329327
await buildCommand?.(pkg.scripts)
330328
await beforeTestCommand?.(pkg.scripts)
@@ -431,12 +429,12 @@ export async function buildVue({ verify = false, publish = false }) {
431429
const runTest = getCommand('pnpm', 'run', ['test'])
432430

433431
// Prefix with `corepack` because pnpm 7 & 8's lockfile formats differ
434-
await $`corepack ${install}`
435-
await $`${runBuild}`
436-
await $`${runBuildDts}`
432+
await $`corepack ${serializeCommand(install)}`
433+
await $`${serializeCommand(runBuild)}`
434+
await $`${serializeCommand(runBuildDts)}`
437435

438436
if (verify) {
439-
await $`${runTest}`
437+
await $`${serializeCommand(runTest)}`
440438
}
441439

442440
console.log()

0 commit comments

Comments
 (0)