Skip to content

publishing to the github package registry and to the npmjs registry #44

@JohnRDOrazio

Description

@JohnRDOrazio

The first time I published this plugin as a package (v2.3.4), I published it to the npmjs registry under the name jquery-clock-plugin.

The next time I published the plugin as a package, I published it to the Github package registry. The Github package registry requires scoped packages, so I changed the name to @johnrdorazio/jquery-clock-plugin.

A few years have passed, and now I have dedicated some time creating the latest version v2.3.7, and I successfully published again to the Github registry. However I noticed that you can't simply do a yarn add @johnrdorazio/jquery-clock-plugin to retrieve the package (perhaps you need to set the registry to look into first?).

I would like to keep it as simple as possible for users, if anyone were to try to use the package with npm or yarn. So I figured, why not publish to both registries, then anyone can simply pull from the registry they prefer.

However, publishing to both registries is not very straightforward. I have attempted at creating workflows to automate the process, and I have created access tokens both for the Github registry and for the NPMJS registry. I had a heck of a time publishing to the NPMJS registry even from the command line, I finally succeeded by modifying package.json's name key to a value of jquery-clock-plugin and modifying the publishConfig.registry key to the npmjs registry.

For the time being, I am attempting to do just this with the publish workflow: the npmjs registry workflow will modify package.json with the updated values using sed.

Perhaps another possibility is to not use the publishConfig key in package.json, which effectively overrides any .npmrc settings, and just use .npmrc? See here: https://stackoverflow.com/a/58618271/394921 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions