Skip to content

@std/semver: I cannot specify the prerelease number during an increment #6824

@justinmchase

Description

@justinmchase

Describe the bug

I cannot specify the prerelease number during an increment.

Steps to Reproduce

import { parse, increment, format, equals } from "@std/semver";

const v1 = parse("1.2.3");
const v2 = increment(v1, "pre", { prerelease: "pr.1" })

console.log(format(v2)); // "1.2.3-pr.1.0"

const expected = parse("1.2.3-pr.1");
Deno.exit(equals(v2, expected) ? 0 : 1); // exit 1

Expected behavior

If I specify the prerelease value to be in the form {identifier}.{number} then I expect the prerelease value of the version to be [identifier, number] specifically.

Environment

  • OS: All
  • deno version:

deno 2.5.0 (stable, release, x86_64-apple-darwin)
v8 14.0.365.4-rusty
typescript 5.9.2

  • std version:

1.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions