This commit is contained in:
Edwin Betancourt 2020-12-05 03:55:41 -08:00 committed by GitHub
commit 353b6a251e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 16 deletions

View File

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

View File

@ -63,13 +63,13 @@
"lint-staged": "8.1.5", "lint-staged": "8.1.5",
"mockjs": "1.0.1-beta3", "mockjs": "1.0.1-beta3",
"plop": "2.3.0", "plop": "2.3.0",
"runjs": "4.3.2",
"sass": "1.26.2", "sass": "1.26.2",
"sass-loader": "8.0.2", "sass-loader": "8.0.2",
"script-ext-html-webpack-plugin": "2.1.3", "script-ext-html-webpack-plugin": "2.1.3",
"serve-static": "1.13.2", "serve-static": "1.13.2",
"svg-sprite-loader": "4.1.3", "svg-sprite-loader": "4.1.3",
"svgo": "1.2.0", "svgo": "1.2.0",
"tasksfile": "5.1.1",
"vue-template-compiler": "2.6.10" "vue-template-compiler": "2.6.10"
}, },
"browserslist": [ "browserslist": [