-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
consider a deno new
command to encourage best practices
#2584
Comments
I think a |
@maxuuell just to make sure we're on the same page, you're suggesting that this feature could already be accomplished by using the One of the goals of this issue would be for deno to establish some best practices. It sounds like your suggestion would specifically not address that goal? Or maybe I'm not understanding your suggestion--is there some way in which the Separately, generating code (and, if you saw my edit, running tasks) is a universal aspect of programming. One of ry's stated goals for deno is as a scripting companion alongside other languages. It seems like code generation (and tasks) fits into that goal. Admittedly, this feature would be strictly in the "quality of life improvement" category. edit One of the advantages to baking something like this into the CLI, is the fact that the CLI could automatically pick up project related scaffolding/tasks in some way. Though I realize I'm kinda advocating for two different things here: a |
This in general feels like a higher order concern of people doing derivative things. At the Deno level, I don't think we can hold that much of an opinion because the type of workloads that people would author are so diverse. It might be a single file script, it might be a web server and to "enforce" or even advocate would mean we would get it wrong 90% of the time for the 10% of time we got it right. Angular and things like React Create App are higher order frameworks that can have opinions about how you structure a web application. Because as you point out there is no |
@thefliik
You absolutely could create a node script that does the same thing. Totally agree. My intention was only to take advantage of the new deno tools to help create deno projects.
I thought that, by use a script to generate a scoffold of a deno project, you could enforce some best practices. So far, all I found in the manual and other projects was using
No no. Never was intended to be "official". Would be cool if it were 😉 but I don't think the deno team is at that point yet, as @kitsonk mentioned. I just thought, if I built out a script that others could install and use to bootstrap/scaffold projects more quickly, it would help adoption, etc... And it would totally be a quality of life thing. Hope that helps clarify things 👍 |
@kitsonk You bring up good points. But just to make sure you understand what I'm proposing, let me take one last stab at clarifying (because what I was envisioning is pretty un-opinionated): User story:User opens a repo and invokes At this point you might be thinking, "what's the different between
These might seem like minor changes but I really feel like they'd have a big impact on quality of life and usability. Separately I'd propose that a Again these are 100% customizable and the commands are largely just copies of
These obviously fall under "quality of life changes" and are debatable, but I feel like they are in a similar spirit to Anyway, I can definitely appreciate if you still disagree. |
@maxuuell 👍 ah gotcha. And it is cool! I definitely appreciate that you made it to work via |
Closing due to lack of interest |
One of the main goals of Deno is to reduce unnecessary boilerplate. Generating a project directory with boilerplate would only be a todo list of boilerplate to remove. |
Well a comment like that makes me worried that you didn’t read the proposal, because it was optional and fully customizable by the end user. I can understand if it’s just not something you want, but it sucks to close a suggestion while feeling like it hasn’t been heard. But you obviously have a lot of people talking at you, so it happens. |
Does creating a template repo suffice for many usecases? This can also be created as an external module, e.g. https://github.com/maxuuell/deno_init |
@thefliik Sorry if I was dismissive. TBH I hadn't read your complete proposal but I have now. My comments regarding generated code and "deno new" stand - I really want to avoid boilerplate or mechanisms that can justify adding boilerplate - I prefer this to be as minimal as possible. Regarding scripts or "deno task", I certainly appreciate the usefulness of "npm run" and the "scripts" section of package.json, but I want to avoid having a configuration file (i.e. a package.json like thing) and all the complexity that comes with it... What you're really after is a way for a deno project directory to provide a small set of actions. I wonder if this can be achieved in some other way? What if the convention is to have a file called import { register } from "https://deno.land/std/tools/mod.ts";
register({
start: "deno run server.ts -A",
lint: "eslint src/**/*.ts",
}); |
@ry What if you could "register"/install subcommands somehow (into DENO_DIR). In that way deno itself wouldn't need to pick a winner. |
@ry, I'm definitely not committed to a particular implementation. How would Would it make sense for me to create a new issue for something like: ? import { register } from "https://deno.land/std/tools/mod.ts";
register({
start: "deno run server.ts -A",
lint: "eslint src/**/*.ts",
}); I'm also attracted to @hayd's suggestion of a way (at some point) of installing 3rd-party subcommands for This being said, with a convention like |
@hayd, ry hit the nail on the head:
I realize that I initially framed this feature request poorly, and it's sort of advocating for two similar, yet distinct, feature requests (a |
Regarding the syntax proposed by @ry in #2584 (comment) That looks a lot like Jake. Would a Deno port of that make sense in std? |
edit: I think my comment below does a better job of explaining what I'm proposing.
Bear with me on this first paragraph, I do have a point...
While I appreciate deno eliminating
package.json
, there are several aspects ofpackage.json
that I find myself missing. For instance,package.json
established a convention of adding / aliasing project tasks in the"scripts"
section, and in general I've found a good way to learn about a new repo is to start by peaking insidepackage.json
. It can also be helpful to know where to look to find a project'sversion
, etc. All of this really just boils down to the fact thatpackage.json
helped push/establish a set of project conventions within the javascript / node community.I definitely don't want deno to require a set of project conventions, but it would be nice if deno suggested some project conventions / best practices.
The best way that comes to mind to accomplish this would be to add a
deno new
(ordeno init
,deno generate
, etc) command which scaffolds out a new project directory. This project directory could adhere to whatever the deno "best practices" are.Would you accept PRs for a feature like this? Do other people think this is a good idea?
For example (obviously up for discussion):
mod.ts
filedeps.ts
fileREADME.md
The "version 1" implementation of a
deno new
might just do this. But a "version 2" of adeno new
implementation could also allow scaffolding a new project from some sort of config / scaffolding template file. A "version 3" implementation might allow users to add custom named generators to a project, so someone could dodeno new service my-service
. Etc.In this way, a
deno new
command could help to establish general best practices within the deno community, and it could also help establish project specific best practices (through user specified scaffolding templates).In some hypothetical future, I could imaging many deno "getting started" tutorials beginning with "first install deno by........Then, run
deno new hello_world
".Prior art
angular.json
file in a project's root.Edit
I suppose, for maximum flexibility, a "scaffolding template" could simply be a script. So
deno new service my_service
would call some script that's somehow been labeledservice
and pass it themy_service
argument. At that point, the feature is really just looking like a way of defining tasks for a project, which brings up new ideas. But I'll stop ideating here and see what other people are thinking.The text was updated successfully, but these errors were encountered: