1.6.0 • Published 7 years ago

@futagoza/publish-package v1.6.0

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

A 'npm/yarn publish' API wrapper with my preferred defaults that returns a promise.

  • api based, so you can call from your scripts, but spawns the actual commands
  • run either Yarn (option.yarn = true) or NPM (default)
  • perfect for embedding into your build scripts (Gulp anyone?)
  • --access public by default (publishing scoped packages is simpler)
  • optionally checks if package version is already on NPM

example

const publish = require( "@futagoza/publish-package" );

publish( __dirname, { checkVersion: true } )
    .catch( details => {

        console.error( details.stderr );
        process.exit( 1 );

    } )
    .then( () => console.log( "Yahoo!" ) );

options

function publish( path?: string, options: {} ): Promise;
api optionnpm/yarn cli optiondescription
access--access scopeSee https://docs.npmjs.com/cli/publish
checkVersionWill check on NPM before publishing
dirAlternative to the path argument1
dry-run--dry-runSee https://docs.npmjs.com/cli/publish
dry--dry-runAlias for dry-run
dryRun--dry-runAlias for dry-run
folderAlternative to the path argument1
logAn optional logging function2
new-version--new-version valueSee https://yarnpkg.com/lang/en/docs/cli/publish/
newVersion--new-version valueAlias for new-version
otp--otp valueSee https://docs.npmjs.com/cli/publish
otpcode--otp valueAlias for otp
pathAlternative to the path argument1
private--access restrictedIf true, uses --access restricted
public--access publicIf true, uses --access public (default)
scoped--access publicIf true, uses --access public
registry--registry urlSee https://docs.npmjs.com/misc/registry
reg--registry urlAlias for registry
restricted--access restrictedIf true, uses --access restricted
runOptsOption's to send to @futagoza/node-run
tag--tag nameSee https://docs.npmjs.com/cli/publish
version--new-version valueAlias for new-version
yarnWill use yarn publish instead of npm publish
  1. Can be used in place of path (e.g. publish( { dir: ... } ))
  2. Check defaultLogger in @futagoza/gulp-publish-package/index.js for an example

NOTE: To circumvent an issue with running npm publish from a yarn run ... command, the registry option is set to https://registry.npmjs.org/ by default when running npm publish only, otherwise it is only included when specified.


History license

@futagoza/publish-package is Copyright (c) 2018+ Futago-za Ryuu

1.6.0

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago