Update index.js

This commit is contained in:
Edwin Betancourt 2020-11-14 22:32:37 -04:00 committed by GitHub
parent 3db7d3f910
commit 2b09c7bf2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -1,16 +1,15 @@
const { sh } = require('tasksfile')
const chalk = require('chalk')
const config = require('../vue.config.js')
const rawArgv = process.argv.slice(2)
const args = rawArgv.join(' ')
sh(`vue-cli-service build ${args}`)
if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
const config = require('../vue.config.js')
const publicPath = config.publicPath
var connect = require('connect')
var serveStatic = require('serve-static')
const connect = require('connect')
const serveStatic = require('serve-static')
const app = connect()
app.use(
@ -21,13 +20,12 @@ if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
)
const port = 9526
app.listen(port, function () {
app.listen(port, function() {
const chalk = require('chalk')
console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
const isWithReport = rawArgv.includes('--report')
if (isWithReport) {
if (rawArgv.includes('--report')) {
console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
}
})
}