npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@liferay/js-publish

v2.0.1

Published

Publishes an NPM package via "yarn version"

Downloads

5

Readme

@liferay/js-publish

A script for publishing an NPM package via yarn version.

Simplifying assumptions:

  • You are working in a repository that uses Yarn
  • You develop on the "master" branch
  • You publish using yarn version
  • You are millennial (or pretend to be) and expect your tools to use emoji 😎

Set-up

1. Preliminaries

You can skip installing @liferay/js-publish and just use the latest version (ie. via npx @liferay/js-publish).

It is safe to use @liferay/js-publish as an implicit dependency because we control the package, we maintain all the projects that use the package, and we won't make any breaking changes (or at least, we won't make any undetected breaking changes).

If you really want to install it, either:

  • Install globally: yarn global add @liferay/js-publish; or:
  • Add to a project: yarn add --dev @liferay/js-publish; or:

But note that this brings the cost of noise in the package.json and yarn.lock, and the need to update multiple projects every time we update @liferay/js-publish.

2. Create a ".yarnrc" file

Ensure you have a ".yarnrc" file in your package root declaring the desired commit message and tag format. For example, in a monorepo, you probably want to include the package name:

version-tag-prefix "liferay-fancy-package/v"
version-git-message "chore: prepare liferay-fancy-package/v%s"

In a single-package repo, something like this might be more appropriate:

version-tag-prefix "v"
version-git-message "chore: prepare v%s release"

If you don't have a ".yarnrc" file, @liferay/js-publish will warn you during publishing and require you to type "y" in order to continue.

3. Add @liferay/js-publish from a "postversion" script in your "package.json".

Assuming you have a "ci" script that runs tests, you should call that in your "preversion" script as well:

{
    "scripts": {
      "ci": "yarn lint && yarn format:check && yarn test",
      "preversion": "yarn ci"
      "postversion": "npx @liferay/js-publish"
    }
}

If you don't have "preversion" and "postversion" scripts, @liferay/js-publish will warn you during publishing and require you to type "y" in order to continue.

Usage

Prepare and release a new version with yarn version

# Either:
yarn version --patch # or --minor, or --major

# Or:
yarn version --new-version x.y.z

Origins

This was originally just a publish.js script in the root of the liferay-npm-tools repository.

Similar to what we did with @liferay/changelog-generator, we extracted it into an NPM package so that it could be used from other projects, such as eslint-config-liferay. The intention for it is to be a very small script with (almost) no dependencies.

Example projects using @liferay/js-publish