jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.41k stars 4.02k forks source link

Use typesafety within the generator #26114

Open Tcharl opened 3 months ago

Tcharl commented 3 months ago
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

https://github.com/jhipster/generator-jhipster/pull/26111 https://github.com/jhipster/generator-jhipster/pull/26110 https://github.com/jhipster/generator-jhipster/pull/26096

mshima commented 3 months ago

I don’t understand the proposal.

Tcharl commented 3 months ago

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

Tcharl commented 3 months ago

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

irwansyahwii commented 1 month ago

I will took this one @Tcharl

irwansyahwii commented 1 month ago

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 commented 1 month ago

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.