Skip to content

Bundling nessie and running it doesn't work #22

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

Closed
leabstrait opened this issue May 18, 2020 · 4 comments
Closed

Bundling nessie and running it doesn't work #22

leabstrait opened this issue May 18, 2020 · 4 comments
Assignees
Labels
bug Something isn't working up for grabs If you have an implementation in mind, feel free to help us out by making a PR

Comments

@leabstrait
Copy link
Contributor

leabstrait commented May 18, 2020

I want to run Nessie with a shorter command than to type out the whole URL. So I opted for this 'bundling' solution as pointed out in the discord server of deno. However, I have a problem.

➜ deno bundle https://deno.land/x/nessie/cli.ts deps/nessie_cli.ts

Emitting bundle to "deps/nessie_cli.ts"
1450193 bytes emitted.

[Okay, bundling is done]

➜ deno run --allow-net --allow-read --allow-write https://deno.land/x/nessie/cli.ts make initialize_db

Created migration 1589728502895-initialize_db.ts at /home/***/***/migrations

[Migration gets created when running from a remote URL]

➜ deno run --allow-net --allow-read --allow-write deps/nessie.ts make initialize_db

[However, this does nothing]

@halvardssm
Copy link
Owner

Hi @leabstrait ! Thanks for letting me know of this! I haven't tried to bundle it until now, but I can see it being a useful feature. I will add it to the roadmap of v1. I will probably not deal with it until the rest of the functionalities are implemented, but it will be on the list 💪

@halvardssm halvardssm mentioned this issue May 18, 2020
25 tasks
@halvardssm halvardssm added bug Something isn't working up for grabs If you have an implementation in mind, feel free to help us out by making a PR labels May 18, 2020
@halvardssm
Copy link
Owner

Hi @leabstrait ! I think bundling finally works with Deno 1.0.5 and with Nessie 0.5.2 🎉 Can you confirm this?
deno bundle https://deno.land/x/[email protected]/cli.ts nessie_cli.js
deno run --allow-net --allow-read --allow-write nessie_cli.js init

@leabstrait
Copy link
Contributor Author

Hi @halvardssm,

Yes it works @v0.5.2

Also, the bundle is a .js file, I see. I was trying to bundle it to .ts extension at first, but while running it, there were errors about typing. I changed it to .js and it worked promptly. Not a problem for me, just an observation.

I came to this problem when thinking of a solution like python virtualenvs which let you use specific versions of packages for one project. Since deno install did a global install, I had wanted something project-local.

Your fix of bundling solved this issue. But as I spend more time with deno, I don't know if python's virtualenv solution applies here, especially when you can specify versions in the URL itself and use a deps.ts to manage project dependencies.

Anyways great, thanks. You can close this issue as you see fit.

@halvardssm
Copy link
Owner

Great! deno bundle bundles the code into ESM JS so that it can run without the tsc overlay, I dont think bundling to TS will be supported anytime soon 🤔 Technically you can achieve what you want, but you will have to bundle each and every external module manually, and also get the types separately. I would probably use deps.ts for now and maybe move over to import maps when this is stable 💪

@halvardssm halvardssm self-assigned this Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working up for grabs If you have an implementation in mind, feel free to help us out by making a PR
Projects
None yet
Development

No branches or pull requests

2 participants