Skip to content

Commit 8fa63ba

Browse files
authored
Set tag for pinned version releases (#1779)
Npm now prevents publishing a previous version without specifying the `--tag` option to avoid overriding a more recent version. This makes sure that the option gets set when a previous version gets published. Fixes #1702.
1 parent 81db5fd commit 8fa63ba

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tools/release-package.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ async function releasePackage(prNumber) {
9292
package: packageFolder
9393
//, debug: console.debug
9494
};
95+
if (type.match(/\d+$/)) {
96+
// A previous version is being published and we do not want it to
97+
// replace the "latest" tag. Let's link it to a separate tag.
98+
const pinnedVersion = type.match(/\d+$/)[0];
99+
pubOptions.tag = `v${pinnedVersion}`;
100+
}
95101
if (NPM_TOKEN) {
96102
pubOptions.token = NPM_TOKEN;
97103
}

0 commit comments

Comments
 (0)