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

@isbl/publisher

v0.8.5

Published

Simplifies creating git(lab|hub) releases and publishes to npm

Downloads

39

Readme

@isbl/publisher

MIT License npm dependencies Releases

Automates release process. Creates github releases from commit messages and attaches correct labels. Works both with self-hosted gitlab instances and github.com.

You can see it in action on release of this package. It currently assumes that you use yarn classic, but it shouldn't be difficult to adjust for other package managers too.

Why?

Automate creating changelogs from commit messages. Also creates git tags and publishes to NPM. All automated in CI. Works both on GitHub and GitLab (.com or self-hosted). See below for setup.

How to setup

Run following two commands. It'll ask you a few questions and perform neccessary changes. Then commit the result and push it.

yarn add -D @isbl/publisher
yarn isbl-publisher setup

Manual setup (GitHub)

(see below for automated version using GitHub actions)

Install from npm

yarn add -D @isbl/publisher

add to your scripts in package.json

{
  "repository": {
    "type": "git",
    "url": "https://github.com/please-replace/with-correct-repo.git"
  },
  "scripts": {
    "prepare": "yarn build",
    "prepublishOnly": "isbl-publisher prepublishOnly"
  }
}

GitHub action

Setup for github (above) and add following to .github/workflows/release.yml file:

name: release
on:
  push:
    branches:
      - main
jobs:
  release:
    name: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v2
        with:
          node-version: 14
          cache: yarn
          registry-url: 'https://registry.npmjs.org'
      - run: yarn
      - run: yarn isbl-publisher publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Run npm token create to create your npm token. Create repository secret in Settings > Secrets named NPM_TOKEN with contents of your secret.

Manual setup (GitLab)

Install from npm

yarn add -D @isbl/publisher

add to your scripts in package.json

{
  "repository": {
    "type": "git",
    "url": "https://gitlab.example.com/group/repo.git"
  },
  "scripts": {
    "prepare": "yarn build",
    "prepublishOnly": "isbl-publisher prepublishOnly"
  }
}

the prepublishOnly script prevents accidental publishes.

Publishing

Increment version in your package.json and push to the main branch.

Arguments

  • --dry-run prevents publisher from executing any state-changing commands. Useful for debugging and for verification of initial setup.
  • --verbose prints extra information while running. Does not print secrets, so it's safe to use this in CI. But it makes the output harder to read.
  • --ci simulates running on CI. This is also enabled by CI env variable which is set by both gitlab ci and github actions.
  • --no-draft github CI mode creates release draft by default to allow you to manually edit release notes before GitHub sends out emails. This option changes that behaviour.

Environment variables

  • CI enables CI mode. GitHub actions and GitLab runner set this by default.
  • CORRECT_PUBLISH publisher sets this and prepublish-only checks for it's presence. This is to prevent people from running yarn publish directly.
  • npm_package_repository_url this is set by npm/yarn when running scripts.
  • CI_PROJECT_ID used in gitlab CI publish. Set by GitLab runner by default. Used for finding correct gitlab project when accessing the API.
  • CI_JOB_TOKEN used in gitlab CI publish. Set by GitLab runner by default. Used for accessing the gitlab API.
  • GITHUB_TOKEN used in github CI publish. Must be set in workflow file.