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

Use type checking within the generator #26114

Closed
1 task
Tcharl opened this issue May 12, 2024 · 6 comments · Fixed by #27328
Closed
1 task

Use type checking within the generator #26114

Tcharl opened this issue May 12, 2024 · 6 comments · Fixed by #27328
Milestone

Comments

@Tcharl
Copy link
Contributor

Tcharl commented May 12, 2024

Overview of the feature request

Now that most of the generator is in typescript, type safety can be ensured removing all the any and enforcing attributes types (i.e. let myVar: string), function parameter types, and function return types.

Motivation for or Use Case

Type safety helps to avoid some mistakes, but also helps new jhipster contributors (and occasional contributors like me) to better understand how the generator is architectured: in the end, it speeds up the delivery of new features due to a better developper experience.

Related issues or PR

#26111
#26110
#26096

  • Checking this box is mandatory (this is just to show you read everything)
@mshima
Copy link
Member

mshima commented May 12, 2024

I don’t understand the proposal.

@Tcharl
Copy link
Contributor Author

Tcharl commented May 12, 2024

Just to historize the work on making the generator more typescript friendly sir ;-)

@DanielFran DanielFran added $100 https://www.jhipster.tech/bug-bounties/ $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ labels May 17, 2024
@Tcharl Tcharl mentioned this issue May 19, 2024
6 tasks
@Tcharl
Copy link
Contributor Author

Tcharl commented May 20, 2024

@DanielFran I'll leave the bounty to anyone else willing to contribute to the overall rework

@Tcharl Tcharl mentioned this issue May 25, 2024
6 tasks
@irwansyahwii
Copy link

I will took this one @Tcharl

@irwansyahwii
Copy link

Too bad, I got error after cloning the repo and ran npm test. This is the message:

node:internal/bootstrap/switches/does_own_process_state:130
  rawMethods.chdir(directory);
             ^

Error: ENOENT: no such file or directory, chdir '/Users/irwansyah/Documents/PROJECTS/generator-jhipster' -> '/private/var/folders/v3/gklj4nxd11dd9kfq3s1d0mx80000gn/T/8e824baf2be964132208060d1db5de487b13863d'
    at wrappedChdir (node:internal/bootstrap/switches/does_own_process_state:130:14)
    at process.chdir (node:internal/worker:110:5)
    at process.chdir (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/graceful-fs/polyfills.js:22:11)
    at process.chdir (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/@pnpm/network.ca-file/node_modules/graceful-fs/polyfills.js:22:11)
    at JHipsterRunContext.restore (file:///Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/yeoman-test/dist/run-context.js:164:21)
    at JHipsterRunContext.cleanupTemporaryDir (file:///Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/yeoman-test/dist/run-context.js:183:14)
    at TestContext.startNewContext (file:///Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/yeoman-test/dist/test-context.js:6:26)
    at process.cleanupTemporaryDir (file:///Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/yeoman-test/dist/test-context.js:13:17)
    at process.emit (node:events:531:35)
    at process.processEmit [as emit] (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/restore-cursor/node_modules/signal-exit/index.js:191:37)
    at process.exit (node:internal/process/per_thread:185:15)
    at _exit (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/workerpool/src/worker.js:129:12)
    at worker.cleanupAndExit (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/workerpool/src/worker.js:133:12)
    at process.<anonymous> (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/workerpool/src/worker.js:148:19)
    at process.emit (node:events:519:28)
    at process.processEmit [as emit] (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/restore-cursor/node_modules/signal-exit/index.js:199:34) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'chdir',
  path: '/Users/irwansyah/Documents/PROJECTS/generator-jhipster',
  dest: '/private/var/folders/v3/gklj4nxd11dd9kfq3s1d0mx80000gn/T/8e824baf2be964132208060d1db5de487b13863d'
}

Node.js v20.15.1

  9719 passing (4m)
  793 pending

@mshima
Copy link
Member

mshima commented Jul 11, 2024

Too bad, I got error after cloning the repo and ran npm test. This is the message:

node:internal/bootstrap/switches/does_own_process_state:130
  rawMethods.chdir(directory);
             ^

Error: ENOENT: no such file or directory, chdir '/Users/irwansyah/Documents/PROJECTS/generator-jhipster' -> '/private/var/folders/v3/gklj4nxd11dd9kfq3s1d0mx80000gn/T/8e824baf2be964132208060d1db5de487b13863d'
    at wrappedChdir (node:internal/bootstrap/switches/does_own_process_state:130:14)
    at process.chdir (node:internal/worker:110:5)
    at process.chdir (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/graceful-fs/polyfills.js:22:11)
    at process.chdir (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/@pnpm/network.ca-file/node_modules/graceful-fs/polyfills.js:22:11)
    at JHipsterRunContext.restore (file:///Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/yeoman-test/dist/run-context.js:164:21)
    at JHipsterRunContext.cleanupTemporaryDir (file:///Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/yeoman-test/dist/run-context.js:183:14)
    at TestContext.startNewContext (file:///Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/yeoman-test/dist/test-context.js:6:26)
    at process.cleanupTemporaryDir (file:///Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/yeoman-test/dist/test-context.js:13:17)
    at process.emit (node:events:531:35)
    at process.processEmit [as emit] (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/restore-cursor/node_modules/signal-exit/index.js:191:37)
    at process.exit (node:internal/process/per_thread:185:15)
    at _exit (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/workerpool/src/worker.js:129:12)
    at worker.cleanupAndExit (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/workerpool/src/worker.js:133:12)
    at process.<anonymous> (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/workerpool/src/worker.js:148:19)
    at process.emit (node:events:519:28)
    at process.processEmit [as emit] (/Users/irwansyah/Documents/PROJECTS/generator-jhipster/node_modules/restore-cursor/node_modules/signal-exit/index.js:199:34) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'chdir',
  path: '/Users/irwansyah/Documents/PROJECTS/generator-jhipster',
  dest: '/private/var/folders/v3/gklj4nxd11dd9kfq3s1d0mx80000gn/T/8e824baf2be964132208060d1db5de487b13863d'
}

Node.js v20.15.1

  9719 passing (4m)
  793 pending

This error is in yeoman-test.
I didn’t take a look at it since everything is working as expected. Just a cleanup step is failing.

@Tcharl Tcharl mentioned this issue Aug 27, 2024
6 tasks
@Tcharl Tcharl changed the title Use typesafety within the generator Use type checking within the generator Aug 28, 2024
@mraible mraible added this to the 8.7.1 milestone Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants