()
| 27 | } |
| 28 | |
| 29 | async function run() { |
| 30 | let argv = process.argv.slice(2) |
| 31 | let command = argv[0] |
| 32 | let rootFlags = args({ ...build.options(), ...sharedOptions }, argv) |
| 33 | |
| 34 | if (command === 'build') { |
| 35 | let flags = args({ ...build.options(), ...sharedOptions }, argv.slice(1)) |
| 36 | |
| 37 | if ((process.stdout.isTTY && argv.length === 1) || flags['--help']) { |
| 38 | help({ |
| 39 | usage: [buildUsage('tailwindcss build')], |
| 40 | options: { ...build.options(), ...sharedOptions }, |
| 41 | }) |
| 42 | process.exit(0) |
| 43 | } |
| 44 | |
| 45 | await build.handle(flags) |
| 46 | return |
| 47 | } |
| 48 | |
| 49 | if (command === 'canonicalize') { |
| 50 | let result = await canonicalize.runCommandLine({ argv: argv.slice(1) }) |
| 51 | |
| 52 | if (result.stdout.length > 0) { |
| 53 | process.stdout.write(`${result.stdout}\n`) |
| 54 | } |
| 55 | |
| 56 | if (result.stderr.length > 0) { |
| 57 | process.stderr.write(`${result.stderr}\n`) |
| 58 | } |
| 59 | |
| 60 | process.exitCode = result.exitCode |
| 61 | return |
| 62 | } |
| 63 | |
| 64 | if ((process.stdout.isTTY && command === undefined) || rootFlags['--help']) { |
| 65 | rootHelp() |
| 66 | process.exit(0) |
| 67 | } |
| 68 | |
| 69 | if (command && !command.startsWith('-')) { |
| 70 | rootHelp({ invalid: command }) |
| 71 | process.exit(1) |
| 72 | } |
| 73 | |
| 74 | let flags = args({ |
| 75 | ...build.options(), |
| 76 | ...sharedOptions, |
| 77 | }) |
| 78 | |
| 79 | await build.handle(flags) |
| 80 | } |
| 81 | |
| 82 | await run() |
no test coverage detected