Skip to content

Commit

Permalink
publish 15.x.x packages only under '15.x.x' tag (#3411)
Browse files Browse the repository at this point in the history
IvanGoncharov authored Dec 7, 2021
1 parent c55ac60 commit 6b6efe4
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
@@ -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
@@ -58,6 +58,10 @@ function buildPackageJSON() {
packageJSON.engines = packageJSON.engines_on_npm;
delete packageJSON.engines_on_npm;

// TODO: move to integration 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) {
@@ -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;

0 comments on commit 6b6efe4

Please sign in to comment.