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

Feature request: Allow passing a config setting in the scripts file #103

Closed
saadq opened this issue Dec 2, 2021 · 3 comments · Fixed by #104
Closed

Feature request: Allow passing a config setting in the scripts file #103

saadq opened this issue Dec 2, 2021 · 3 comments · Fixed by #104

Comments

@saadq
Copy link

saadq commented Dec 2, 2021

Deno now supports passing a --config flag to its CLI for customizing the builtin compiler/linter/formatter with a configuration file: https://deno.land/[email protected]/getting_started/configuration_file. I tried looking through the DenoCliOptions, but it doesn't seem like this is currently supported.

To use this, currently I have a config file:

deno.json

{
  "fmt": {
    "options": {
      "singleQuote": true
    }
  }
}

velociraptor.yaml

scripts:
  lint:
    cmd: deno lint --config=deno.json
    desc: Lints the code using Deno's standard linter

  format:
    cmd: deno fmt --config=deno.json
    desc: Formats the code using Deno's standard formatter

It would be nice if we could specify our config file the same way we could specify files for lock/imap/envFile. Perhaps something like:

velociraptor.yaml

configFile: deno.json

scripts:
  lint:
    cmd: deno lint
    desc: Lints the code using Deno's standard linter

  format:
    cmd: deno fmt
    desc: Formats the code using Deno's standard formatter
@lowlighter
Copy link
Contributor

I'd actually like to have a similiar feature but in reverse.

Since deno already lookup automatically for deno.json as a config file, it would also be nice to allow specifying velociraptor config within the same deno.json to only have a single config file for both scripts and deno (a bit like package.json actually)

@umbopepato
Copy link
Member

umbopepato commented Dec 15, 2021

Hey @saadq and @lowlighter, thanks for your proposals 🙂
Vr's support for Deno CLI options needs to be aligned with the new versions. There is some work in progress (see #95) which includes supporting the --config option.

As for the unified config file: that's a nice idea. Here are a couple of thoughts:

  • many vr options can be specified at top-level (outside of the scripts object). This has potentially the risk of colliding with future Deno config options but could be mitigated by moving all vr options under a vr/velociraptor property:
    {
      "compilerOptions": { ... },
      "velociraptor": {
        "allow": [...]
        "scripts": {...}
     }
    } 
  • the number of vr's config file names and formats is growing rapidly: this will inevitably have negative effects on Create remote configuration resolver #90 because of the number of network requests to get to the right file. I don't think that adding two more (deno.{json,jsonc}) will have a huge impact. We have to consider the possibility of Deno adding more formats though. We can always exclude these last config files from the remote resolving but it feels unfair to users that would like to use that format.

PS Apologies for the late response

@saadq
Copy link
Author

saadq commented Dec 15, 2021

Thanks for the reply, I missed that other issue. Closing in favor of #95

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

Successfully merging a pull request may close this issue.

3 participants