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

Need more docs #1

Open
loia5tqd001 opened this issue Dec 19, 2021 · 1 comment
Open

Need more docs #1

loia5tqd001 opened this issue Dec 19, 2021 · 1 comment

Comments

@loia5tqd001
Copy link

I've tried

deno install --unstable --name uscript-deno main.ts

and

deno install --unstable --allow-net --allow-read --allow-run --allow-write --name uscript-deno main.ts

as found in the Install section but nothing happens.

image


Here is what I as a user wants:

  • I know how to write Typescript code
  • I know how to point a user script manager (like Tampermonkey) to a specific js file on my machine: https://stackoverflow.com/a/55568502/9787887
  • So I need a way to write Typescript code in a folder my-script/main.ts, my-script/abc.ts,... and know the generated js file my-script/main.bundle.user.js to point to. I think it's understandable by looking at your testdata folder. Now, how to get there? The exact steps (do I need to clone this repository? do I need to install anything in advance? deno?). Thanks.
@jsejcksn
Copy link
Owner

Hi @loia5tqd001: Thanks for opening an issue.

First, let me give you a bit of context:
The code in this repository was written to be consumed by another private project that I use. The documentation in the README was really just written as a reminder to myself about how to use it (in case enough time passes that I forgot some details). As you can see from the to-dos, there aren't even any tests and I didn't consider the readme to be real documentation. When I finished it, I realized that there was no private/sensitive data in the repo, so I just made it public in case someone (like you) happened to find some value in it.

Now that you are aware of that, I'll answer your questions:

Yes, this project requires deno to be installed and in your $PATH. Based on the screenshot in your message, it looks like you've already done this, but if you want to be sure, just type this in your console to check:

deno --version

If deno is installed and in your path, then you should see some version information like this:

deno 1.17.0 (release, x86_64-apple-darwin)
v8 9.7.106.15
typescript 4.5.2

Once Deno is installed, you can use its script installer tool to install this userscript bundler:

Note that, just like deno needs to be in your path to use it by name in your console, your script installation directory also needs to be in your path to use any installed scripts by name. This is explained at the script installer page in the Deno manual (linked above).

If you don't intend to modify the bundler itself (or the templates that it uses when generating a new userscript "project" directory), then you don't need to clone this repo. You can simply install it from GitHub like this:

deno install --unstable --allow-net --allow-read --allow-run --allow-write --name uscript-deno https://raw.githubusercontent.com/jsejcksn/deno-userscript-bundler/v0.2.3/main.ts

That command will install v0.2.3, which is the latest release at this time.

If you want to modify either of those things, then you'll need to clone the repo first, make your changes, then install it from your local repo like this:

deno install --unstable --allow-net --allow-read --allow-run --allow-write --name uscript-deno /path/to/your/local/repo/main.ts

After installing the bundler script, you can just use it according to the info in the "use" section of the README:

uscript-deno [subcommand] [...args]

Other info:

It was designed for the specific userscript workflow I was using when I wrote it: VS Code and the Deno extension for VS Code. This is why the new and dev subcommands open your script file in VS Code.

There are many things involved here: TypeScript, ES modules, module concatenation, userscript-specific globals, userscript metablock schema, and quite a bit more. Some of these things are rather niche topics, and this assumes you understand some details about the related ecosystems.


I don't really have any intention of updating the project or documentation at the current time (but haven't excluded that as a future possibility). However, I hope this helps you get started bundling some scripts, and — while I can't provide provide support for using it — if you have a specific question about the bundler itself that you can't figure out from the source, then feel free to ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants