mootari opened a new issue, #664:
URL: https://github.com/apache/arrow-site/issues/664

   Following up from https://github.com/apache/arrow-js/issues/180
   
   ### Rationale
   
   Starting from version 17.0.0 the generated TypeDoc API docs no longer link 
any "Defined in ..." references to their GitHub source. Additionally, arrow-js 
has since been moved out of the monorepo but didn't migrate any version tags, 
making it more challenging for developers to find the sources for older 
versions.
   
   [npm stats 
show](https://www.npmjs.com/package/apache-arrow?activeTab=versions) that 
versions before 20.0.0 still see widespread use (e.g., duckdb-wasm 1.29.0 
references apache-arrow 17.0.0).
   
   ### Suggested solution
   
   The affected lines in the markup all follow a consistent pattern. We can 
therefore simply inject the links into the [already generated 
markup](https://github.com/apache/arrow-site/tree/asf-site/docs) instead of 
having to fix the TypeDoc configuration and rebuilding the docs.
   
   Example:
   ```diff
   - <li>Defined in builder.ts:102</li>
   + <li>Defined in builder.ts:102<a 
href="https://github.com/apache/arrow/tree/apache-arrow-17.0.0/js/src/builder.ts#L102";>builder.ts:102</a></li>
   ```
   
   Shell script to apply the changes:
   ```sh
   add-source-links()
   {
     local docs_path="$1"
     local base_url="$2"
     find "$docs_path" \
       -name '*.html' \
       -exec sed -Ei '' 's'';<li>Defined in (([^<]+):([0-9]+))</li>;<li>Defined 
in <a href="'"$base_url"'\2#L\3">\1</a></li>;g' {} +  
   }
   
   add-source-links docs/17.0/js 
'https://github.com/apache/arrow/tree/apache-arrow-17.0.0/js/src/'
   add-source-links docs/18.0/js 
'https://github.com/apache/arrow/tree/apache-arrow-18.0.0/js/src/'
   add-source-links docs/18.1/js 
'https://github.com/apache/arrow/tree/apache-arrow-18.1.0/js/src/'
   add-source-links docs/19.0/js 
'https://github.com/apache/arrow/tree/apache-arrow-19.0.0/js/src/'
   add-source-links docs/js 
'https://github.com/apache/arrow/tree/apache-arrow-20.0.0/js/src/'
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to