function commandScript(cmd, opts) {
    const showProgress = isTTY() && opts.progress;
    const script = ['webpack'];

    if (cmd === 'build' && showProgress) {
        script.push('--progress');
    } else if (cmd === 'watch' && !opts.hot) {
        script.push('--watch');

        if (showProgress) {
            script.push('--progress');
        }
    } else if (cmd === 'watch' && opts.hot) {
        script.push('serve', '--hot');

        if (opts.https) {
            script.push('--https');
        }
    }

    return script.join(' ');
}
Get the command-specific portion of the script.

@param {"build"|"watch"} cmd
@param {{[key: string]: any}} opts