Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: Update netlify build to get relative links to specs in PRs #2325

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
4 changes: 3 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

[context.deploy-preview]
NODE_ENV = "Deploy"
command = "./pr-preview.sh"

[context.branch-deploy.environment]
NODE_ENV = "development"
NODE_ENV = "development"
command = "./pr-preview.sh"
46 changes: 46 additions & 0 deletions pr-preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# change specStatus value to include relative paths
echo "Updating specStatus to unofficial"
find . -name "index.html" -exec sed -i 's/specStatus:[[:space:]]*"ED"/specStatus: "unofficial"/g' {} +

# update spec URLs mappings for ARIA
echo "updating ARIA mappings"
find . -wholename "./index.html" -exec sed -i 's/ariaSpecURLs: {/ariaSpecURLs: {\n "unofficial": "\/",/g' {} +
find . -wholename "./index.html" -exec sed -i 's/accNameURLs: {/accNameURLs: {\n "unofficial": ".\/accname\/",/g' {} +
find . -wholename "./index.html" -exec sed -i 's/coreMappingURLs: {/coreMappingURLs: {\n "unofficial": ".\/core-aam\/",/g' {} +

# update child specs URLs mapping
echo "updating child spec URL mappings"
# aria
find . -mindepth 1 -name "index.html" -exec sed -i 's/ariaSpecURLs: {/ariaSpecURLs: {\n "unofficial": "..\/",/g' {} +
# accname
find . -mindepth 1 -name "index.html" -exec sed -i 's/accNameURLs: {/accNameURLs: {\n "unofficial": "..\/accname\/",/g' {} +
# core-aam
find . -mindepth 1 -name "index.html" -exec sed -i 's/coreMappingURLs: {/coreMappingURLs: {\n "unofficial": "..\/core-aam\/",/g' {} +
# dpub
find . -mindepth 1 -name "index.html" -exec sed -i 's/dpubModURLs: {/dpubModURLs: {\n "unofficial": "..\/dpub-aria\/",/g' {} +
# graphicsMappingModURLs
find . -mindepth 1 -name "index.html" -exec sed -i 's/graphicsMappingModURLs: {/graphicsMappingModURLs: {\n "unofficial": "..\/graphics-aam\/",/g' {} +
# graphicsModURLs
find . -mindepth 1 -name "index.html" -exec sed -i 's/graphicsModURLs: {/graphicsModURLs: {\n "unofficial": "..\/graphics-aria\/",/g' {} +
# htmlMappingURLs
find . -mindepth 1 -name "index.html" -exec sed -i 's/htmlMappingURLs: {/htmlMappingURLs: {\n "unofficial": "..\/html-aam\/",/g' {} +
# build all specs
echo "building specs"

commands=(
"npx respec -s index.html -o index.html --localhost"
"npx respec -s accname/index.html -o accname/index.html --localhost"
"npx respec -s core-aam/index.html -o core-aam/index.html --localhost"
"npx respec -s dpub-aam/index.html -o dpub-aam/index.html --localhost"
"npx respec -s dpub-aria/index.html -o dpub-aria/index.html --localhost"
"npx respec -s graphics-aam/index.html -o graphics-aam/index.html --localhost"
"npx respec -s graphics-aria/index.html -o graphics-aria/index.html --localhost"
"npx respec -s svg-aam/index.html -o svg-aam/index.html --localhost"
"npx respec -s mathml-aam/index.html -o mathml-aam/index.html --localhost"
)
for cmd in "${commands[@]}"; do
echo "Executing: $cmd"
if ! $cmd; then
echo "Error: Command failed - $cmd"
fi
done
Loading