Skip to content

Conversation

@jcbhmr
Copy link

@jcbhmr jcbhmr commented Nov 25, 2023

Hello! 👋

This is a friendly PR to upstream some ideas and things that I had to improve the deno_generate subcommand. You should not feel obliged to merge this Pull Request if you don't want to ❤️

This PR would:

  1. Change name from https://deno.land/x/generate to https://deno.land/x/deno_generate so that users who deno install the app don't have to set a custom name; they just deno install -A https://deno.land/x/deno_generate/main.ts and viola! Now they have a deno_generate command ready to go!
  2. Consolidate everything into a single main.ts script. This means removing a bunch of other stuff too...
    1. Removed the deps.ts and dev_deps.ts since it's only one file so why split a single file into two?
    2. Removed all the fancy parsing logic and changed to just a regex in a loop
    3. Used a well-known shell-like quote parsing library
    4. Removed all the custom logging infrastructure
    5. Used standard node: Node.js APIs instead of Deno's std. This is controversial. Can be reverted idc
  3. Still support for the //go:generate -command myalias deno run -A feature commented it out because idk didn't think it was needed for a proof-of-concept thing; you can add it back in idc
  4. Added some visual code examples to the README
  5. Remove the examples folder
  6. Changed up the readme format
  7. Remove the tasks in the deno.json (it's one file main.ts. also its a PoC; who cares about outdated deps lol)
  8. Changed up a bunch of the flags to fit more with //go:generate. idk if this was a good idea or not. probably not. this was a side-effect of me just completely gutting the project
  9. shortened the help menu. again idk if this was a good idea or not lol.
  10. use temp fs tree to do main_test.ts stuff
  11. basically got rid of all other files except the essentials
  12. removed contributing.md; again idk if this is good but since this is such a tiny project i dont think its needed lol
  13. changed the github actions workflow to more accurately reflect whats going on in it (its just deno test being run in ci)
  14. removed the deno.json; there was nothing left in it
  15. removed the deno.lock; it seemed like excess for a single file script

It boils down to: this project is quite large for what it does. It just loops over some //deno:generate (\S+) (.*) stuff and runs the commands. This PR attempts to trim the fat and focus on that. imo the main.ts is much more understandable as a single file unit instead of 10 files scattered over 3 folders. but that's me.

if merged you probs wanna do a squash merge to ignore all my terrible commit messages lol

btw feel free to make edits to this branch: image

again to reiterate: this is an idea that you don't have to merge or even entertain if you dont want. im perfectly OK with continuing to toy around with my own fork 😊 this is just a friendly "here's an idea" pr

@jcbhmr jcbhmr marked this pull request as ready for review February 3, 2024 18:53
@jcbhmr
Copy link
Author

jcbhmr commented Feb 9, 2024

Hello @EthanThatOneKid just checking in.

I've stopped using deno_generate for my projects; I've found deno task generate with a script like:

// deno.json
{
  "tasks": {
    "generate": "deno run -A npm:peggy@3 css.pegjs && deno run -A npm:some-other-package"
  }
}

...to be what I reach for most often instead of another tool that I'd just end up putting in "generate": "deno run -A https://.../deno_generate". 🤷

Point being: I'm no longer using https://github.com/jcbhmr/deno_generate and thus plan on deleting my fork soon. I'd love to see some of the ideas presented in the PR merged back into this original repo but if not that's ok. Would love to see an explicit ✅/❌ 😊

psst! the https://deno.land/x/deno_generate name is still available for you to claim; I didn't claim it lol

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.

1 participant