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

Bug(migrate): No files match pattern during migration #700

Open
1 task done
hakimio opened this issue Sep 7, 2023 · 16 comments
Open
1 task done

Bug(migrate): No files match pattern during migration #700

hakimio opened this issue Sep 7, 2023 · 16 comments

Comments

@hakimio
Copy link
Contributor

hakimio commented Sep 7, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Which Transloco package(s) are the source of the bug?

transloco

Is this a regression?

Yes

Current behavior

Trying to migrate a project from ngx-translate, I get No files match the pattern for all file patterns even the files exist in the specified path.

Migrating HTML files 📜
√ Step 1/2: Migrating directives
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.html
√ Step 2/2: Migrating pipes
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.html
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.html

Migrating TS files 📜
√ Step 1/5: Migrating modules
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.ts
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.ts
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.ts
√ Step 2/5: Migrating service imports
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.ts
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.ts
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.ts
√ Step 3/5: Migrating constructor injections
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.ts
√ Step 4/5: Migrating service usage
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*.ts
√ Step 5/5: Migrating specs
⚠️ No files match the pattern: C:\Users\PC1\SomePath\MyApp\src\app\**\*spec.ts

Expected behavior

Migration should successfully migrate the files.

Please provide a link to a minimal reproduction of the bug, if you won't provide a link the issue won't be handled.

https://codesandbox.io/s/ngneat-transloco-kn52hs

Transloco Config

No response

Please provide the environment you discovered this bug in

Transloco: 5.0.7
Angular: 16
Node: 18
Package Manager: yarn v1
OS: Windows 10

Browser

No response

Additional context

No response

I would like to make a pull request for this bug

No

@shaharkazaz
Copy link
Collaborator

@hakimio which transloco version is this? 5 is too general 🙂

@hakimio
Copy link
Contributor Author

hakimio commented Sep 7, 2023

Might be replace-in-file latest version issue: adamreisnz/replace-in-file#165

@hakimio
Copy link
Contributor Author

hakimio commented Sep 7, 2023

Latest, 5.0.7.

@hakimio
Copy link
Contributor Author

hakimio commented Sep 7, 2023

Ok, I can confirm that it works correctly with replace-in-file v6.3.5, but not with the latest v7.0.1.
So it's an issue with replace-in-file library.

@shaharkazaz
Copy link
Collaborator

shaharkazaz commented Sep 7, 2023

@hakimio Let's downgrade to v6.3.5, would you like to open a PR? 🙂

@hakimio
Copy link
Contributor Author

hakimio commented Sep 7, 2023

@shaharkazaz the person who reported the issue in replace-in-file repo fixed it by changing path match patterns.
So, I'm not sure if it would be best to downgrade the library or try to change all the patterns on transloco side.

@shaharkazaz
Copy link
Collaborator

@hakimio this needs to be tested on both machines.
Can you explain why this was resolved by replacing the path.join usage?

@hakimio
Copy link
Contributor Author

hakimio commented Sep 7, 2023

I only know what the bug reporter wrote.
In the bug report he wrote:

We replaced RplaceInFileOption.files with the correct glob pattern and it works fine, however in 6.3.5, \\**\*.js also works fine, which is confusing.

In the PR, where he replaced path.join, he wrote the following in Chinese (rough google translation):

ReplaceInFileConfig.files should be a list of glob patterns, \\ is not recognized unless windowsPathsNoEscape is enabled.

replace-in-file 6.3.5 works fine confusingly, don't understand why it works, but still by glob requirement.

And replace-in-file maintainer doesn't have Windows PC either...

EDIT: might be related: UNC Paths.

@shaharkazaz
Copy link
Collaborator

@hakimio Ok, so it feels like that replace-in-file should pass windowsPathsNoEscape to glob under the hood, I actually did this change in Transloco's schematics a couple of weeks ago.

@hakimio
Copy link
Contributor Author

hakimio commented Sep 7, 2023

Do you want to open a PR in replace-in-file repo?

@shaharkazaz
Copy link
Collaborator

@hakimio I think that's the better solution here, but IDK when the maintainer might be back so no ETA on the fix.

@hakimio
Copy link
Contributor Author

hakimio commented Sep 7, 2023

Ok, for now I can just pin replace-in-file version on my end:

"resolutions": {
  "replace-in-file": "6.3.5"
}

@shaharkazaz
Copy link
Collaborator

@hakimio I think the migration script is the only one using it, so once done you shouldn't encounter it anymore

@hakimio
Copy link
Contributor Author

hakimio commented Sep 11, 2023

@shaharkazaz are you going to create a PR in replace-in-file or should I do it?

@shaharkazaz
Copy link
Collaborator

@hakimio You can do it if you want to 👍

@hakimio
Copy link
Contributor Author

hakimio commented Sep 13, 2023

PR: adamreisnz/replace-in-file#169

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

No branches or pull requests

2 participants