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

Generated package.json is not valid #508

Closed
TheDutchCoder opened this issue Sep 15, 2022 · 7 comments · Fixed by #516
Closed

Generated package.json is not valid #508

TheDutchCoder opened this issue Sep 15, 2022 · 7 comments · Fixed by #516

Comments

@TheDutchCoder
Copy link
Contributor

TheDutchCoder commented Sep 15, 2022

Environment

Node: v16.15.1
Nitro: 0.5.3

Reproduction

Probably doesn't need a reproduction, but let me know if I need to supply a Stackblitz or GH repro

Describe the bug

When using the aws-lamda preset (probably goes for other ones too), the generated package.json is missing the required fields name and version, which means that deploying the code through (for example) SAM fails.

Maybe the name and version could be grabbed from the root's package.json?

Additional context

No response

Logs

No response

@pi0
Copy link
Member

pi0 commented Sep 19, 2022

Hi @TheDutchCoder. I think the package.json is valid with private: true field to omit name an version and it is only a placeholder meta file. What exact error are you getting?

@pi0
Copy link
Member

pi0 commented Sep 19, 2022

BTW surely we can add placeholder name and version to the file as well 👍🏼

@TheDutchCoder
Copy link
Contributor Author

TheDutchCoder commented Sep 19, 2022

This probably comes from some form of validator on the AWS side, which (I think) assumes the package is a publishable one.

I can't find any docs that say private: true make name and version not required, but I also can't find any docs that they are required when setting private: true haha.

NPM themselves mark name and version as required: https://docs.npmjs.com/creating-a-package-json-file so I think that's what the AWS validator uses as a base.

I'm more than willing to PR this, but I couldn't find the root's imported package.json in the code that generates the output package.json. I think it might be a good idea to grab the name and version from the root's file, with backup values in case they're missing?

@pi0
Copy link
Member

pi0 commented Sep 19, 2022

Well there is not single standard across package managers. Some only require version... I think it should be fine using stub name and version for the output like { name: "nitro-output", version: "0.0.0" }

@TheDutchCoder
Copy link
Contributor Author

Yeah that sounds good, do you want me to PR it?

@pi0
Copy link
Member

pi0 commented Sep 19, 2022

Sure thanks ❤️

@TheDutchCoder
Copy link
Contributor Author

Ready!

@pi0 pi0 closed this as completed in #516 Sep 19, 2022
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