-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathrun.ts
More file actions
35 lines (30 loc) · 869 Bytes
/
run.ts
File metadata and controls
35 lines (30 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import { runCommand as _runCommand, runMain as _runMain } from 'citty'
import init from '../../nuxi/src/commands/init'
import { main } from './main'
globalThis.__nuxt_cli__ = globalThis.__nuxt_cli__ || {
// Programmatic usage fallback
startTime: Date.now(),
entry: fileURLToPath(
new URL(
import.meta.url.endsWith('.ts')
? '../bin/nuxi.mjs'
: '../../bin/nuxi.mjs',
import.meta.url,
),
),
}
export const runMain = (): Promise<void> => _runMain(main)
export async function runCommand(
name: 'init',
argv: string[] = process.argv.slice(2),
data: { overrides?: Record<string, any> } = {},
): Promise<{ result: unknown }> {
return await _runCommand(init, {
rawArgs: argv,
data: {
overrides: data.overrides || {},
},
})
}