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

refactor(angular-output-target): split up component proxy code generation #302

Merged
merged 17 commits into from
Oct 3, 2022

Conversation

sean-perkins
Copy link
Collaborator

@sean-perkins sean-perkins commented Sep 30, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally for affected output targets
  • Tests (npm test) were run locally and passed
  • Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

N/A

What is the new behavior?

  • Adds test coverage to code generation
  • Splits up proxy generation into separate functions

Does this introduce a breaking change?

  • Yes
  • No

Other information

Split from: #298

@sean-perkins sean-perkins changed the title feat(angular-output-target): proxyDeclarationFile generates component proxies refactor(angular-output-target): split up component proxy code generation Sep 30, 2022
@sean-perkins sean-perkins marked this pull request as ready for review September 30, 2022 17:21
@sean-perkins sean-perkins requested review from a team as code owners September 30, 2022 17:21
Copy link
Member

@rwaskiewicz rwaskiewicz left a comment

Choose a reason for hiding this comment

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

LGTM all in all. This is all code I previously approved, and I don't love the idea of double-jeopardy when it comes to code reviews - I left a few comments, but consider them non-blocking/as suggestions

const renamedType = `I${componentClassName}${type}`;
return renamedType
.replace(new RegExp(`^${src}$`, 'g'), `${dst}`)
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => [p1, dst, p2].join(''));
Copy link
Member

Choose a reason for hiding this comment

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

FWIW, I think this can be simplified to:

Suggested change
.replace(new RegExp(`([^\\w])${src}([^\\w])`, 'g'), (v, p1, p2) => [p1, dst, p2].join(''));
.replace(new RegExp(`(\W)${src}(\W)`, 'g'), (v, p1, p2) => [p1, dst, p2].join(''));

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm going to opt against taking this commit for this PR. If you want to open up another PR to make that isolated change, I can review it 👍 that way in the event of a bug around this code in the future, it will be easier to reason about the timeline of changes.

@sean-perkins sean-perkins merged commit 2a001a3 into main Oct 3, 2022
@sean-perkins sean-perkins deleted the feat/angular-output-target-updates branch October 3, 2022 17:43
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.

None yet

3 participants