add preview

This commit is contained in:
Pan 2018-11-28 18:11:18 +08:00
parent 2f731000c1
commit 84b19d7283
3 changed files with 49 additions and 13 deletions

31
build/index.js Normal file
View File

@ -0,0 +1,31 @@
const { run } = require('runjs')
const chalk = require('chalk')
const config = require('../vue.config.js')
const rawArgv = process.argv.slice(2)
const args = rawArgv.join(' ')
if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
run(`vue-cli-service build ${args}`)
const port = 9526
const basePath = config.baseUrl
var connect = require('connect')
var serveStatic = require('serve-static')
const app = connect()
app.use(
basePath,
serveStatic('./dist', {
index: ['index.html', '/']
})
)
app.listen(port, function() {
console.log(
chalk.green(`> Listening at http://localhost:${port}${basePath}`)
)
})
} else {
run(`vue-cli-service build ${args}`)
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

View File

@ -8,6 +8,8 @@
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:sit": "vue-cli-service build --mode text",
"build:preview": "node build/index.js --preview",
"build:report": "node build/index.js --report",
"lint": "eslint --ext .js,.vue src",
"test": "npm run lint",
"test:unit": "vue-cli-service test:unit",
@ -37,11 +39,11 @@
"dependencies": {
"axios": "0.18.0",
"clipboard": "1.7.1",
"codemirror": "5.39.2",
"driver.js": "0.5.2",
"dropzone": "5.2.0",
"codemirror": "5.42.0",
"driver.js": "0.8.1",
"dropzone": "5.5.1",
"echarts": "4.1.0",
"element-ui": "2.4.6",
"element-ui": "2.4.10",
"file-saver": "1.3.8",
"js-cookie": "2.2.0",
"jsonlint": "1.6.3",
@ -50,7 +52,6 @@
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"screenfull": "3.3.3",
"showdown": "1.8.6",
"sortablejs": "1.7.0",
"tui-editor": "1.2.7",
"vue": "2.5.17",
@ -58,29 +59,33 @@
"vue-i18n": "7.3.2",
"vue-router": "3.0.2",
"vue-splitpane": "1.0.2",
"vuedraggable": "^2.16.0",
"vuedraggable": "2.17.0",
"vuex": "3.0.1",
"xlsx": "^0.11.16"
},
"devDependencies": {
"@babel/core": "7.0.0",
"@babel/register": "7.0.0",
"@vue/cli-plugin-babel": "3.1.1",
"@vue/cli-plugin-eslint": "3.1.5",
"@vue/cli-plugin-unit-jest": "3.1.1",
"@vue/cli-service": "3.1.4",
"@vue/cli-plugin-babel": "3.2.0",
"@vue/cli-plugin-eslint": "3.2.1",
"@vue/cli-plugin-unit-jest": "3.2.0",
"@vue/cli-service": "3.2.0",
"@vue/test-utils": "1.0.0-beta.25",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "23.6.0",
"chalk": "^2.4.1",
"connect": "^3.6.6",
"husky": "0.14.3",
"lint-staged": "7.2.2",
"mockjs": "1.0.1-beta3",
"node-sass": "^4.9.0",
"runjs": "^4.3.2",
"sass-loader": "7.0.3",
"script-ext-html-webpack-plugin": "2.0.1",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"svg-sprite-loader": "3.8.0",
"svgo": "1.0.5",
"serve-static": "^1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.1.1",
"vue-template-compiler": "2.5.17"
},
"engines": {