-
Notifications
You must be signed in to change notification settings - Fork 623
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
Add installer #488
Add installer #488
Conversation
Thanks @syumai |
@syumai
|
@kt3k |
### 2. Add `~/.deno/bin` to PATH | ||
|
||
``` | ||
echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc # change this to your shell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message should be displayed to user after step 1.
Also I think it makes sense to make it a param if message should be shown - if we add this script to deno as deno install
then .deno/bin
will already be in PATH.
How about Windows?
- This defines what permissions are needed. | ||
|
||
```sh | ||
#!/usr/bin/env deno --allow-read --allow-write --allow-env --allow-run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's pretty cool, but... not all scripts have shebang line - then it deno_install
should handle manually specified perm flags as described by @ry:
So now people can run this:
deno_install file_server https://deno.land/std/http/file_server.ts --allow-write --allow-net
This will create a new executable shell script called $PATH/file_server, which would have the following contents:
#!/bin/sh
deno run --allow-write --allow-net https://deno.land/std/http/file_server.ts $@
If we skip this feature in first version we can drop wget
as well
if (!HOME && !DENO_DIR) { | ||
throw new Error('$DENO_DIR and $HOME are not defined.'); | ||
} | ||
if (DENO_DIR) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using DENO_DIR
instead of default ~/.deno/bin
will require to add $DENO_DIR/bin/
to path as well to run scripts from shell - maybe we can skip this step for now?
if (!modulePath.startsWith('http')) { | ||
throw new Error('module path is not correct.'); | ||
} | ||
const moduleName = path.basename(modulePath, '.ts'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if installed module is JavaScript file?
]; | ||
|
||
writeFileSync(FILE_PATH, encoder.encode('#/bin/sh\n')); | ||
writeFileSync(FILE_PATH, encoder.encode(commands.join(' '))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't second call overwrite first one? Maybe use template string?
const tpl = `#/bin/sh
${commands.join(' ')}`;
writeFileSync(FILE_PATH, encoder.encode(tpl));
this.path = pathBase.slice(2); | ||
this.args = [...parts]; | ||
} else { | ||
this.path = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it work when path
is empty?
@bartlomieju |
@syumai I wanted to get it up to speed but I can't push to your branch :) that's why I opened another one - we can merge them later |
#489 completed implementing this. I close this PR. |
Related to #471 .
What this does
deno_install
.Usage
TODO
wget
.fetch
supports redirect, this can be removed.Why I needed wget?
deno.land
. (e.g.https://deno.land/std/http/file_server.ts
)