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

Invalid package.json in @material-ui/core/*/package.json #15715

Closed
2 tasks done
brian-lim-42 opened this issue May 15, 2019 · 11 comments
Closed
2 tasks done

Invalid package.json in @material-ui/core/*/package.json #15715

brian-lim-42 opened this issue May 15, 2019 · 11 comments
Labels
core Infrastructure work going on behind the scenes

Comments

@brian-lim-42
Copy link

Invalid package.json files in @material-ui/core/*/package.json

Package.json must have a name field

Lack of name field causes rollup bundlers such as api-extractor to fail due to requirement for name field

For example, see this issue microsoft/rushstack#1200 in api-extractor

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

Name field should be present in all package.json files
Version field should be present in all package.json files

Current Behavior 😯

Name field missing
Version field missing

Steps to Reproduce 🕹

Unfortunately, build tools like api-explorer are not browser based and I don't know how to execute command line scripts in sandbox.io

If helpful I will produce a GitHub repository that can be forked

Context 🔦

Trying to bundle up .d.ts files with standard api-extractor bundler

Your Environment 🌎

Tech Version
Material-UI @material-ui/core@next
React ^16.8.3
Browser Google Chrome 74
TypeScript ^3.4.5
@oliviertassinari
Copy link
Member

@bhldev Could you link us an example where the name is missing? You can use unpkg for that.

@oliviertassinari oliviertassinari added the status: waiting for author Issue with insufficient information label May 15, 2019
@eps1lon
Copy link
Member

eps1lon commented May 15, 2019

Lack of name field causes rollup bundlers such as api-extractor to fail due to requirement for name field

These are not standalone packages. The package.json is just there to assist bundlers in finding the module builds. Is there a documentation for required name fields on npm? Otherwise this sounds like the api-extractor tool should just ignore those packages.

@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari added waiting for user information and removed status: waiting for author Issue with insufficient information labels May 15, 2019
@brian-lim-42
Copy link
Author

These are not standalone packages. The package.json is just there to assist bundlers in finding the module builds. Is there a documentation for required name fields on npm? Otherwise this sounds like the api-extractor tool should just ignore those packages.

Hi! Yes https://docs.npmjs.com/creating-a-package-json-file

For everybody else: https://unpkg.com/@material-ui/core@4.0.0-beta.2/Backdrop/package.json.

Thank you!

@oliviertassinari oliviertassinari changed the title Invalid package.json in @material-ui/core/*/package.json [NEXT] Invalid package.json in @material-ui/core/*/package.json May 16, 2019
@eps1lon
Copy link
Member

eps1lon commented May 16, 2019

@bhldev You you create a minimal repository that fails with the API extractor? I'm a bit hesitant to add the name fields because it's not actually meant to be consumed by anything other than bundlers. Just want to verify that adding a name doesn't trigger other errors. I would prefer if setting private: true would hide it from other tools.

Hi! Yes docs.npmjs.com/creating-a-package-json-file

I mean the spec is nice and all but it also requires a version that follows semantic versioning. There are plenty of packages that don't follow that. But it seems like in your particular case omitting the version field would be fine.

@eps1lon eps1lon added the core label May 16, 2019
@brian-lim-42
Copy link
Author

brian-lim-42 commented May 16, 2019

@bhldev You you create a minimal repository that fails with the API extractor? I'm a bit hesitant to add the name fields because it's not actually meant to be consumed by anything other than bundlers. Just want to verify that adding a name doesn't trigger other errors. I would prefer if setting private: true would hide it from other tools.

Hi! Yes docs.npmjs.com/creating-a-package-json-file

I mean the spec is nice and all but it also requires a version that follows semantic versioning. There are plenty of packages that don't follow that. But it seems like in your particular case omitting the version field would be fine.

@eps1lon

Hello, I created minimal example at https://github.com/bhldev/mui-org-issue15715

It is not every package.json adding one line to @material-ui\core\styles\package.json seems to fix the issue both in our codebase and in the minimal example

{
  "name": "test",
  "sideEffects": false,
  "module": "../esm/styles/index.js",
  "typings": "./index.d.ts"
}

I am not sure why, perhaps the @material-ui\core\styles\package.json is treated differently?

Run yarn build without the change to reproduce the error, add the line and error is gone

Thanks!

@eps1lon
Copy link
Member

eps1lon commented May 16, 2019

Hello, I created minimal example at bhldev/mui-org-issue15715

Looks like a plain create-react-app without any dependency on material-ui packages. Did you forget to push?

@brian-lim-42
Copy link
Author

Hello, I created minimal example at bhldev/mui-org-issue15715

Looks like a plain create-react-app without any dependency on material-ui packages. Did you forget to push?

Apologies, pushed, thanks

@brian-lim-42
Copy link
Author

Hi @eps1lon, any chance at a look? I could also file an issue with api-explorer. Thanks!

@eps1lon
Copy link
Member

eps1lon commented May 22, 2019

Won't have time in the next days and it isn't that big of a priority for me since I'm not really sure why this package has to be used on 3rd party libraries. I will fix this at some point but we need to be careful that people don't assume that these are actual packages downloadable from some registry.

@oliviertassinari
Copy link
Member

Closing, this sounds like an edge case that doesn't have a high impact.

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 20, 2022
@zannager zannager added core Infrastructure work going on behind the scenes and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

No branches or pull requests

4 participants