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

A way to customize the default "src" #23

Closed
nnmrts opened this issue Nov 7, 2021 · 3 comments
Closed

A way to customize the default "src" #23

nnmrts opened this issue Nov 7, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@nnmrts
Copy link
Contributor

nnmrts commented Nov 7, 2021

So firstly, as a sidenote, I think the default cwd (where ultra looks for the app.jsx/app.tsx file) shouldn't even be "src" because the whole philosophy around ultra is that there is no "source", no "build", no transpiling stuf. It should just be called "website" or "root" or "public" in my opinion, or even better, it should just be the current directory the server file is in.

Secondly, and more important, I suggest that this should be customizable. I know, ultra seems to be one of those "zero-config" projects, and I really love that it is, but I believe that the cwd is such a fundamental part that there should just be a simple "cwd" or "root" setting when calling ultra, like so:

import ultra from "https://deno.land/x/ultra@v0.6/mod.ts";

await ultra({
	importmap: await Deno.readTextFile("importmap.json"),
	cwd: "./"
});

If you (as in you, the maintainers of ultra) agree, I'll gladly add a pull request for this. I assume it wouldn't be that difficult to introduce this setting, but let's see.

@nnmrts
Copy link
Contributor Author

nnmrts commented Nov 7, 2021

After opening this issue I discovered #7, and I find the reasoning in there strange, because what is more common is not necessarily better. Even "source" instead of "src" would be better in my opinion, but whatever. As I said, this shouldn't really be the point of the issue, as there should just be a way to customize the app folder name.

@mashaal mashaal added the enhancement New feature or request label Nov 8, 2021
@mashaal
Copy link
Member

mashaal commented Nov 8, 2021

@nnmrts Thanks, we did go back and forth between what a default directory should be, but I agree that making it customisable would be nice. I think due to needing a bit of config for either the oak server, or vercel/deno deployments, the project code would be easier managed living in a specific directory for the time being.

@mashaal
Copy link
Member

mashaal commented Feb 19, 2022

This should be fully resolved in v0.7.0.

You can update the default 'src' directory to a custom directory by making the following changes...

server.ts

Pass through a custom dir into ultra

await ultra({
  importmap,
  dir: "example"
}); 

importmap.json

Update your main app import location...

{
  "imports": {
    "app": "./example/app.jsx"
  }
}

I want to push back on having source files in the project root, as many projects require CI, testing, config, that should live at root level.

@mashaal mashaal closed this as completed Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants