qmd-lab / scheduled-docs

A Quarto Extension to schedule the publication of documents in websites and blogs.
MIT License
5 stars 1 forks source link

suggestion: extract parameters from .ts files into a yml file #2

Closed paciorek closed 2 months ago

paciorek commented 5 months ago

Both clean-scheduled-docs.ts and run-scheduled-docs.ts define parameters that a user could tweak to modify where the extension looks for things, but it's a slight hassle to have to change the same thing in two places. Could this be extracted out into a separate, say, config.yml?

andrewpbray commented 2 months ago

Good idea! You're thinking about this line, right?

const ymlPath = '_quarto.yml';

You're exactly right that it's defined in two different places because run- and clean- run at very different times as different processes so clean- doesn't have access to the info in run- writing out a config.yml file seems like a very straightforward approach. Or maybe: just include a config.yml with the extension and both scripts read from it - that's probably easiest since I can just direct users to: go into config.yml and change the only line that's there.

andrewpbray commented 2 months ago

I've put some work on this in:

https://github.com/qmd-lab/scheduled-docs/pull/6

Please test it out when you have a sec.

andrewpbray commented 2 months ago

@paciorek I'm running into an issue running this extension on main. When I follow the README.md and install the extension with quarto use template qmd-lab/scheduled-docs and then run quarto preview, all three of the posts appear on the website (only the first one should).

I can fix the issue by copying metadata-files: [./scheduled-docs_files/draft-list.yml] from _extension.yml into _quarto.yml, which suggests the metadata merge from the extension is not working. I've seen that behavior on 1.5.55 and 1.5.56.

Would you mind testing it on whatever version of Quarto you're running?

andrewpbray commented 2 months ago

This is puzzling.

A course-website repo that I've embedded the extension in seems to be working just fine:

https://github.com/qmd-lab/course-website

While a minimal repo demonstrating what appears to be the issue - the merging of metadata-files - is not working.

https://github.com/andrewpbray/reprex-metadata-merge

This is what I get for leaving this project on the back burner for the spring semester and summer...

andrewpbray commented 2 months ago

Ok, so course-website actually isn't setting docs to draft mode either. The extension code works as intended - draft-list.yml is correctly generated, but it's not getting read into metadata. It only looked like it had because the schedule on the homepage was reading from draft-list.yml.

Seeking help: https://github.com/quarto-dev/quarto-cli/discussions/10568

andrewpbray commented 2 months ago

@paciorek I've merged the config.yml approach, set the default to read from an external _schedule.yml (I think that's a wiser idea), and have an issue on the Quarto CLI to address the lack of merging of metadata-files. In the meantime I'm going to just add that manually to the Stat 20 _quarto.yml so that I'm ready for the fall semester.