observablehq / framework

A static site generator for data apps, dashboards, reports, and more. Observable Framework combines JavaScript on the front-end for interactive graphics with any language on the back-end for data analysis.
https://observablehq.com/framework/
ISC License
2.57k stars 122 forks source link

annotate local paths #1731

Closed Fil closed 3 weeks ago

Fil commented 1 month ago

paths to local files in transpiled JavaScript modules are postfixed with a comment

For example, when building the documentation, we now have in docs/.observablehq/dist/_import/chart.95e875cf.js

path: "../_file/lib/gistemp.08e51068.csv"/* observablehq-file */,

in lieu of

path: "../_file/lib/gistemp.08e51068.csv",

The annotate.js scripts lists a few cases that can be annotated.

mythmon commented 1 month ago

Sorry for the delay. I plan to review this tomorrow.

mythmon commented 4 weeks ago

@Fil is there anything more you want to do on this PR before merging it? It would be nice to have this in Framework's main branch for further development.

Fil commented 4 weeks ago

Not on my side; I just wanted to give Mike a chance to review.

Fil commented 3 weeks ago

Annotations are now conditioned on the ANNOTATE_FILES=true environment variable. (Any other value throws an error.)

mootari commented 3 weeks ago

We should probably make that OBSERVABLE_ANNOTATE_FILES?

Fil commented 3 weeks ago

Sure, or OBSERVABLE_ANNOTATE for short. I don't have an opinion on this :)

mythmon commented 3 weeks ago

I'd prefer if all environment variables that need to be set in Cloud Builds begin with OBSERVABLE_. I don't have a preference for OBSERVABLE_ANNOTATE vs OBSERVABLE_ANNOTATE_FILES.