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

move function to find applications into libnodejs #8

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

mhdawson
Copy link
Member

@mhdawson mhdawson commented May 2, 2023

Move function from to find applications from node-start into libnodejs so that it can be used across buildpacks and extensions.

API has been refined from what was in node-start to make it better as a shared function.

Summary

Add application finder functionality in node-start to libnodejs so that it can be used
across buildpacks and extensions.

Follow on PRs will

  • remove existing functionality in paketo-buildpacks/node-start and make node-start use
    the shared function
  • remove re-use of function in node-start from paketo-community/ubi-nodejs-extension and
    make ubi-nodejs-extension use the shared function.

Last commit of these branches previews what those PRs will look like once this lands
mhdawson/node-start@5d6b152
https://github.com/nodeshift/ubi-nodejs-extension/commit/ce692597f5d2d5d9213f4a43b7b527850ec11ea5

Use Cases

Reduces duplicate code and centralizes knoweldge of constants

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@mhdawson mhdawson requested a review from a team as a code owner May 2, 2023 17:53
@mhdawson mhdawson requested review from TisVictress and paketo-bot-reviewer and removed request for a team May 2, 2023 17:53
@mhdawson
Copy link
Member Author

mhdawson commented May 2, 2023

This is a visual diff between the original code in node-start and the new function in libnodejs to show what's re-used which is most of the logic
image

@mhdawson
Copy link
Member Author

@thitch97 any chance you could take a look?

})

it("finds the app.js application entrypoint", func() {
Expect(os.Remove(filepath.Join(workingDir, "server.js"))).To(Succeed())

Choose a reason for hiding this comment

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

@mhdawson Maybe each of these should be in its own context where only the scaffolding needed for the test is created and where it can be easily destroyed afterward? This could mean significantly more lines of code but I'm thinking about how this might be confusing to someone reading this or adding tests here in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm happy to adjust if we are ok with having more lines of code. Will look at doing that in next few days.

Copy link

@TisVictress TisVictress left a comment

Choose a reason for hiding this comment

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

Please see my comments; I'm open to discussion.

Move function from to find applications from node-start
into libnodejs so that it can be used across buildpacks
and extensions.

API has been refined from what was in node-start to
make it better as a shared function.

Signed-off-by: Michael Dawson <[email protected]>
@mhdawson mhdawson force-pushed the add-application-finder branch from 06fb738 to cc37aae Compare June 1, 2023 16:09
@mhdawson
Copy link
Member Author

mhdawson commented Jun 1, 2023

@TisVictress pushed updated version which uses more contexts to avoid removal of files. I agree it is easier/clearer to read what the test is testing and in the end I don't think it ended up being that many more lines of code.

@mhdawson
Copy link
Member Author

@TisVictress ping

@thitch97 thitch97 added the semver:minor A change requiring a minor version bump label Jun 27, 2023
@thitch97
Copy link

LGTM, I'll let @TisVictress address any other concerns there might be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor A change requiring a minor version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants