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

Post writing operations fails to edit multi-step transform files. #23391

Closed
1 task
mshima opened this issue Sep 4, 2023 · 3 comments
Closed
1 task

Post writing operations fails to edit multi-step transform files. #23391

mshima opened this issue Sep 4, 2023 · 3 comments

Comments

@mshima
Copy link
Member

mshima commented Sep 4, 2023

Overview of the issue

Multi-step transform changes the file name removing the trailing .jhi, but mem-fs is not updated.
At jhipster 7 we had a workaround that falls back to the multi-step file if the actual file is not found:

if (!this.env.sharedFs.existsInMemory(filePath) && this.env.sharedFs.existsInMemory(`${filePath}.jhi`)) {

The workaround works but it work only for the specific api.
The fix is to update the mem-fs to point to the renamed file path.

Less then optimal implementation:

  • with current mem-fs apis, it would be possible to mark the file as not touched and add a new file, but the old file may a vinyl fs or other kind of file, making more difficult to clone/duplicate.
  • with current mem-fs-editor apis, it would be possible to move a file, but since it's designed to mimic the actual file system, the moved file is actually deleted and shows on snapshots.
Motivation for or Use Case

Native blueprint issue jhipster/generator-jhipster-native#85 (comment)

Reproduce the error

Native blueprint issue jhipster/generator-jhipster-native#85 (comment)

Related issues
Suggest a Fix
JHipster Version(s)

main

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@mshima
Copy link
Member Author

mshima commented Sep 8, 2023

editFile workaround is still in place, but others apis will error.
A fix will probably be ready for final v8.

@mshima
Copy link
Member Author

mshima commented Oct 3, 2023

Assertions using runResult requires jhi file extension too:

    it('should generate entities containing jakarta', () => {
      result.assertFileContent('src/main/java/com/mycompany/myapp/domain/Foo.java.jhi', 'jakarta');
    });

@mshima
Copy link
Member Author

mshima commented Oct 17, 2023

Closing in favor of #23868.

@mshima mshima closed this as completed Oct 17, 2023
@deepu105 deepu105 added this to the 8.0.0 milestone Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants