Skip to content

Commit d7543ff

Browse files
authored
Improvements and fixes (#721)
1 parent 74ae535 commit d7543ff

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
### Why not
5050

5151
- Monorepos are not supported.
52-
- Yarn >= 2 is not supported.
52+
- Yarn >= 2 and pnpm are not supported.
5353
- Custom registries are not supported ([but could be with your help](https://github.com/sindresorhus/np/issues/420)).
5454
- 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.
5555

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

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

257+
**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.
258+
257259
### Private Org-scoped packages
258260

259261
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`:

source/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import logSymbols from 'log-symbols';
1212
import prerequisiteTasks from './prerequisite-tasks.js';
1313
import gitTasks from './git-tasks.js';
1414
import publish, {getPackagePublishArguments} from './npm/publish.js';
15-
import enable2fa from './npm/enable-2fa.js';
15+
import enable2fa, {getEnable2faArgs} from './npm/enable-2fa.js';
1616
import releaseTaskHelper from './release-task-helper.js';
1717
import * as util from './util.js';
1818
import * as git from './git-util.js';
@@ -227,9 +227,9 @@ const np = async (input = 'patch', options, {pkg, rootDir}) => {
227227
},
228228
...shouldEnable2FA ? [{
229229
title: 'Enabling two-factor authentication',
230-
skip() {
230+
async skip() {
231231
if (options.preview) {
232-
const args = enable2fa.getEnable2faArgs(pkg.name, options);
232+
const args = await getEnable2faArgs(pkg.name, options);
233233
return `[Preview] Command not executed: npm ${args.join(' ')}.`;
234234
}
235235
},

source/release-task-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Version from './version.js';
66
const releaseTaskHelper = async (options, pkg) => {
77
const newVersion = options.releaseDraftOnly
88
? new Version(pkg.version)
9-
: new Version(pkg.version).setFrom(options.version, {prereleasePrefix: await getPreReleasePrefix(options)});
9+
: new Version(pkg.version).setFrom(options.version.toString(), {prereleasePrefix: await getPreReleasePrefix(options)});
1010

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

source/ui.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ const ui = async (options, {pkg, rootDir}) => {
198198
}
199199

200200
if (options.availability.isUnknown) {
201+
if (!isScoped(pkg.name)) {
202+
throw new Error('Unknown availability, but package is not scoped. This shouldn\'t happen');
203+
}
204+
201205
const answers = await inquirer.prompt({
202206
confirm: {
203207
type: 'confirm',

0 commit comments

Comments
 (0)