Skip to content

Commit 088fec6

Browse files
author
Luca Forstner
authored
deps: Bump next and related dependencies (#10497)
1 parent 24e34b8 commit 088fec6

File tree

4 files changed

+126
-149
lines changed

4 files changed

+126
-149
lines changed

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"lint:prettier:fix": "prettier --write \"./{src,app,scripts}/**/*.{md,mdx,ts,tsx,js,jsx,mjs}\"",
2525
"lint:fix": "yarn run lint:prettier:fix && yarn run lint:eslint:fix",
2626
"sidecar": "yarn spotlight-sidecar",
27-
"test": "jest"
27+
"test": "jest",
28+
"build-trace": "npx next@canary internal turbo-trace-server .next/trace"
2829
},
2930
"prisma": {
3031
"seed": "node prisma/seed/seed.mjs"
@@ -36,9 +37,9 @@
3637
"@emotion/react": "^11.11.0",
3738
"@emotion/styled": "^11.0.0",
3839
"@google-cloud/storage": "^7.7.0",
39-
"@mdx-js/loader": "^3.0.0",
40-
"@mdx-js/react": "^3.0.0",
41-
"@next/mdx": "^14.0.1",
40+
"@mdx-js/loader": "^3.0.1",
41+
"@mdx-js/react": "^3.0.1",
42+
"@next/mdx": "^14.2.4",
4243
"@popperjs/core": "^2.11.8",
4344
"@prettier/plugin-xml": "^3.3.1",
4445
"@prisma/client": "^5.8.1",
@@ -51,7 +52,7 @@
5152
"@radix-ui/themes": "^2.0.3",
5253
"@sentry-internal/global-search": "^1.0.0",
5354
"@sentry/nextjs": "^8.8.0",
54-
"@types/mdx": "^2.0.9",
55+
"@types/mdx": "^2.0.13",
5556
"algoliasearch": "^4.23.3",
5657
"esbuild": "^0.19.8",
5758
"framer-motion": "^10.12.16",
@@ -61,9 +62,9 @@
6162
"js-cookie": "^3.0.5",
6263
"js-yaml": "^4.1.0",
6364
"match-sorter": "^6.3.4",
64-
"mdx-bundler": "^10.0.1",
65+
"mdx-bundler": "^10.0.2",
6566
"micromark": "^4.0.0",
66-
"next": "14.0.2",
67+
"next": "14.2.4",
6768
"next-auth": "^4.24.5",
6869
"next-mdx-remote": "^4.4.1",
6970
"nextjs-toploader": "^1.6.6",

src/mdx.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'fs';
22
import path from 'path';
3+
import {fileURLToPath} from 'url';
34

45
import matter from 'gray-matter';
56
import {s} from 'hastscript';
@@ -28,7 +29,8 @@ import remarkTocHeadings, {TocNode} from './remark-toc-headings';
2829
import remarkVariables from './remark-variables';
2930
import {FrontMatter, Platform, PlatformConfig} from './types';
3031

31-
const root = process.cwd();
32+
// @ts-ignore
33+
const directoryName = path.dirname(fileURLToPath(import.meta.url));
3234

3335
function formatSlug(slug: string) {
3436
return slug.replace(/\.(mdx|md)/, '');
@@ -96,8 +98,8 @@ async function getDocsFrontMatterUncached(): Promise<FrontMatter[]> {
9698
return frontMatter;
9799
}
98100

99-
export function getAllFilesFrontMatter(folder: string = 'docs') {
100-
const docsPath = path.join(root, folder);
101+
function getAllFilesFrontMatter() {
102+
const docsPath = path.join(directoryName, '..', 'docs');
101103
const files = getAllFilesRecursively(docsPath);
102104
const allFrontMatter: FrontMatter[] = [];
103105
files.forEach(file => {
@@ -115,15 +117,10 @@ export function getAllFilesFrontMatter(folder: string = 'docs') {
115117
allFrontMatter.push({
116118
...(frontmatter as FrontMatter),
117119
slug: formatSlug(fileName),
118-
sourcePath: path.join(folder, fileName),
120+
sourcePath: path.join('docs', fileName),
119121
});
120122
});
121123

122-
if (folder !== 'docs') {
123-
// We exit early if we're not in the docs folder. We use this for the changelog.
124-
return allFrontMatter;
125-
}
126-
127124
// Add all `common` files in the right place.
128125
const platformsPath = path.join(docsPath, 'platforms');
129126
const platformNames = fs
@@ -218,17 +215,17 @@ export function getAllFilesFrontMatter(folder: string = 'docs') {
218215
}
219216

220217
export async function getFileBySlug(slug: string) {
221-
const configPath = path.join(root, slug, 'config.yml');
218+
const configPath = path.join(directoryName, '..', slug, 'config.yml');
222219

223220
let configFrontmatter: PlatformConfig | undefined;
224221
if (fs.existsSync(configPath)) {
225222
configFrontmatter = yaml.load(fs.readFileSync(configPath, 'utf8')) as PlatformConfig;
226223
}
227224

228-
let mdxPath = path.join(root, `${slug}.mdx`);
229-
let mdxIndexPath = path.join(root, slug, 'index.mdx');
230-
let mdPath = path.join(root, `${slug}.md`);
231-
let mdIndexPath = path.join(root, slug, 'index.md');
225+
let mdxPath = path.join(directoryName, '..', `${slug}.mdx`);
226+
let mdxIndexPath = path.join(directoryName, '..', slug, 'index.mdx');
227+
let mdPath = path.join(directoryName, '..', `${slug}.md`);
228+
let mdIndexPath = path.join(directoryName, '..', slug, 'index.md');
232229

233230
if (
234231
slug.indexOf('docs/platforms/') === 0 &&
@@ -249,18 +246,20 @@ export async function getFileBySlug(slug: string) {
249246
commonFilePath = path.join(commonPath, slugParts.slice(3).join('/'));
250247
}
251248
if (commonFilePath && fs.existsSync(commonPath)) {
252-
mdxPath = path.join(root, `${commonFilePath}.mdx`);
253-
mdxIndexPath = path.join(root, commonFilePath, 'index.mdx');
254-
mdPath = path.join(root, `${commonFilePath}.md`);
255-
mdIndexPath = path.join(root, commonFilePath, 'index.md');
249+
mdxPath = path.join(directoryName, '..', `${commonFilePath}.mdx`);
250+
mdxIndexPath = path.join(directoryName, '..', commonFilePath, 'index.mdx');
251+
mdPath = path.join(directoryName, '..', `${commonFilePath}.md`);
252+
mdIndexPath = path.join(directoryName, '..', commonFilePath, 'index.md');
256253
}
257254
}
258255

259-
const sourcePath = [mdxPath, mdxIndexPath, mdPath].find(fs.existsSync) ?? mdIndexPath;
256+
const sourcePath =
257+
[mdxPath, mdxIndexPath, mdPath].find(p => fs.existsSync(p)) ?? mdIndexPath;
260258
const source = fs.readFileSync(sourcePath, 'utf8');
261259

262260
process.env.ESBUILD_BINARY_PATH = path.join(
263-
root,
261+
directoryName,
262+
'..',
264263
'node_modules',
265264
'esbuild',
266265
'bin',
@@ -285,7 +284,10 @@ export async function getFileBySlug(slug: string) {
285284
[remarkTocHeadings, {exportRef: toc}],
286285
remarkGfm,
287286
remarkFormatCodeBlocks,
288-
[remarkImageSize, {sourceFolder: cwd, publicFolder: path.join(root, 'public')}],
287+
[
288+
remarkImageSize,
289+
{sourceFolder: cwd, publicFolder: path.join(directoryName, '..', 'public')},
290+
],
289291
remarkMdxImages,
290292
remarkCodeTitles,
291293
remarkCodeTabs,
@@ -353,7 +355,7 @@ export async function getFileBySlug(slug: string) {
353355
};
354356
// Set the `outdir` to a public location for this bundle.
355357
// this where this images will be copied
356-
options.outdir = path.join(root, 'public', 'mdx-images');
358+
options.outdir = path.join(directoryName, '..', 'public', 'mdx-images');
357359

358360
// Set write to true so that esbuild will output the files.
359361
options.write = true;

vercel.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "https://openapi.vercel.sh/vercel.json",
23
"headers": [
34
{
45
"source": "/(.*)",

0 commit comments

Comments
 (0)