This repo contains simple Deno scripts to append published_at
value to solidjs.com resources.
- Clone and
cd
into this repo - Copy the following resource data files from
solidjs/solid-site/src/pages/Resources/
toinput/
Articles.data.ts
Podcasts.data.ts
Videos.data.ts
- Run
deno run --allow-net --allow-read --allow-write main.ts
- Updated source files will be created in
output/
- Updated source files will be created in
The current setup assumes that the way publisehd date information for each resource is encoded in the fetched HTML follows certain patterns. See the switch
statement in utils.ts > parseDatePublished()
for these patterns. If this assumption is not met, the published_at
value will be set to undefined
.
The current setup also assumes that each resource data object found in the input source files has the following shape:
- Its last property is for
categories
- It has no
published_at
value
If these assumptions are not met, incorrect published date values will potentially be added to resource data.
.
├── .vscode/ - vscode workspace settings (to enable Deno extension)
├── input/ - folder to put resource data files
├── output/ - folder to write updated resource data files to
├── .prettierrc - copied from solidjs/solid-site
├── README.md
├── main.ts - main script
└── utils.ts