Skip to content

Pre-release tags in package versions #1675

Open
@kokkonisd

Description

@kokkonisd

Description

I've noticed that, sadly, SemVer is not actually fully supported in local packages (I'm assuming this is also an issue with "published" packages, but I haven't published one so far so I'm not sure). Assume the following typst.toml:

[package]
name = "test"
version = "0.1.0-dev"
entrypoint = "src/lib.typ"

We then follow the instructions on this repo to install this test package locally, placing it in, e.g., $HOME/.local/share/typst/packages/local/test/0.1.0-dev/. We can also create a src/ directory with an empty lib.typ file inside it (as promised for the entrypoint), but it doesn't matter in this example.

Now, let's try to use this package in another file, called example.typ:

#import "@local/test:0.1.0-dev": *

When we try to compile it, we get the following error:

$ typst c example.typ
error: `0-dev` is not a valid patch version
  ┌─ example.typ:1:8

1 │ #import "@local/test:0.1.0-dev": *
  │         ^^^^^^^^^^^^^^^^^^^^^^^

This is surprising, as 0-dev is in fact a valid patch version! More specifically, SemVer 2.0.0's grammar states that the "version core" (MAJOR.MINOR.PATCH) can be followed by a "pre-release" tag, such as -dev.

Is there any reason why only a subset of SemVer is supported?

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