Skip to content

fix(@ngtools/webpack): one star replacement should be preceded by slash #4455

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

Closed
wants to merge 1 commit into from
Closed

Conversation

hccampos
Copy link

@hccampos hccampos commented Feb 6, 2017

When building a project with AoT enabled, I noticed that .spec.ts files were not being excluded properly. This was happening because the pattern **/*.spec.ts triggered the two-stars replacement:

"**/*.spec.ts".replace(/\*\*/g, '(?:.*)')
--> "(?:.*)/*.spec.ts"

And then the one star replacement would replace the * inserted by the previous replacement:

"(?:.*)/*.spec.ts".replace(/\*/g, '(?:[^/]*)')
"(?:.(?:[^/]*))/(?:[^/]*).spec.ts"

With this PR, the single-star replacement expects a slash before the star, i.e. /*.spec.ts, so:

"(?:.*)/*.spec.ts".replace(/\/\*/g, '(?:[^/]*)')
"(?:.*)(?:[^/]*)\.spec\.ts"

Which then properly excludes the spec files. This doesn't handle the case where the pattern is in the form of **/something-*.spec.ts, but I am not sure that is super common.

Since I am not super familiar with the codebase, If you guys know of a simpler or better way to fix this problem, I'd welcome feedback. Or feel free to implement/refactor yourselves.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@hccampos
Copy link
Author

hccampos commented Feb 6, 2017

I signed it!

@hansl
Copy link
Contributor

hansl commented Feb 7, 2017

@hccampos any reason your email address does not match the CLA email? this commit was done under [email protected] which no CLA has been signed for.

@hccampos
Copy link
Author

hccampos commented Feb 7, 2017 via email

@filipesilva
Copy link
Contributor

@hccampos can you resubmit this PR please? It seems googlebot isn't getting it.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants