amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.93k stars 558 forks source link

Docs: Fix dead links and invalid hashes #1356

Closed julien-deramond closed 1 month ago

julien-deramond commented 1 month ago

Description

I've spotted a dead link while browsing the documentation, and since I knew that you're using Starlight, I tried to install and execute starlight-links-validator.

The primary goal of this PR is to fix the dead links and invalid hashes, but it also includes a possible enhancement for the project by using starlight-links-validator.

Installing starlight-links-validator

The first commit of this PR (https://github.com/amzn/style-dictionary/commit/8726ef1d6bb27147992dd360746f2caebf007931) shows how to install starlight-links-validator.

  1. If you don't want to install it for whatever reason, I can remove this commit. Just wanted to show you how it works.
  2. ⚠️ If you'd like to keep starlight-links-validator, there will be a fix to do in this PR as I had to comment a line in docs/src/remark-playground.ts. I haven't especially tried to fix this properly, I preferred to know before whether you would like to include starlight-links-validator in your build :)

Fix dead links and invalid hashes in the doc

Here's the output of running npm run docs:build with starlight-links-validator enabled in the project:

13:46:07 [ERROR] ✗ Found 36 invalid links in 8 files.
13:46:07 ▶ info/package_structure/
13:46:07   └─ /references/info/tokens - invalid link
13:46:07 ▶ info/tokens/
13:46:07   └─ /reference/hooks/transforms#attributecti - invalid hash
13:46:07 ▶ reference/hooks/formats/
13:46:07   ├─ predefined - relative link
13:46:07   ├─ predefined - relative link
13:46:07   ├─ /reference/hooks/filter - invalid link
13:46:07   ├─ /reference/hooks/filter - invalid link
13:46:07   ├─ predefined/#cssvariables - relative link
13:46:07   ├─ predefined/#scssvariables - relative link
13:46:07   ├─ predefined/#lessvariables - relative link
13:46:07   ├─ predefined/#androidresources - relative link
13:46:07   ├─ predefined/#composeobject - relative link
13:46:07   ├─ predefined/#ios-swiftclassswift - relative link
13:46:07   ├─ predefined/#flutterclassdart - relative link
13:46:07   └─ /reference/hooks/formats#fileheader - invalid hash
13:46:07 ▶ reference/hooks/transform-groups/predefined/
13:46:07   ├─ /reference/hooks/transforms/predefined#sizeflutterremToDouble - invalid hash
13:46:07   └─ /reference/hooks/transforms/predefined#sizeflutterremToDouble - invalid hash
13:46:07 ▶ reference/hooks/formats/predefined/
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   ├─ #references-in-output-files - invalid hash
13:46:07   └─ #references-in-output-files - invalid hash
13:46:07 ▶ reference/hooks/transforms/predefined/
13:46:07   └─ /info/tokens#category-type-item - invalid hash
13:46:07 ▶ reference/api/
13:46:07   ├─ /references/hooks/file-headers - invalid link
13:46:07   ├─ /references/hooks/formats#creating-formats - invalid link
13:46:07   └─ /reference/hooks/transform_groups - invalid link
13:46:07 ▶ reference/config/
13:46:07   ├─ /reference/tokens - invalid link
13:46:07   ├─ /reference/using_the_cli - invalid link
13:46:07   ├─ /reference/using_the_cli - invalid link
13:46:07   ├─ /reference/using_the_npm_module - invalid link
13:46:07   ├─ /reference/hooks/format#references-in-output-files - invalid link
13:46:07   └─ /reference/hooks/formats#customfileheader - invalid hash

Based on these results, I tried to find the correct target URLs in https://github.com/amzn/style-dictionary/pull/1356/commits/b672395cea37389cc6254daa968537fb8ecc008f. Hope I haven't made too many mistakes 😬

Fix invalid hashes in the library

Finally, one of these invalid hashes was also in the comments of the library, so has been fixed along the way via https://github.com/amzn/style-dictionary/pull/1356/commits/94e3a389f007ddc67423b818b4951121f5d93518.

Final words

In the end, this PR gathers different elements. Based on your feedback, I can remove/modify the commits, or split the PR. Please note that I haven't added any changesets, waiting for a first feedback on how to proceed :)


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

aws-amplify-us-west-1[bot] commented 1 month ago

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1356.d16eby4ekpss5y.amplifyapp.com