-
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
Idea: Deno Workspace #4275
Comments
For updating dependencies in a deps.ts or importmap.json see a script I put together: The good thing about deno-workspace idea is you can write it as a third party lib... so I think the first thing to do is to do just that: write a proof of concept... if it works well it's possible it could be brought into deno (I suspect ry will consider it a little too magical), but it would be useful as a third party CLI. |
@hayd There are several limitations with your script:
|
It's actually even worse, it doesn't parse it just uses regex. The main difference is it's active update, without interfering with deno resolution i.e. rather than relying on npm install (or bundle or whatever) to resolve what to download. It's way too naive to be magical, but thanks! 😄 |
What do you mean by this? That you don't need to re-run |
This is aside from your proposal / this issue... It's best practice to use deps.ts for that very reason. If deps.ts includes all the dependencies your project needs i.e. all external imports are defined there, then (after I guess what I meant by "active update" was, after running, you end up with explicit versions in your code (e.g. deps.ts) rather than a range - and that's the thing that's committed and that deno runs. Anyway 🤷♂ |
@hayd I see. So Regarding |
@KSXGitHub I have a question : Why add dependencies if you don't use it ? |
I do not always make one file. If different files rely on different set of dependencies, then some are ought to be unused. |
I made dimp a month ago for easier management of imports in import map but the problem is that import maps don't work for installing etc. |
By "installing", you mean |
Yeah |
Now I see one advantage |
@KSXGitHub It should work only on development If you want to distribute your code you must transpile and bundle (eventually compile) it first |
That was what Deno Workspace intended for.
Compile, yes, but bundle, not necessary. Deno Workspace can be used to generate a module repository, which can be used by other Deno developers. |
See #2584 (comment), "boilerplate" referring to config/workspace files. In general the goal is to achieve things like this as userland conventions represented in code. That said, it seems like the suggested workflow here is to write a library accompanied with a workspace file allowing you to use abbreviated import specifiers for dependencies -- and compile all of that into a regular library that would run under Deno now. This can be implemented as a third party tool. No need for Deno to load it or even know about it. |
TBH, I'm fine with long import statements, updating dependencies manually, and explicitly writing down permissions. Those don't really seem like actual problems to me but something that is good practice, though it may be a tiny bit tedious at times. Adding a new workspace concept, a new file format and new commands to Deno, however, seems like quite a huge increase in complexity. I feel like this is something that could be addressed by a third party tool if there's a need for it. Especially at this point in time, with most Deno projects being rather small, I don't really see a need for this to be a core feature of Deno. |
@KSXGitHub I was looking for something similar to what you described when I stumbled upon this issue. I just released a small tool that handles permissions and scripts in a file in a similar fashion as to what you described https://github.com/BentoumiTech/denox |
How about this, for all of our external dependencies, we can keep all our imports in It'll be easier to go through all remote dependencies, and their current versions. dep.ts import { serve } from "https://deno.land/[email protected]/http/server.ts";
export {
serve
} main.ts import { serve } from "./dep.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
req.respond({ body: "Hello World\n" });
} |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Rationale
import
lines to be shorter, so we need import-map, but we don't want to write them by hand.--allow-all
is convenient, but risky.--allow-foo --allow-bar --allow-baz ...
is long and hard to type.Suggestion
deno-workspace
file that Deno automatically loads if it exists in current working directory.deno-workspace
file...package.json
: Unlikepackage.json
,deno-workspace
file won't be published to registry, and even if it does, Deno will not load it.tsconfig.json
,pnpm-workspace.yaml
,stack.yaml
,Makefile
and other build file formats: Deno and other tools may use it to build binaries.Requirements
deno-workspace
file per workspace.deno-workspace
files of dependencies (should there be any) are completely ignored.deno-workspace
file.deno-workspace
.Example CLI Commands
Example
deno-workspace
fileChoosing File Format
JSON
git diff
andgit merge
JSON5
TOML
RON (https://github.com/ron-rs/ron)
YAML
Programmable JavaScript/TypeScript
My Preference
The text was updated successfully, but these errors were encountered: