Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
Do not release prerelease components with the latest tag
Browse files Browse the repository at this point in the history
Previously this did not work as expected as `semver.coerce` does not
appear to handle prerelease versions. Relates to:
npm/node-semver#357

Instead we can use `semver.prerelease` for our purposes.

We should improve test coverage here but I suspect this action
may disappear in the near future (either with a move to a mono
repo, or by extracting the bundle size notice and using a similar
approach to services for publishing).
  • Loading branch information
notlee committed Feb 3, 2021
1 parent 5731730 commit d08e36b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions commands/release.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {promises as fs} from 'fs';
import {homedir} from 'os';
import {resolve as resolvePath} from 'path';
import {gt, coerce} from 'semver';
import {gt, prerelease} from 'semver';

import exec from '../lib/exec';
import {execStdout} from '../lib/exec';
Expand Down Expand Up @@ -36,8 +36,8 @@ export async function command() {
being published is either a prerelease or not the largest version then we tag the release with the
version to ensure that it does not get tagged with `latest`.
*/
const newVersion = coerce(env.version);
const newVersionIsNotPrerelease = newVersion.prerelease.length === 0;
const prereleaseComponents = prerelease(env.version);
const newVersionIsNotPrerelease = prereleaseComponents.length === 0;

await exec('occ', '--name', env.name, '0.0.0');

Expand All @@ -60,8 +60,8 @@ export async function command() {
}

const stableVersions = versions.filter(version => {
const v = coerce(version);
return v.prerelease.length === 0;
const prereleaseComponents = prerelease(version);
return prereleaseComponents.length === 0;
});

const newVersionIsLargestVersion = stableVersions.every(version => {
Expand Down

0 comments on commit d08e36b

Please sign in to comment.