Skip to content

Commit 200e50b

Browse files
committed
Chore: improve build script
1 parent 14ae9a3 commit 200e50b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@
3737
"webpack-dev-server": "^2.9.5"
3838
},
3939
"scripts": {
40-
"build": "cross-env NODE_ENV=production run-s clean build:* -s",
40+
"build": "cross-env NODE_ENV=production run-s clean build:*",
4141
"build:html": "appcache-manifest-fixer src/index.html -o dist/index.html",
4242
"build:js": "webpack --progress --hide-modules",
4343
"build:monaco": "node scripts/copy-monaco",
4444
"build:manifest": "appcache-manifest \"dist/**/*.{css,html,js,svg,eot,ttf,woff,woff2}\" --prefix /vue-eslint-demo --network-star -o dist/index.appcache",
4545
"build:versions": "node scripts/make-versions",
4646
"clean": "rimraf dist",
4747
"deploy": "node scripts/deploy",
48-
"preversion": "npm run build",
48+
"lint": "eslint .",
49+
"preversion": "run-s lint build -s",
4950
"postversion": "git push && git push --tags && npm run deploy",
5051
"update-deps": "npm install eslint@latest eslint-plugin-vue@next vue-eslint-parser@experimental",
5152
"watch": "cross-env NODE_ENV=development run-p watch:* -s",

scripts/deploy.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict"
22

33
const sh = require("shelljs")
4+
const version = require("../package.json").version
45

56
main()
67

@@ -9,21 +10,19 @@ main()
910
* @returns {void}
1011
*/
1112
function main() {
12-
exec("npm run -s build")
13+
exec(`git checkout ${version}`)
14+
exec("npm run build")
1315
exec("git checkout gh-pages")
1416

15-
if (String(sh.cat("dist/versions.json")) === String(sh.cat("versions.json"))) {
16-
sh.echo("No update.")
17-
exec("git checkout -")
18-
return
17+
if (String(sh.cat("dist/versions.json")) !== String(sh.cat("versions.json"))) {
18+
rm("-rf", "vs", "index.*")
19+
cp("-r", "dist/*", ".")
20+
exec("git add -A")
21+
exec("git commit -m \"Update: website\"")
22+
exec("git push")
1923
}
2024

21-
rm("-rf", "vs", "index.*")
22-
cp("-r", "dist/*", ".")
23-
exec("git add -A")
24-
exec("git commit -m \"Update: website\"")
25-
exec("git push")
26-
exec("git checkout -")
25+
exec("git checkout master")
2726
}
2827

2928
/**

0 commit comments

Comments
 (0)