@jsenv/package-publish

1.10.4 • Public • Published

Package publish npm package

Publish package to one or many registry.

Presentation

  • Can be used to automate "npm publish" during a workflow
  • Allows to publish on many registries: both npm and github registries for instance.

You can use it inside a GitHub workflow or inside any other continuous environment like Travis or Jenkins.

Screenshot taken inside a github workflow when the package.json version is already published: already published github workflow screenshot

Screenshot taken inside a github workflow when the package.json version is not published: publishing github workflow screenshot

Installation

npm install --save-dev @jsenv/package-publish

Documentation

The api consist into one function called publishPackage.

publishPackage is an async function publishing a package on one or many registries.

import { publishPackage } from "@jsenv/package-publish"

const publishReport = await publishPackage({
  rootDirectoryUrl: new URL('./', import.meta.url)
  registriesConfig: {
    "https://registry.npmjs.org": {
      token: process.env.NPM_TOKEN,
    },
    "https://npm.pkg.github.com": {
      token: process.env.GITHUB_TOKEN,
    },
  },
})

rootDirectoryUrl

rootDirectoryUrl parameter is a string leading to a directory containing the package.json.

This parameter is required.

registriesConfig

registriesConfig parameter is an object configuring on which registries you want to publish your package.

This parameter is required.

logLevel

logLevel parameter is a string controlling verbosity of logs during the function execution.

This parameter is optional.

— see also https://github.com/jsenv/jsenv-logger#loglevel

Readme

Keywords

none

Package Sidebar

Install

npm i @jsenv/package-publish

Weekly Downloads

45

Version

1.10.4

License

MIT

Unpacked Size

21.7 kB

Total Files

10

Last publish

Collaborators

  • jsenv-admin
  • dmail