UNPKG

@applicaster/zapplicaster-cli

Version:

CLI Tool for the zapp app and Quick Brick project

48 lines (35 loc) 1.11 kB
const { runInShellAsync } = require("../../shell"); const logger = require("../../logger"); const { retryPublishCommand } = require("../utils/retryPublishCommand"); async function npmPublish(configuration) { const { dryRun, yarn, next, version, pluginPath, manifestOnly } = configuration; logger.log( `Publishing your plugin to the npm registry with ${yarn ? "yarn" : "npm"}` ); const cmdOptions = { cwd: pluginPath }; let publishCommand = "npm publish"; if (dryRun) { publishCommand += " --dry-run"; } if (manifestOnly) { logger.log("Running with --manifest-only flag, not publishing"); return true; } if (next) { publishCommand += " --tag next"; } if (version) { if (yarn) { await runInShellAsync( `npm version ${version} --git-tag-version=false --commit-hooks=false --workspaces-update=false`, cmdOptions ); } else { await runInShellAsync(`npm version ${version}`, cmdOptions); } } await retryPublishCommand(publishCommand, cmdOptions, version); return true; } module.exports = { npmPublish };