Skip to content

Only publish stable version to "latest" dist-tag #2898

@ghost

Description

Run the following and see what is going wrong with TS package on npm:

npm info typescript
npm dist-tag ls typescript
# only one dist-tag: latest which points to alpha release..
# so when I run:
#
# npm install typescript
#
# it installs alpha version!

If you are the person having access to publish TypeScript npm package, please consider running the following commands to remedy it:

# optionally cd into/typescript-source-directory
npm dist-tag add typescript@1.4.1 latest
npm dist-tag add typescript@1.5.0-alpha alpha

Once the issue is fixed, in future to publish beta (for example 1.5.0-beta), run:

npm publish --tag=beta

For stable, it would be just a matter of:

npm publish  # only run this for stable releases. thank you!

So, as a consumer, I will run:

npm install typescript
# which is same as
npm install typescript@latest

to install stable version and:

npm install typescript@alpha
# or
npm install typescript@beta
# or even @rc, @rc1, @rc2 ..

to install respective preview build.

Note alpha, beta, rc are alphabetically sorted. And semver do consider alphabetic order (in many cases) in tag part of version:

<major>.<minor>.<patch>-<tag>

Which means, you can release *-preview after *-canary, but not the other way around. Better stick with *-alpha, *-beta, *-rc etc.

Note 2: dist-tags are indepenedent of GH tags. So you can have like beta1, beta2, rc8 etc. in your GH, and keep publishing to @beta tag on npm. This way, as a user I will only need to remember the generic distribution channer name alpha, beta etc. and use it so: npm install typescript@beta or in package.json: "typescript": "alpha".

https://docs.npmjs.com/cli/dist-tag

Keywords: love-semver, adapt-semver, semver-rocks, semver-get-ready, I-trust-semver

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions