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

chore: Remove direct dependency on inflight via glob #769

Merged
merged 11 commits into from
Dec 8, 2023

Conversation

phani-srikar
Copy link
Contributor

@phani-srikar phani-srikar commented Dec 6, 2023

Description of changes

  • Replaces the glob module that is not maintained actively with globby that is claimed to be much faster and is well maintained. Refer glob's author note in it's repo that recommends globby
  • Update the APIs to use globby equivaltents.
  • Updated yarn.lock will still have inflight but we don't use it in directly in our source code via glob.
  • globby does not support back slashes in patterns, so we need to normalize the patterns to use forward slashes. We have unit tests for windows for these cases.

Codegen Paramaters Changed or Added

Issue #, if available

Description of how you validated changes

Unit and E2E tests

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • Breaking changes to existing customers are released behind a feature flag or major version update
  • Changes are tested using sample applications for all relevant platforms (iOS/android/flutter/Javascript) that use the feature added/modified
  • Changes are tested on windows. Some Node functions (such as path) behave differently on windows.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@phani-srikar phani-srikar requested review from a team as code owners December 6, 2023 23:42
palpatim
palpatim previously approved these changes Dec 6, 2023
dpilch
dpilch previously approved these changes Dec 6, 2023
@phani-srikar phani-srikar dismissed stale reviews from dpilch and palpatim via 114901b December 7, 2023 00:39
palpatim
palpatim previously approved these changes Dec 7, 2023
@phani-srikar phani-srikar changed the title Remove inflight dep chore: Remove inflight dep Dec 7, 2023
@phani-srikar phani-srikar changed the title chore: Remove inflight dep chore: Remove explicit dependency on inflight via glob Dec 7, 2023
@phani-srikar phani-srikar changed the title chore: Remove explicit dependency on inflight via glob chore: Remove direct dependency on inflight via glob Dec 7, 2023
@@ -305,7 +305,7 @@ function loadSchema(apiResourcePath) {
}
if (fs.pathExistsSync(schemaDirectory) && fs.lstatSync(schemaDirectory).isDirectory()) {
// search recursively for graphql schema files inside `schema` directory
const schemas = glob.sync([path.join(schemaDirectory, '**/*.graphql')]);
const schemas = globby.sync([path.join(schemaDirectory, '**/*.graphql')].map((path) => path.replace(/\\/g, '/')));
Copy link
Member

Choose a reason for hiding this comment

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

I believe we used node's built-in path to enforce the correct path parsing & separator in another context. I can't find the reference, but maybe @dpilch remembers?

Copy link
Member

Choose a reason for hiding this comment

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

This is what I used to switch the separators:

.relative(opsGenDirectory, generatedFileName)
// ensure posix path separators are used
.split(path.win32.sep)
.join(path.posix.sep);

@aws-amplify aws-amplify deleted a comment from palpatim Dec 7, 2023
@phani-srikar phani-srikar merged commit c9284bd into main Dec 8, 2023
3 checks passed
@phani-srikar phani-srikar mentioned this pull request Dec 8, 2023
7 tasks
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