Skip to content

Conversation

@jobala
Copy link
Contributor

@jobala jobala commented Dec 13, 2022

🎉 Thanks for submitting a pull request! 🎉

Summary

Removes detectBuildSystems from listFrameworks try...catch block so that it executes even when listFrameworks errors out.


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)

@jobala jobala requested a review from lukasholzer December 13, 2022 17:03
@jobala jobala changed the title Fix/build info fix: put separate detectBuildsystems and listFrameworks Dec 13, 2022
@jobala jobala changed the title fix: put separate detectBuildsystems and listFrameworks fix: separate detectBuildsystems and listFrameworks Dec 13, 2022
Copy link
Contributor

@lukasholzer lukasholzer left a comment

Choose a reason for hiding this comment

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

Some minor things

// only if we find a root package.json we know this is a javascript workspace
if (Object.keys(context.rootPackageJson).length > 0) {
info.packageManager = await detectPackageManager(context.projectDir, context.rootDir)
info.buildSystems = await detectBuildSystems(context.projectDir, context.rootDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would still rather opt for having an additional try catch block (to avoid crashing the package manager detection)

Copy link
Contributor Author

@jobala jobala Dec 14, 2022

Choose a reason for hiding this comment

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

I opted to remove the try...catch block here because I am handling invalid package.json file gracefully. In what other scenario is build system detection likely to fail?

Copy link
Contributor

Choose a reason for hiding this comment

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

read package up for example? There might be always something that's not in your control and as this is such a critical step in our build process we should just wrap it a catch potential errors.

Even if now nothing is breaking it might be in the future and then everybody forgot about this use case. Adding here a try catch does not hurt but hardens our resilience

@jobala jobala requested a review from lukasholzer December 14, 2022 09:12
const info: Info = { frameworks, buildSystems }
const info: Info = { frameworks }

info.buildSystems = await detectBuildSystems(context.projectDir, context.rootDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you wrap this in a try catch please?

@jobala jobala requested a review from lukasholzer December 14, 2022 15:07
Copy link
Contributor

@lukasholzer lukasholzer left a comment

Choose a reason for hiding this comment

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

Thanks for try/catching it ;)

LGTM!

@jobala jobala merged commit 7f4a2fa into main Dec 14, 2022
@jobala jobala deleted the fix/build-info branch December 14, 2022 15:46
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 this pull request may close these issues.

3 participants