Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements and fixes #721

Merged
merged 9 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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