@jsenv/package-publish
v1.11.12
Published
Publish package to one or many registry.
Downloads
310
Readme
Package publish
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:
Screenshot taken inside a github workflow when the package.json version is not published:
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