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

Feathers v5 CLI #2425

Closed
wants to merge 22 commits into from
Closed

Feathers v5 CLI #2425

wants to merge 22 commits into from

Conversation

daffl
Copy link
Member

@daffl daffl commented Aug 6, 2021

This pull request is the draft for a more modern and flexible generator and CLI tool based on Hygen and a modernized and more concise new application structure where service class, new hooks and service registration are all together in the same file. It also uses ES modules for the JavaScript version and automatically generates and registers schemas and resolvers.

For more details on CLI usage see #2414

This is a big undertaking and the current progress is tracked here:

  • Fork Hygen to make it more embeddable (see https://github.com/feathersjs/hygen)
  • Create core CLI
  • Basic app generator (static files, package.json)
  • Test core generators in CI
  • Eject templates via feathers customize <name>
  • JavaScript
    • App generator (Koa/Express app.js, service index, channels)
    • Service base generator (import, hook registration etc.)
    • Custom service generator
    • Memory service generator
    • Hook generator
    • Core authentication generator
    • Local authentication generator
    • oAuth authentication generator
    • Schema generator
  • TypeScript
    • App generator (Koa/Express app.ts, declaration, service index, channels etc.)
    • Service base generator (import, hook registration etc.)
    • Custom service generator
    • Memory service generator
    • Hook generator
    • Core authentication generator
    • Local authentication generator
    • oAuth authentication generator
    • Schema generator
  • Legacy template generator

@daffl daffl mentioned this pull request Aug 16, 2021
@FossPrime
Copy link
Member

FossPrime commented Sep 29, 2021

Just a thought:

It sounds like hygen is more testable... aka, it can be easily configured programmatically without dealing with a file system. It would be really interesting to see what a stateless-ish call to the generator would look like in Runkit... That is...

// path pwd, oauth credentials in env, production defaults. Assume reverse proxy handles SSL/DDOS/etc
new fjsCli({db: 'mongo://...', services:[{name: pog, hooks: [...] }]})

@daffl
Copy link
Member Author

daffl commented Sep 29, 2021

If we do have file system access that could be possible. It is indeed much easier to use programmatically. Currently it looks like this: https://github.com/feathersjs/feathers/blob/hygen-cli/packages/cli/test/index.test.ts#L84-L96 - the createPrompter override is still a little clunky but since I'm using our own Hygen fork we can add what we need.

@FossPrime
Copy link
Member

FossPrime commented Oct 6, 2021

  • package.json shouldn't this be in tilde quotes?
  • feathers generate service errors out with TypeError: Cannot read property 'name' of undefined on cli/_templates/service/base/index.js:8:20
    • is feathers g custom service the correct new syntax?
    • If so what should the comment in line 80 of tests say?
    • it seems to be writing to /services on the root directory if directories.lib is not defined in package.json, not a huge deal... unless.
  • ts-node is more up to date than ts-node-dev, using ts-node 10, and with better support for "typescript": "^4.5.0-beta",'s tsconfig "module": "nodenext", https://codesandbox.io/s/ts-http-ygsxh?file=/tsconfig.json

https://codesandbox.io/s/feathers-dove-cs7qc?file=/src/services/index.ts

@daffl
Copy link
Member Author

daffl commented Jun 14, 2022

This has been superseded by #2578

@daffl daffl deleted the hygen-cli branch June 14, 2022 00:44
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

Successfully merging this pull request may close these issues.

None yet

2 participants