Skip to content

Commit f934005

Browse files
committed
update script
1 parent e1cabbb commit f934005

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

.env-cmdrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"version": {
3+
"IN_VERSION_SCRIPT": "true"
4+
}
5+
}

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"lint": "eslint . --rulesdir eslint-internal-rules",
1515
"lint:fix": "eslint . --rulesdir eslint-internal-rules --fix",
1616
"tsc": "tsc",
17-
"preversion": "npm test && npm run update && git add .",
18-
"version": "npm run lint -- --fix && git add .",
17+
"preversion": "npm test && git add .",
18+
"version": "env-cmd -e version npm run update && npm run lint -- --fix && git add .",
1919
"update": "node ./tools/update.js",
2020
"docs:watch": "vuepress dev docs",
2121
"predocs:build": "npm run update",
@@ -66,6 +66,7 @@
6666
"@typescript-eslint/parser": "^3.0.2",
6767
"@vuepress/plugin-pwa": "^1.4.1",
6868
"babel-eslint": "^10.1.0",
69+
"env-cmd": "^10.1.0",
6970
"eslint": "^7.0.0",
7071
"eslint-config-prettier": "^6.11.0",
7172
"eslint-plugin-eslint-plugin": "^2.2.1",

tools/update-docs.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,8 @@ function pickSince(content) {
6767
return since[1]
6868
}
6969
}
70-
if (
71-
process.env.npm_package_version &&
72-
process.env.npm_package_version !== require('../package.json').version
73-
) {
74-
// Maybe version script
75-
return `v${process.env.npm_package_version}`
70+
if (process.env.IN_VERSION_SCRIPT) {
71+
return `v${require('../package.json').version}`
7672
}
7773
return null
7874
}

0 commit comments

Comments
 (0)