Skip to content

Commit

Permalink
fix(publish): add version number validation and rename script (#2117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wendell authored and vthinkxie committed Sep 17, 2018
1 parent e8dad8f commit bc1f6fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"integration-rollup": "npm run generate && cd integration/rollup && npm run integration",
"lint": "tslint -c tslint.json 'components/*/*.ts'",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && node site_scripts/replace-scope-prefix.js",
"publish": "node ./publish_scripts/publish.js"
"release": "node ./publish_scripts/publish.js"
},
"main": "./bundles/antd.umd.js",
"module": "./esm5/antd.js",
Expand Down
5 changes: 4 additions & 1 deletion publish_scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ function changeVersion() {
let version;

function checkVersionNumber(cur, next) {
// Must be numbers and dots.
if (!/^[1-9][0-9.]{1,10}[0-9]$/.test(next)) { return false; }

const curArr = cur.split('.');
const nextArr = next.split('.');
const length = curArr.length;
Expand All @@ -71,7 +74,7 @@ function changeVersion() {
versionNumberValid = true;
nextVersion = version;
} else {
log.error(`The current version ${currentVersion} is not ahead of your input. Please check it.`);
log.error(`Your input ${version} is not after the current version ${currentVersion} or is unvalid. Please check it.`);
}
}

Expand Down

0 comments on commit bc1f6fa

Please sign in to comment.