fermyon / developer

This is the home for developer.fermyon.com
https://developer.fermyon.com
Apache License 2.0
53 stars 69 forks source link

Script to check if all pages are in the sidebar menu #646

Open tpmccallum opened 1 year ago

tpmccallum commented 1 year ago

It would be handy to know if any pages in the developer documentation do not appear in the sidebar menu somewhere. One page slipped through and it is possible that this could happen again (a page exists in the sitemap but is not linked to from the main sidebar menu .hbs files). This could be done as part of the Build/Test that happens once per commit.

tpmccallum commented 1 year ago

A quick script in Python like this would do the trick

import os
from pathlib import Path

# Spin dir example
directory = os.path.join(os.getcwd(), "content", "spin")
menu = os.path.join(os.getcwd(), "templates", "spin_sidebar.hbs")
with open(menu, 'r') as file:
    content = file.read()
for filename in os.listdir(directory):
    f = os.path.join(directory, filename)
    if os.path.isfile(f):
        docFileName = Path(f).stem
        if docFileName in content:
            print(docFileName + "\U00002714")
        else:
            print(docFileName + "\U0000274C")

Returns

distributing-apps✔
kubernetes✔
api-guides-overview✔
managing-plugins✔
javascript-components✔
contributing-spin✔
deploying-to-fermyon✔
plugin-authoring✔
url-shortener✔
quickstart✔
go-components✔
running-apps✔
install✔
redis-trigger✔
dynamic-configuration✔
managing-templates✔
other-languages✔
kv-store-tutorial✔
rdbms-storage✔
index✔
template-authoring✔
see-what-people-have-built-with-spin✔
python-components✔
build✔
kv-store-api-guide✔
manifest-reference✔
redis-outbound✔
extending-and-embedding✔
language-support-overview✔
cache✔
rust-components✔
writing-apps✔
http-trigger✔
spin-oci✔
http-outbound✔

Perhaps we want this written in a language that is compatible with the build/test (perhaps that means using JS; not sure if Python can work in that environment).

tpmccallum commented 1 year ago

Just running it again for Cloud, Bartholomew and Common so we at least have a clean slate at this current point in time.

Cloud

changelog✔
user-settings✔
deployment-concepts✔
quickstart✔
develop✔
faq✔
fermyon-cloud✔
data-postgres✔
deploy✔
support✔
index✔
delete✔
data-redis✔
spin-vs-code-extension✔
github-actions✔
upgrade✔
custom-fermyon-subdomain✔
rest-api✔

Bartholomew

contributing-bartholomew✔
markdown✔
templates✔
quickstart✔
seo✔
index✔
configuration✔
themes✔
shortcodes✔
scripting✔

Common

contributing-docs✔
cli-reference✔
tpmccallum commented 1 year ago

Suggested this to @karthik2804 Not sure if Python is allowed in the GH CI/Tests; perhaps needs to be ported to JS

karthik2804 commented 1 year ago

Python is allowed in CI but I would prefer for the tests to be in a singular language.