Skip to content

Commit

Permalink
Import/use npm client as object + fix undefined name
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Dec 19, 2018
1 parent 50087b9 commit 17edd60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions lib/npm.js
Expand Up @@ -4,9 +4,7 @@ const { run } = require('./shell');
const { warn } = require('./log');
const { config } = require('./config');

const getPackageUrl = packageName => {
return 'https://www.npmjs.com/package/' + packageName;
}
const getPackageUrl = packageName => `https://www.npmjs.com/package/${packageName}`;

const getTag = () => {
const tag = _.get(config, 'cliArguments.npm.tag');
Expand Down
10 changes: 5 additions & 5 deletions lib/tasks.js
Expand Up @@ -2,7 +2,7 @@ const { EOL } = require('os');
const repoPathParse = require('parse-repo');
const _ = require('lodash');
const { bump, runTemplateCommand: run, pushd, copy, popd, isSubDir } = require('./shell');
const { getPackageUrl, getTag, publish: npmPublish } = require('./npm');
const npmClient = require('./npm');
const Git = require('./git');
const githubClient = require('./github-client');
const semver = require('semver');
Expand Down Expand Up @@ -121,7 +121,7 @@ module.exports = async options => {
const version = provisionalVersion;
config.setOption('version', version);
config.setOption('preRelease', !!semver.prerelease(version));
config.setOption('npm.tag', getTag());
config.setOption('npm.tag', npmClient.getTag());

if (!version) {
throw new InvalidVersionError();
Expand Down Expand Up @@ -175,7 +175,7 @@ module.exports = async options => {
const release = () => githubClient.release({ version, tagName, repo, changelog, github });
const uploadAssets = release => githubClient.uploadAssets({ release, repo, github });
const otpPrompt = task => prompt(true, 'src', 'otp', task);
const publish = () => npmPublish(npm, options.name, isInteractive && otpPrompt);
const publish = () => npmClient.publish(npm, options.name, isInteractive && otpPrompt);

if (!isInteractive) {
await spinner(git.commit, commit, 'Git commit');
Expand Down Expand Up @@ -237,7 +237,7 @@ module.exports = async options => {
github
});
const otpPrompt = task => prompt(isInteractive, 'dist', 'otp', task);
const publish = () => npmPublish(npm, options.name, isInteractive && otpPrompt);
const publish = () => npmClient.publish(npm, options.name, isInteractive && otpPrompt);

if (!isInteractive) {
await Git.status();
Expand Down Expand Up @@ -269,7 +269,7 @@ module.exports = async options => {
log(`πŸ”— ${githubClient.getReleaseUrl()}`);
}
if (npm.publish) {
log(`πŸ”— ${getPackageUrl()}`);
log(`πŸ”— ${npmClient.getPackageUrl(options.name)}`);
}

log(`🏁 Done (in ${Math.floor(process.uptime())}s.)`);
Expand Down

0 comments on commit 17edd60

Please sign in to comment.