Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Javascript Support

See original GitHub issue

Instead of JSON and YAML, I’d prefer to use a JavaScript module. For example, instead of this JSON:

  "scripts": {
    "start": "deno run --allow-net server.ts",
    "test": "deno test --allow-net server_test.ts"

or this YAML:

# scripts.yaml
  start: deno run --allow-net server.ts
  test: deno test --allow-net server_test.ts

I prefer this:

let options = {};
options.scripts = {};
options.scripts.start = "deno run --allow-net server.ts";
options.scripts.test = "deno test --allow-net server_test.ts";
export options;

Granted, my preference is more verbose. However, nothing is more flexible. You could do anything you wanted (programmatically) within this file and Velociraptor should only care about the object that gets exported at the end.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

umbopepatocommented, Jun 15, 2020

This will allow me to accomplish the configuration in a .js file correct?

@Lonniebiz no, we’re supporting only .ts for the reasons discussed above but you can still write JS in TS files since they’re sub/supersets of one another. Also, when this is implemented you will get code assistante for the configuration object without needing to manually add types.

littledivycommented, Jun 6, 2020

these config files are effectively Deno scripts and therefore could need some permissions that vr may not have. This essentially would require all permissions to be granted to vr at install time. Probably not a big deal (also the install command would be much shorter), but I was trying to avoid it if possible…

That is true and inevitable. To avoid perm errors the install command must give all perms (which seems fair).

.js configuration files are commonly used, but since Deno’s main language is TS wouldn’t it be more appropriate to use .ts files? (or at most both of them?)

Yup. I’ve just added that to the PR.

Every time .ts config files are compiled you would get a bunch of Deno logs which interfere with the output of launched scripts (don’t know if it’s possible to add the -q flag to an installed script though).

Maybe it is better to let the user know that the config scripts are compiled at runtime so they should expect compile logs from Deno. Though it won’t actually interrupt other logs as it is the compiled before any of the configs is processed.

Overall, I think this would be a good feature to introduce as it provides a more dynamic way to make config files.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set.prototype.add() - JavaScript - MDN Web Docs - Mozilla
The add() method inserts a new element with a specified value in to a Set object, if there isn't an element with the...
Read more >
How to enable JavaScript in Windows - Microsoft Support
This article describes step for users to allow all Web sites in the Internet zone to run JavaScript in Internet Explorer, Chrome, and...
Read more >
Add JavaScript - Qualtrics
Click the question you'd like to add JavaScript to. selecting a question and then clicking Javascript; In the Question behavior section, select JavaScript....
Read more >
JavaScript Programming with Visual Studio Code
To define a basic JavaScript project, add a jsconfig.json at the root of your workspace: ... VS Code comes with great debugging support...
Read more >
JavaScript | IntelliJ IDEA Documentation - JetBrains
On the JavaScript page, click the Browse button · Click Add · From the Language list, choose the language version for the files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found