-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,069 additions
and
1,035 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const ENV = { | ||
IS_LOCAL_DEV: process.env.VERCEL_ENV === 'development' || process.env.NEXT_PUBLIC_LOCAL_DEV === 'true', | ||
IS_PREVIEW: process.env.VERCEL_ENV === 'preview', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { readFile } from 'node:fs/promises'; | ||
import { join } from 'node:path'; | ||
import { ENV } from './env'; | ||
|
||
export async function fetchDependencies({ | ||
packageName, | ||
version, | ||
}: { | ||
readonly packageName: string; | ||
readonly version: string; | ||
}) { | ||
if (ENV.IS_LOCAL_DEV) { | ||
const fileContent = await readFile( | ||
join(process.cwd(), `../../packages/${packageName}/docs/${packageName}/split/${version}.dependencies.api.json`), | ||
'utf8', | ||
); | ||
|
||
return JSON.parse(fileContent); | ||
} | ||
|
||
const isMainVersion = version === 'main'; | ||
const fileContent = await fetch( | ||
`${process.env.BLOB_STORAGE_URL}/rewrite/${packageName}/${version}.dependencies.api.json`, | ||
{ next: isMainVersion ? { revalidate: 0 } : { revalidate: 604_800 } }, | ||
); | ||
const parsedDependencies = await fileContent.json(); | ||
return Object.entries<string>(parsedDependencies) | ||
.filter(([key]) => key.startsWith('@discordjs/') && !key.includes('api-extractor')) | ||
.map(([key, value]) => `${key.replace('@discordjs/', '').replaceAll('.', '-')}-${value.replaceAll('.', '-')}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { readFile } from 'node:fs/promises'; | ||
import { join } from 'node:path'; | ||
import { ENV } from './env'; | ||
|
||
export async function fetchNode({ | ||
item, | ||
packageName, | ||
version, | ||
}: { | ||
readonly item: any; | ||
readonly packageName: string; | ||
readonly version: string; | ||
}) { | ||
const normalizeItem = item.split(encodeURIComponent(':')).join('.').toLowerCase(); | ||
|
||
if (ENV.IS_LOCAL_DEV) { | ||
const fileContent = await readFile( | ||
join(process.cwd(), `../../packages/${packageName}/docs/split/${version}.${normalizeItem}.api.json`), | ||
'utf8', | ||
); | ||
return JSON.parse(fileContent); | ||
} | ||
|
||
const isMainVersion = version === 'main'; | ||
const fileContent = await fetch( | ||
`${process.env.BLOB_STORAGE_URL}/rewrite/${packageName}/${version}.${normalizeItem}.api.json`, | ||
{ next: isMainVersion ? { revalidate: 0 } : { revalidate: 604_800 } }, | ||
); | ||
return fileContent.json(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { readFile } from 'node:fs/promises'; | ||
import { join } from 'node:path'; | ||
import { ENV } from './env'; | ||
|
||
export async function fetchSitemap({ | ||
packageName, | ||
version, | ||
}: { | ||
readonly packageName: string; | ||
readonly version: string; | ||
}) { | ||
if (ENV.IS_LOCAL_DEV) { | ||
const fileContent = await readFile( | ||
join(process.cwd(), `../../packages/${packageName}/docs/split/${version}.sitemap.api.json`), | ||
'utf8', | ||
); | ||
return JSON.parse(fileContent); | ||
} | ||
|
||
const isMainVersion = version === 'main'; | ||
const fileContent = await fetch( | ||
`${process.env.BLOB_STORAGE_URL}/rewrite/${packageName}/${version}.sitemap.api.json`, | ||
{ next: isMainVersion ? { revalidate: 0 } : { revalidate: 604_800 } }, | ||
); | ||
return fileContent.json(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.