denox icon indicating copy to clipboard operation
denox copied to clipboard

Terser syntax through well-documented defaults and inference

Open jsejcksn opened this issue 4 years ago • 4 comments

Issue Type

  • Feature Request

It appears that one of the primary goals of this project is to reduce typing. I think every programmer loves that.

It might be possible to allow for even terser syntax by establishing and documenting some sensible defaults and inference behavior. Here are some suggested considerations:

Default script:

For example, one could use the command denox run, which would be expanded to denox run default. (I gave default as the example here, but maybe you like main, etc.)

Example:

deno-workspace.yaml

scripts:
  default:
    file: main.ts
    deno_options:
      allow-net: example.com

shell

> denox run
# equal to:
# deno run --allow-net=example.com main.ts

Inferring file from script:

Likewise, in deno-workspace.scripts: If a script does not provide a value for file, it could be inferred from its script key—this would allow it to be an optional property if people would like to organize scripts directly by file name. This practice provides the advantage of native terminal tab-completion and also promotes an organizational structure which aligns with the workspace filesystem.

Example:

This:

scripts:
  main.ts:
    file: main.ts
    deno_options:
      allow-net: example.com

could be equal to:

scripts:
  main.ts:
    deno_options:
      allow-net: example.com

jsejcksn avatar Jun 29 '20 00:06 jsejcksn

With the future possibility to specify cmd instead of file #15 , I'm afraid adding a terser syntax would result in more confusion.

BentoumiTech avatar Aug 11 '20 12:08 BentoumiTech

@BentoumiTech I can see how that would complicate things. However, #19 addresses this.

jsejcksn avatar Aug 13 '20 01:08 jsejcksn

denox run is faster to type than denox start (or current denox run start), I like this change!

vintprox avatar Oct 20 '20 07:10 vintprox

What the workspace file look like if there was added support for deno test and not only deno run? https://github.com/BentoumiTech/denox/issues/7#issuecomment-950213279

ghost avatar Oct 23 '21 20:10 ghost