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

fix: import function template metadata as module #6516

Merged
merged 4 commits into from
Apr 17, 2024

Conversation

cubeghost
Copy link
Contributor

@cubeghost cubeghost commented Apr 17, 2024

πŸŽ‰ Thanks for submitting a pull request! πŸŽ‰

Summary

Fixes #6250
https://linear.app/netlify/issue/CT-1059/creating-new-functions-in-the-cli-via-ntl-functionscreate-is-broken

When we moved to using ESM, we left these function template metadata files (.netlify-function-template.js) alone. Some of the templates don't have package.json files, and those continued to be imported fine (including the two used in existing integration tests) because the closest package.json (in the root directory) had type: module. Templates with their own package.json files failed because those didn't have type: module. Since those template-specific package.jsons are related more to the actual {{name}} template file and not the metadata file, I decided to leave them alone and instead rename the metadata files to use .mjs across the board.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code πŸ§‘β€πŸ’». This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire πŸ”₯ (e.g. incident related), you can skip this step.
  • Read the contribution guidelines πŸ“–. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) πŸ§ͺ
  • Update or add documentation (if features were changed or added) πŸ“
  • Make sure the status checks below are successful βœ…

A picture of a cute animal (not mandatory, but encouraged)
Screenshot 2024-04-17 at 4 20 40 PM

Copy link

github-actions bot commented Apr 17, 2024

πŸ“Š Benchmark results

Comparing with f0af180

  • Dependency count: 1,315 (no change)
  • Package size: 295 MB ⬇️ 0.00% decrease vs. f0af180
  • Number of ts-expect-error directives: 1,007 (no change)

@cubeghost cubeghost marked this pull request as ready for review April 17, 2024 20:23
@cubeghost cubeghost requested a review from a team as a code owner April 17, 2024 20:23
ndhoule
ndhoule previously approved these changes Apr 17, 2024
Copy link
Contributor

@ndhoule ndhoule left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❀️

@cubeghost cubeghost added the automerge Add to Kodiak auto merge queue label Apr 17, 2024
@kodiakhq kodiakhq bot merged commit ffe8696 into main Apr 17, 2024
40 checks passed
@kodiakhq kodiakhq bot deleted the ab/CT-1059/fix-function-templates branch April 17, 2024 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Add to Kodiak auto merge queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

netlify functions:create no longer provides a list of templates to choose from for serverless functions
2 participants