lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.79k stars 77 forks source link

Use `deno run` instead of `deno eval` in deno.json #293

Closed DrSensor closed 1 year ago

DrSensor commented 1 year ago

I just notice deno run support evaluating from stdin. So I think it's better to use it because you can write the lock file and reload the dependencies. For example:

echo "import 'lume/task.ts'" | deno run --reload --lock=lock.json --lock-write -

Note there is a - in the end of line

This is better since deno eval doesn't support --lock/--lock-write and --reload flag. Some people (including me) might want to keep the lock file to comply with reproducible build philosophy without vendoring the whole dependencies.

Here is my deno.json

{
  "importMap": "build.importmap",
  "tasks": {
    "lume": "echo \"import 'lume/task.ts'\" | deno run --unstable --allow-read --allow-run --lock=lock.json -",
    "update": "deno cache --unstable --lock=lock.json --lock-write --reload _config.ts && echo \"import 'lume/task.ts'\" | deno run --unstable --allow-read --allow-run --lock=lock.json --lock-write --reload - --version"
  }
}
oscarotero commented 1 year ago

Oh, that's fantastic! I didn't know this was possible. It also allows to configure the permissions (deno eval has all permissions implicitly). I'll change it in the next version. Thanks!