Nutritious Pumpkin Mash

    publish-unscoped-package-to-npm-and-github

    1.0.1 • Public • Published

    publish-unscoped-package-to-npm-and-github

    Inspired by Dev.to article and this issue

    Testing of publishing an unscoped NPM package to Github Package Registry

    NPM:

    NPM version NPM downloads

    GPR (GitHub Package Registry):

    GPR version GPR downloads

    Steps

    1. Add publishConfig section to your package.json
    "publishConfig": {
       "registry": "https://registry-url"
     }
    
    1. Modify your .github/workflows/deploy.yml file

    2. Add NPM_AUTH_TOKEN variable in your Repository > Settings > Secrets > New repository secret button. GITHUB_TOKEN already exists

    3. Success 🎉

    Usage

    From NPM:

    npm install publish-unscoped-package-to-npm-and-github

    From GPR:

    npm install @denisstasyev/publish-unscoped-package-to-npm-and-github

    Possibly you will need .npmrc file:

    @denisstasyev:registry = https://npm.pkg.github.com
    

    Find out the registry used: npm config get registry

    Show complete package manager configuration: npm config ls -l

    Workflow file

    Some notes here how to understand this workflow file:

    Now this repository contains the simplest example, you need to manually raise the version for publication. For automatic version control you can use some tools like semantic-release (example of usage in Github Action and necessary .releaserc.json file)

    Install

    npm i publish-unscoped-package-to-npm-and-github

    DownloadsWeekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    6.38 kB

    Total Files

    6

    Last publish

    Collaborators

    • denisstasyev