line_push/node_modules/@nuxt/cli/dist/cli-start.js
2022-07-17 13:16:16 +08:00

49 lines
1.2 KiB
JavaScript

/*!
* @nuxt/cli v2.13.3 (c) 2016-2020
* - All the amazing contributors
* Released under the MIT License.
* Website: https://nuxtjs.org
*/
'use strict';
const index = require('./cli-index.js');
require('path');
require('@nuxt/config');
require('exit');
const utils = require('@nuxt/utils');
require('chalk');
require('std-env');
require('wrap-ansi');
require('boxen');
require('consola');
require('minimist');
require('hable');
require('fs');
require('execa');
require('pretty-bytes');
const banner = require('./cli-banner.js');
const start = {
name: 'start',
description: 'Start the application in production mode (the application should be compiled with `nuxt build` first)',
usage: 'start <dir>',
options: {
...index.common,
...index.server
},
async run (cmd) {
const config = await cmd.getNuxtConfig({ dev: false, _start: true });
if (config.target === utils.TARGETS.static) {
throw new Error('You cannot use `nuxt start` with ' + utils.TARGETS.static + ' target, please use `nuxt export` and `nuxt serve`')
}
const nuxt = await cmd.getNuxt(config);
// Listen and show ready banner
await nuxt.server.listen();
banner.showBanner(nuxt);
}
};
exports.default = start;