D
Deno

help

How to write a new project template script

Sspaceflounder11/21/2023
Hey, I've written a small game engine to create text adventures in Deno. The resulting project is a static web site—just a few little files—which can then be uploaded to itch.io or some other static web-based game server. What would make this easier is a script of some kind that would generate new projects from a template. Currently, Vite uses a script that asks the user a few questions on the command line and generates a new project from GitHub. Is there an idomatic way to do this with Deno? If I write a new project script like this, is there a way to upload it so other users can create games the same way?
ABAltair 680b11/21/2023
Have a look at Fresh init.ts It has all the features that you would need to create this. https://github.com/denoland/fresh/blob/main/init.ts
Rraunioroo11/21/2023
might be just me but this sounds like a simple enough problem you could just raw dog write it in, well, Deno. There is prompt(), alert() and confirm() functions for simple ui interactions. Seems like there shouldn't be a need to bring in huge amount of dependencies for this? There's also https://cliffy.io/ which is pretty nice for making fancier CLI apps with all kinds of prompts, command line arguments, automatic --help generation etc. It's around 230Kb / 40 files Fresh init brings a whopping 11.9Mb of dependencies in 190 files 😲
ABAltair 680b11/21/2023
I pointed to Fresh init.ts for inspiration, not to use it. I agree that this should be easy to build.
I wouldn't even use cli-input, just supply a cfg file and use that for options to scaffold the app.
Sspaceflounder11/22/2023
Hey, I wanted to thank the community and report back. This was really easy! I was hampered a little by the fact that there appears to be a bug in Deno for Windows right now with the prompt command. I switched to just using Deno.args and saved myself some pain. Here it is: https://github.com/spaceflounder/yarthouse
GitHub
GitHub - spaceflounder/yarthouse: Command line tool for creating Ya...
Command line tool for creating Yart games. Contribute to spaceflounder/yarthouse development by creating an account on GitHub.
ABAltair 680b11/22/2023
Short and sweet! Very nice!

Looking for more? Join the community!

Recommended Posts
Seamlessly include TailwindcssIs there a recommended way of achieving this at the moment? What is the cleneast way of including tatidy up `deno.lock`Hey, is there something like `go mod tidy` (https://golangbyexample.com/go-mod-tidy/) in Deno? The bSyntaxError on Web3 packageI'm trying to use this module in my project https://deno.land/x/web3@v0.11.1 and i'm using the code how to document oak apiWhat’s the best way to document an oak api. Like swagger or some kind of thatweb based cmsIs there any web based cms system like word press based on deno or fresh?Minimal code for Preact SSRWhat's the actual code to do some Preact SSR with Deno? For example something simple like a counterHow to use recent Tensorflow.JS? TF from deno.land/x/tensorflow@v0.21 appears to work, but it's oldI've only tried the TF package from deno.land/x/tensorflow@v0.21 with the readme page example. I'm hDeno Deploy isolate startup timeis this startup time normal? https://media.discordapp.net/attachments/936130919163641856/11757670644Deno KV equivalent of 'returning'hello, in sqlite there is a way to get the new value set on an upsert like so insert into cCan't use npm package: Uncaught (in promise) TypeError: Could not resolve 'preact/hooks'I get this error when trying to import the Preact version of Auto-animate in Fresh https://auto-animLeaking resources from inbound HTTP connections in testsAnyone have any ideas why I would be getting the following error. I'm using an oak server that is stPreact Hello World is not working/** @jsxImportSource https://esm.sh/preact */ import { useState } from "https://esm.sh/preact/hooks"using imports map to map no-suffix imports to suffix importsI was hoping i might be able to use an import map in my deno.json like this: ``` "imports": { "./sdocker-jupyter with deno?Anyone know any good pre-made solutions? Thanks!Importing JSON files with a different file extension fails as "Unknown module"When trying to import a json file with import attributes that doesn't end with .json Deno gives the BroadcastChannel vs EventSource vs WebSocketWhy would one uses BroadcastChannel, over EventSource, or WebSocket? Could anyone provide clear exa