Skip to content

Commit

Permalink
Improvements and fixes (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
mifi committed Nov 27, 2023
1 parent 74ae535 commit d7543ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
### Why not

- Monorepos are not supported.
- Yarn >= 2 is not supported.
- Yarn >= 2 and pnpm are not supported.
- Custom registries are not supported ([but could be with your help](https://github.com/sindresorhus/np/issues/420)).
- CI is [not an ideal environment](https://github.com/sindresorhus/np/issues/619#issuecomment-994493179) for `np`. It's meant to be used locally as an interactive tool.

Expand Down Expand Up @@ -254,6 +254,8 @@ To publish [scoped packages](https://docs.npmjs.com/misc/scope#publishing-public

If publishing a scoped package for the first time, `np` will prompt you to ask if you want to publish it publicly.

**Note:** When publishing a scoped package, the first ever version you publish has to be done interactively using `np`. If not, you cannot use `np` to publish future versions of the package.

### Private Org-scoped packages

To publish a [private Org-scoped package](https://docs.npmjs.com/creating-and-publishing-an-org-scoped-package#publishing-a-private-org-scoped-package), you need to set the access level to `restricted`. You can do that by adding the following to your `package.json`:
Expand Down
6 changes: 3 additions & 3 deletions source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import logSymbols from 'log-symbols';
import prerequisiteTasks from './prerequisite-tasks.js';
import gitTasks from './git-tasks.js';
import publish, {getPackagePublishArguments} from './npm/publish.js';
import enable2fa from './npm/enable-2fa.js';
import enable2fa, {getEnable2faArgs} from './npm/enable-2fa.js';
import releaseTaskHelper from './release-task-helper.js';
import * as util from './util.js';
import * as git from './git-util.js';
Expand Down Expand Up @@ -227,9 +227,9 @@ const np = async (input = 'patch', options, {pkg, rootDir}) => {
},
...shouldEnable2FA ? [{
title: 'Enabling two-factor authentication',
skip() {
async skip() {
if (options.preview) {
const args = enable2fa.getEnable2faArgs(pkg.name, options);
const args = await getEnable2faArgs(pkg.name, options);
return `[Preview] Command not executed: npm ${args.join(' ')}.`;
}
},
Expand Down
2 changes: 1 addition & 1 deletion source/release-task-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Version from './version.js';
const releaseTaskHelper = async (options, pkg) => {
const newVersion = options.releaseDraftOnly
? new Version(pkg.version)
: new Version(pkg.version).setFrom(options.version, {prereleasePrefix: await getPreReleasePrefix(options)});
: new Version(pkg.version).setFrom(options.version.toString(), {prereleasePrefix: await getPreReleasePrefix(options)});

const tag = await getTagVersionPrefix(options) + newVersion.toString();

Expand Down
4 changes: 4 additions & 0 deletions source/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ const ui = async (options, {pkg, rootDir}) => {
}

if (options.availability.isUnknown) {
if (!isScoped(pkg.name)) {
throw new Error('Unknown availability, but package is not scoped. This shouldn\'t happen');
}

const answers = await inquirer.prompt({
confirm: {
type: 'confirm',
Expand Down

0 comments on commit d7543ff

Please sign in to comment.