[Regression] changeset command fails if there is a side project without a name in package.json that is not intended to be published · Issue #2336 · changesets/changesets · GitHub
Skip to content

[Regression] changeset command fails if there is a side project without a name in package.json that is not intended to be published #2336

Open

Description

@tats-u

The name field in package.json is optional. If there is no reason to distribute the project's source code, such as in sample projects or package websites, there is little reason to explicitly add a name. If you forget to add private: true and accidentally run npm publish, the project's source code becomes a digital tattoo. However, if such a project exists in the repository, the changeset command fails as follows:

pnpm changeset
$ changeset
🦋  error PackageJsonMissingNameError: The following package.jsons are missing the "name" field:
🦋  error demos\astro\package.json
🦋  error demos\docusaurus\package.json
🦋  error demos\rspress\package.json
🦋  error demos\vitepress\package.json
🦋  error website\package.json
🦋  error     at _callee$ (I:\markdown-cj-friendly\node_modules\.pnpm\@manypkg+get-packages@1.1.3\node_modules\@manypkg\get-packages\dist\get-packages.cjs.dev.js:232:19)
🦋  error     at I:\markdown-cj-friendly\node_modules\.pnpm\@babel+runtime@7.29.7\node_modules\@babel\runtime\helpers\regeneratorRuntime.js:52:18
🦋  error     at Generator.<anonymous> (I:\markdown-cj-friendly\node_modules\.pnpm\@babel+runtime@7.29.7\node_modules\@babel\runtime\helpers\regenerator.js:52:51)
🦋  error     at Generator.next (I:\markdown-cj-friendly\node_modules\.pnpm\@babel+runtime@7.29.7\node_modules\@babel\runtime\helpers\regeneratorDefine.js:11:21)
🦋  error     at asyncGeneratorStep (I:\markdown-cj-friendly\node_modules\.pnpm\@babel+runtime@7.29.7\node_modules\@babel\runtime\helpers\asyncToGenerator.js:3:17)
🦋  error     at _next (I:\markdown-cj-friendly\node_modules\.pnpm\@babel+runtime@7.29.7\node_modules\@babel\runtime\helpers\asyncToGenerator.js:17:9) {
🦋  error   directories: [
🦋  error     'demos\\astro\\package.json',
🦋  error     'demos\\docusaurus\\package.json',
🦋  error     'demos\\rspress\\package.json',
🦋  error     'demos\\vitepress\\package.json',
🦋  error     'website\\package.json'
🦋  error   ]
🦋  error }
[ELIFECYCLE] Command failed with exit code 1.

This error did not happen before.

Related: Thinkmill/manypkg#177

https://github.com/tats-u/markdown-cjk-friendly/blob/5b171730a33478726f33fae0dc408011bcf5f365/website/package.json
https://github.com/tats-u/markdown-cjk-friendly/blob/5b171730a33478726f33fae0dc408011bcf5f365/demos/vitepress/package.json

pnpm init has an option to create a package.json file while omitting the name field.

https://pnpm.io/cli/init

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions