11import fs from 'node:fs/promises' ;
22import path from 'node:path' ;
33
4- const ROUTES = [
5- 'https://docs.apify.com/api/client/js' ,
6- 'https://docs.apify.com/api/client/python' ,
7- 'https://docs.apify.com/sdk/js' ,
8- 'https://docs.apify.com/sdk/python' ,
9- 'https://docs.apify.com/cli' ,
10- ] ;
11-
12- const FILES = [ 'llms.txt' , 'llms-full.txt' ] ;
134const BUILD_DIR = path . resolve ( 'build' ) ;
145
6+ const FILES_ROUTES = {
7+ 'llms.txt' : [
8+ 'https://docs.apify.com/api/client/js/llms.txt' ,
9+ 'https://docs.apify.com/api/client/python/llms.txt' ,
10+ 'https://docs.apify.com/sdk/js/llms.txt' ,
11+ 'https://docs.apify.com/sdk/python/llms.txt' ,
12+ 'https://docs.apify.com/cli/llms.txt' ,
13+ ] ,
14+ 'llms-full.txt' : [
15+ 'https://docs.apify.com/api/client/js/llms-full.txt' ,
16+ 'https://docs.apify.com/api/client/python/llms-full.txt' ,
17+ 'https://docs.apify.com/sdk/js/llms-full.txt' ,
18+ 'https://docs.apify.com/sdk/python/llms-full.txt' ,
19+ 'https://docs.apify.com/cli/llms-full.txt' ,
20+ 'https://raw.githubusercontent.com/apify/actor-whitepaper/refs/heads/master/README.md' ,
21+ 'https://raw.githubusercontent.com/apify/actor-whitepaper/refs/heads/master/pages/ACTOR_FILE.md' ,
22+ 'https://raw.githubusercontent.com/apify/actor-whitepaper/refs/heads/master/pages/DATASET_SCHEMA.md' ,
23+ 'https://raw.githubusercontent.com/apify/actor-whitepaper/refs/heads/master/pages/IDEAS.md' ,
24+ 'https://raw.githubusercontent.com/apify/actor-whitepaper/refs/heads/master/pages/INPUT_SCHEMA.md' ,
25+ 'https://raw.githubusercontent.com/apify/actor-whitepaper/refs/heads/master/pages/KEY_VALUE_STORE_SCHEMA.md' ,
26+ 'https://raw.githubusercontent.com/apify/actor-whitepaper/refs/heads/master/pages/OUTPUT_SCHEMA.md' ,
27+ 'https://raw.githubusercontent.com/apify/actor-whitepaper/refs/heads/master/pages/REQUEST_QUEUE_SCHEMA.md' ,
28+ ] ,
29+ } ;
30+
1531async function fetchFile ( route , file ) {
1632 const url = `${ route } /${ file } ` ;
1733 try {
@@ -26,13 +42,13 @@ async function fetchFile(route, file) {
2642
2743async function joinFiles ( ) {
2844 await fs . mkdir ( BUILD_DIR , { recursive : true } ) ;
29- for ( const file of FILES ) {
45+ for ( const [ llmsFile , files ] of Object . entries ( FILES_ROUTES ) ) {
3046 const contents = await Promise . all (
31- ROUTES . map ( ( route ) => fetchFile ( route , file ) ) ,
47+ files . map ( ( route ) => fetchFile ( route , llmsFile ) ) ,
3248 ) ;
3349 const joined = contents . filter ( Boolean ) . join ( '\n\n' ) ;
34- await fs . appendFile ( path . join ( BUILD_DIR , file ) , joined , 'utf8' ) ;
35- console . log ( `Wrote ${ file } to build/` ) ;
50+ await fs . appendFile ( path . join ( BUILD_DIR , llmsFile ) , joined , 'utf8' ) ;
51+ console . log ( `Wrote ${ llmsFile } to build/` ) ;
3652 }
3753}
3854
0 commit comments