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

Unable to publish preview (publish.getPackagePublishArguments is not a function) #705

Closed
timphillips opened this issue Jun 6, 2023 · 1 comment · Fixed by #706
Closed

Comments

@timphillips
Copy link

Description

After upgrading to v8.0.2, an error occurs when running the publish step with the --preview option:

> np --preview

  ✔ Prerequisite check
  ✔ Git
  ✔ Installing dependencies using npm
  ✔ Running tests using npm
  ↓ Bumping version using npm [skipped]
    → [Preview] Command not executed: npm version 1.8.0.
  ✖ Publishing package using npm
    → publish.getPackagePublishArguments is not a function
    Pushing tags
    Creating release draft on GitHub

✖ TypeError: publish.getPackagePublishArguments is not a function
    at Task.skip (file:///.../node_modules/np/source/index.js:222:28)

Unfortunately I don't have a minimal repo that reproduces the issue, but I took a look at the code and I think the cause of the error is clear:

  • The error happens here.
  • Prior to v8.0.0, getPackagePublishArguments was exported as part of the default export from the publish module.
  • This was changed in Move to ESM, update dependencies #683. getPackagePublishArguments is now exported as a named export, it won't be available with the default import (i.e. import publish from './npm/publish.js';).
  • I suspect that changing the import to something like import publish, { getPackagePublishArguments } from './npm/publish.js'; would fix the error.

Environment

np - 8.0.2
Node.js - 18.16.0
npm - 9.5.1
Git - 2.39.0
OS - macOS 13.3.1

timphillips added a commit to unravelin/ravelinjs that referenced this issue Jun 6, 2023
- There is a bug with preview mode in v8: sindresorhus/np#705
@sindresorhus
Copy link
Owner

// @tommy-mitchell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants