mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-25 16:44:12 +00:00
23 lines
588 B
JavaScript
23 lines
588 B
JavaScript
import commands from './commands'
|
|
import * as utils from './utils'
|
|
|
|
/**
|
|
* CLI application entrypoint.
|
|
*
|
|
* @param {string[]} cliArgs
|
|
* @return {Promise}
|
|
*/
|
|
export default function run(cliArgs) {
|
|
return new Promise((resolve, reject) => {
|
|
const params = utils.parseCliParams(cliArgs)
|
|
const command = commands[params[0]]
|
|
const options = command ? utils.parseCliOptions(cliArgs, command.optionMap) : {}
|
|
|
|
const commandPromise = command
|
|
? command.run(params.slice(1), options)
|
|
: commands.help.run(params)
|
|
|
|
commandPromise.then(resolve).catch(reject)
|
|
})
|
|
}
|