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

@egis/semantic-dependents-updates-github

v1.1.0

Published

Creates Github Pull Requests to update current package version in dependent projects.

Downloads

35

Readme

semantic-dependents-updates-github

Creates Github Pull Requests to update current package' version in dependent projects.

NPM info

Circle CI Dependency Status devDependency Status semantic-release

Overview

This package can be useful for a family of inter-dependent NPM packages. The basic idea is this: when A package' version is updated let's send a pull request to package B, changing A's dependency in its package.json to new version and initiating CI test of B with new version of A.

This is similar to the way Greenkeeper works, but it's a bit different:

  • it's just a Node.js module, not an external service
  • it works fine with private NPM packages (Greenkeeper currently doesn't support them, that's why I needed to create it)
  • it's focused on single dependency package with a list of dependents, similarly to dont-break's approach

This module plays perfectly with semantic-release, see below for usage instructions.

Here's an example output from this module at CircleCI: Example screenshot

Limitations

In case B depends on A this module creates a Git branch inside B's repository, so this only works if your Github user have write access to B's repository. So basically this is a solution only for a case when you (or your organisation) own the whole family of dependencies, which was exactly the case which this module was made to solve - it was made for a company's own suite of private NPM modules.

Installation

Install the package:

npm install -g @egis/semantic-dependents-updates-github

Usage

  • Create a GitHub token to be used by semantic-dependents-updates-github and put it to GH_TOKEN env variable. You can also take (any of) GH_TOKEN created by https://github.com/semantic-release/semantic-release setup: it will print it if you choose 'Other' CI instead of Travis.

  • Define the dependent projects to be updated in package.json, e.g.:

  ...
  "name": "build-tools",
  "version": "1.2.3",
  "semantic-dependents-updates": {
    "dependents": {
      "@egis/egis-ui": "[email protected]:egis/EgisUI.git",
      "@egis/esign": "[email protected]:egis/eSign.git",
      "@egis/portal-app": "[email protected]:egis/Portal.git"
    }
  },
  ...

Here we tell semantic-dependents-updates-github to create pull requests to change build-tools' version to "1.2.3" in GitHub repos of "@egis/egis-ui", "@egis/esign" and "@egis/portal-app" packages.

  • Use the 'semantic-dependents-updates-github' binary script in package.json' scripts section - this will create the PRs. Example for integration with semantic-release:
yarn semantic-release && yarn semantic-dependents-updates-github

The PR generation can be switched off - then only branch will be created and relevant commit will be pushed:

PR=false yarn semantic-dependents-updates-github

Configuration

The module config section in package.json can have following options, all of which are optional except "dependents". Example:

  ...
  "semantic-dependents-updates": {
    "dependents": {
      "@egis/egis-ui": "[email protected]:egis/EgisUI.git",
      "@egis/esign": "[email protected]:egis/eSign.git",
      "@egis/portal-app": "[email protected]:egis/Portal.git"
    },
    "branchNameBase": "autoupdate-build-tools",
    "branch": "my-branch",
    "author": {
      name: "semantic-dependents-updates-github bot",
      email: "[email protected]"
    },
    "pullRequests": false
  },
  ...
  • "dependents" list NPM package names and Github URLs of dependent packages
  • "branch" is the target branch of dependent packages where pull request will be submitted to ("master" by default)
  • "author" can be used to specify "author" info for the commit created by module, by default it's { name: "semantic-dependents-updates-github bot", email: "[email protected]" }
  • "branchNameBase" is a prefix of branch being created for pull request. Full branch name in this case will be like this: "autoupdate-build-tools-1.0.2-1459471368624". Default is "autoupdate".

License

MIT License 2019 © Artem Vasiliev