BentoumiTech / denox

Script runner and workspace configuration for Deno
MIT License
139 stars 13 forks source link

Terser syntax through well-documented defaults and inference #16

Open jsejcksn opened 4 years ago

jsejcksn commented 4 years ago

Issue Type

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
BentoumiTech commented 4 years ago

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

jsejcksn commented 4 years ago

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

vintprox commented 3 years ago

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

ghost commented 2 years ago

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