Commit 8ffe952b authored by hewenhao's avatar hewenhao

chore: build

parent 88b4c613
......@@ -3,9 +3,9 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint --fix"
"build": "node scripts/build.js",
"serve": "node scripts/build.js --watch",
"lint": "node scripts/build.js --lint"
},
"dependencies": {
"amfe-flexible": "^2.2.1",
......@@ -35,6 +35,7 @@
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^7.0.0-0",
"execa": "^5.0.0",
"less": "^4.1.1",
"less-loader": "^8.0.0",
"postcss-plugin-px2rem": "^0.8.1",
......
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require("path");
const rawArgv = process.argv.slice(2);
const args = require("minimist")(rawArgv);
const execa = require("execa");
const resolve = d => path.resolve(__dirname, d);
const bin = cmd => resolve("../node_modules/.bin/" + cmd);
const { watch, lint, ...rest } = args;
let cmd = "build";
if (lint) {
cmd = "lint";
} else if (watch) {
cmd = "serve";
}
let deployMode = args._[0] || 'production';
if (cmd === 'serve') {
deployMode = 'test';
}
process.env.VUE_APP_DEPLOY_MODE = deployMode;
execa(bin("vue-cli-service"), [cmd], {
cwd: resolve(".."),
stdio: "inherit",
env: process.env
});
......@@ -6,7 +6,7 @@ import store from "./store";
import "./assets/style/normalize.css";
import "amfe-flexible";
if (process.env.NODE_ENV !== "production") {
if (process.env.VUE_APP_DEPLOY_MODE === "test") {
const VConsole = require("vconsole");
new VConsole();
}
......
......@@ -3027,7 +3027,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
shebang-command "^1.2.0"
which "^1.2.9"
cross-spawn@^7.0.0:
cross-spawn@^7.0.0, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha1-9zqFudXUHQRVUcF34ogtSshXKKY=
......@@ -3890,6 +3890,21 @@ execa@^3.3.0:
signal-exit "^3.0.2"
strip-final-newline "^2.0.0"
execa@^5.0.0:
version "5.0.0"
resolved "https://registry.npm.taobao.org/execa/download/execa-5.0.0.tgz#4029b0007998a841fbd1032e5f4de86a3c1e3376"
integrity sha1-QCmwAHmYqEH70QMuX03oajweM3Y=
dependencies:
cross-spawn "^7.0.3"
get-stream "^6.0.0"
human-signals "^2.1.0"
is-stream "^2.0.0"
merge-stream "^2.0.0"
npm-run-path "^4.0.1"
onetime "^5.1.2"
signal-exit "^3.0.3"
strip-final-newline "^2.0.0"
expand-brackets@^2.1.4:
version "2.1.4"
resolved "https://registry.npm.taobao.org/expand-brackets/download/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622"
......@@ -4369,6 +4384,11 @@ get-stream@^5.0.0:
dependencies:
pump "^3.0.0"
get-stream@^6.0.0:
version "6.0.0"
resolved "https://registry.npm.taobao.org/get-stream/download/get-stream-6.0.0.tgz#3e0012cb6827319da2706e601a1583e8629a6718"
integrity sha1-PgASy2gnMZ2icG5gGhWD6GKaZxg=
get-value@^2.0.3, get-value@^2.0.6:
version "2.0.6"
resolved "https://registry.npm.taobao.org/get-value/download/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
......@@ -4793,6 +4813,11 @@ human-signals@^1.1.1:
resolved "https://registry.npm.taobao.org/human-signals/download/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha1-xbHNFPUK6uCatsWf5jujOV/k36M=
human-signals@^2.1.0:
version "2.1.0"
resolved "https://registry.npm.taobao.org/human-signals/download/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"
integrity sha1-3JH8ukLk0G5Kuu0zs+ejwC9RTqA=
iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4:
version "0.4.24"
resolved "https://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
......@@ -6184,7 +6209,7 @@ npm-run-path@^2.0.0:
dependencies:
path-key "^2.0.0"
npm-run-path@^4.0.0:
npm-run-path@^4.0.0, npm-run-path@^4.0.1:
version "4.0.1"
resolved "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea"
integrity sha1-t+zR5e1T2o43pV4cImnguX7XSOo=
......@@ -6319,7 +6344,7 @@ onetime@^2.0.0:
dependencies:
mimic-fn "^1.0.0"
onetime@^5.1.0:
onetime@^5.1.0, onetime@^5.1.2:
version "5.1.2"
resolved "https://registry.npm.taobao.org/onetime/download/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e"
integrity sha1-0Oluu1awdHbfHdnEgG5SN5hcpF4=
......@@ -7816,7 +7841,7 @@ shell-quote@^1.6.1:
resolved "https://registry.npm.taobao.org/shell-quote/download/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
integrity sha1-Z6fQLHbJ2iT5nSCAj8re0ODgS+I=
signal-exit@^3.0.0, signal-exit@^3.0.2:
signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3:
version "3.0.3"
resolved "https://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
integrity sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment