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

Do not release prerelease components with the latest tag #108

Merged
merged 3 commits into from
Feb 15, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 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 === null;

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

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

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

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