axodotdev / cargo-dist

📦 shippable application packaging
https://axodotdev.github.io/cargo-dist/
Apache License 2.0
1.53k stars 73 forks source link

Remove `run.js.j2` render hack #1524

Open fasterthanlime opened 2 weeks ago

fasterthanlime commented 2 weeks ago

Currently, the npm backends renders the whole templates/installers/npm folder with the same context (that does NOT have a run field), which breaks "strict undefined behavior". As a result, the following bit was added in #1499:

{%- if bin is defined %}
run({{ bin }});
{%- endif %}

We should do the right thing instead, like... moving run.js.j2 outside of that directory, simply. So that we can render the npm skeleton dir/template, and then all the run.js files we need (per-binary) separately. That's out of scope for #1499 though, so I'm opening this to track a small follow-up.