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

[BUG] Invalid name: "@apollo/client/core" #175

Closed
1 task done
sresch4b opened this issue Mar 28, 2023 · 3 comments
Closed
1 task done

[BUG] Invalid name: "@apollo/client/core" #175

sresch4b opened this issue Mar 28, 2023 · 3 comments

Comments

@sresch4b
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Hi,

I'm not sure if it is a "bug" or if I just have a wrong understanding of package names. Anyway, I ask why the package name mentioned should be invalid? It may be unusual, but I wouldn't call it invalid. If I understand the rules of https://docs.npmjs.com/cli/v9/configuring-npm/package-json#name correctly.

My reason for asking is that we want to use a tool (CycloneDX) that uses your code. However, because of the error you threw, it cannot react adequately and break.
CycloneDX/cyclonedx-webpack-plugin#745

Can you shed some light on this?

Expected Behavior

Does not throw an error on package names, which contains more than one slash.

Steps To Reproduce

Find a small example here:
https://github.com/sresch4b/cyclonedx-issue

Run yarn install and yarn build

Environment

  • npm: 9.5.0
  • Node: 19.7.0
  • OS: macOS
  • platform: Macbook Pro
@AugustusKling
Copy link

It seems the Apollo people create package.json files which are not representing real packages to allow importing their client partially. See the code in https://github.com/apollographql/apollo-client/blob/b214dd1d31cdfe6b5477bb5887a7d9615a302b27/config/prepareDist.js#L64 and the comment in apollographql/apollo-client#6656 (review)

Without looking at this in any detail, I have the impression that it would be cleaner if they'd split up their @apollo/client package and remove the linked code entirely.

Regarding the name property of package.json files I can't really follow why exactly the characters /@\s+% (see readme file) would be forbidden. The NPM docs don't have this exact restriction but they mention name can't contain any non-URL-safe characters in https://docs.npmjs.com/cli/v9/configuring-npm/package-json#name.

@wraithgar
Copy link
Member

That is an invalid package name for a package.json. It is a valid require, but those are distinct things, one is asking for a package from a registry (package.json) and one is asking for content installed within node_modules (require).

@sresch4b
Copy link
Author

@wraithgar Thx for the clarification

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

No branches or pull requests

3 participants