Skip to content

Commit

Permalink
publish 15.x.x packages only under '15.x.x' tag
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Dec 7, 2021
1 parent c55ac60 commit 855b260
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@
"nyc": "15.1.0",
"prettier": "2.2.1",
"typescript": "4.1.3"
},
"publishConfig": {
"tag": "15.x.x"
}
}
8 changes: 5 additions & 3 deletions resources/build-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ function buildPackageJSON() {
packageJSON.engines = packageJSON.engines_on_npm;
delete packageJSON.engines_on_npm;

// TODO: move to intergration tests
const publishTag = packageJSON.publishConfig?.tag;
assert(publishTag != null, 'Should have packageJSON.publishConfig defined!');

const { version } = packageJSON;
const versionMatch = /^\d+\.\d+\.\d+-?(?<preReleaseTag>.*)?$/.exec(version);
if (!versionMatch) {
Expand All @@ -72,9 +76,7 @@ function buildPackageJSON() {
tag.startsWith('experimental-') || ['alpha', 'beta', 'rc'].includes(tag),
`"${tag}" tag is supported.`,
);

assert(!packageJSON.publishConfig, 'Can not override "publishConfig".');
packageJSON.publishConfig = { tag: tag || 'latest' };
assert.equal(tag, publishTag, 'Publish tag and version tag should match!');
}

return packageJSON;
Expand Down

0 comments on commit 855b260

Please sign in to comment.