-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
deps: Bump next and related dependencies #10497
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import fs from 'fs'; | ||
| import path from 'path'; | ||
| import {fileURLToPath} from 'url'; | ||
|
|
||
| import matter from 'gray-matter'; | ||
| import {s} from 'hastscript'; | ||
|
|
@@ -28,7 +29,8 @@ import remarkTocHeadings, {TocNode} from './remark-toc-headings'; | |
| import remarkVariables from './remark-variables'; | ||
| import {FrontMatter, Platform, PlatformConfig} from './types'; | ||
|
|
||
| const root = process.cwd(); | ||
| // @ts-ignore | ||
| const directoryName = path.dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| function formatSlug(slug: string) { | ||
| return slug.replace(/\.(mdx|md)/, ''); | ||
|
|
@@ -96,8 +98,8 @@ async function getDocsFrontMatterUncached(): Promise<FrontMatter[]> { | |
| return frontMatter; | ||
| } | ||
|
|
||
| export function getAllFilesFrontMatter(folder: string = 'docs') { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now it doesn't need to be. We can add it back if needed. We shouldn't add code for the mere possibility of needing it.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just mentioned it since this is deleting something that was already there, but I see what you mean |
||
| const docsPath = path.join(root, folder); | ||
| function getAllFilesFrontMatter() { | ||
| const docsPath = path.join(directoryName, '..', 'docs'); | ||
| const files = getAllFilesRecursively(docsPath); | ||
| const allFrontMatter: FrontMatter[] = []; | ||
| files.forEach(file => { | ||
|
|
@@ -115,15 +117,10 @@ export function getAllFilesFrontMatter(folder: string = 'docs') { | |
| allFrontMatter.push({ | ||
| ...(frontmatter as FrontMatter), | ||
| slug: formatSlug(fileName), | ||
| sourcePath: path.join(folder, fileName), | ||
| sourcePath: path.join('docs', fileName), | ||
| }); | ||
| }); | ||
|
|
||
| if (folder !== 'docs') { | ||
| // We exit early if we're not in the docs folder. We use this for the changelog. | ||
| return allFrontMatter; | ||
| } | ||
|
|
||
| // Add all `common` files in the right place. | ||
| const platformsPath = path.join(docsPath, 'platforms'); | ||
| const platformNames = fs | ||
|
|
@@ -218,17 +215,17 @@ export function getAllFilesFrontMatter(folder: string = 'docs') { | |
| } | ||
|
|
||
| export async function getFileBySlug(slug: string) { | ||
| const configPath = path.join(root, slug, 'config.yml'); | ||
| const configPath = path.join(directoryName, '..', slug, 'config.yml'); | ||
|
|
||
| let configFrontmatter: PlatformConfig | undefined; | ||
| if (fs.existsSync(configPath)) { | ||
| configFrontmatter = yaml.load(fs.readFileSync(configPath, 'utf8')) as PlatformConfig; | ||
| } | ||
|
|
||
| let mdxPath = path.join(root, `${slug}.mdx`); | ||
| let mdxIndexPath = path.join(root, slug, 'index.mdx'); | ||
| let mdPath = path.join(root, `${slug}.md`); | ||
| let mdIndexPath = path.join(root, slug, 'index.md'); | ||
| let mdxPath = path.join(directoryName, '..', `${slug}.mdx`); | ||
| let mdxIndexPath = path.join(directoryName, '..', slug, 'index.mdx'); | ||
| let mdPath = path.join(directoryName, '..', `${slug}.md`); | ||
| let mdIndexPath = path.join(directoryName, '..', slug, 'index.md'); | ||
|
|
||
| if ( | ||
| slug.indexOf('docs/platforms/') === 0 && | ||
|
|
@@ -249,18 +246,20 @@ export async function getFileBySlug(slug: string) { | |
| commonFilePath = path.join(commonPath, slugParts.slice(3).join('/')); | ||
| } | ||
| if (commonFilePath && fs.existsSync(commonPath)) { | ||
| mdxPath = path.join(root, `${commonFilePath}.mdx`); | ||
| mdxIndexPath = path.join(root, commonFilePath, 'index.mdx'); | ||
| mdPath = path.join(root, `${commonFilePath}.md`); | ||
| mdIndexPath = path.join(root, commonFilePath, 'index.md'); | ||
| mdxPath = path.join(directoryName, '..', `${commonFilePath}.mdx`); | ||
| mdxIndexPath = path.join(directoryName, '..', commonFilePath, 'index.mdx'); | ||
| mdPath = path.join(directoryName, '..', `${commonFilePath}.md`); | ||
| mdIndexPath = path.join(directoryName, '..', commonFilePath, 'index.md'); | ||
| } | ||
| } | ||
|
|
||
| const sourcePath = [mdxPath, mdxIndexPath, mdPath].find(fs.existsSync) ?? mdIndexPath; | ||
| const sourcePath = | ||
| [mdxPath, mdxIndexPath, mdPath].find(p => fs.existsSync(p)) ?? mdIndexPath; | ||
| const source = fs.readFileSync(sourcePath, 'utf8'); | ||
|
|
||
| process.env.ESBUILD_BINARY_PATH = path.join( | ||
| root, | ||
| directoryName, | ||
| '..', | ||
| 'node_modules', | ||
| 'esbuild', | ||
| 'bin', | ||
|
|
@@ -285,7 +284,10 @@ export async function getFileBySlug(slug: string) { | |
| [remarkTocHeadings, {exportRef: toc}], | ||
| remarkGfm, | ||
| remarkFormatCodeBlocks, | ||
| [remarkImageSize, {sourceFolder: cwd, publicFolder: path.join(root, 'public')}], | ||
| [ | ||
| remarkImageSize, | ||
| {sourceFolder: cwd, publicFolder: path.join(directoryName, '..', 'public')}, | ||
| ], | ||
| remarkMdxImages, | ||
| remarkCodeTitles, | ||
| remarkCodeTabs, | ||
|
|
@@ -353,7 +355,7 @@ export async function getFileBySlug(slug: string) { | |
| }; | ||
| // Set the `outdir` to a public location for this bundle. | ||
| // this where this images will be copied | ||
| options.outdir = path.join(root, 'public', 'mdx-images'); | ||
| options.outdir = path.join(directoryName, '..', 'public', 'mdx-images'); | ||
|
|
||
| // Set write to true so that esbuild will output the files. | ||
| options.write = true; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| { | ||
| "$schema": "https://openapi.vercel.sh/vercel.json", | ||
| "headers": [ | ||
| { | ||
| "source": "/(.*)", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep that?