Skip to content

Commit 7acbf11

Browse files
authored
Merge pull request #247 from jetstreamapp/chore/update-docs-dependencies
Update documentation dependencies
2 parents 5136a96 + 51401ff commit 7acbf11

14 files changed

Lines changed: 13202 additions & 10350 deletions

File tree

docs/docusaurus.config.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
// @ts-check
22
// Note: type annotations allow type checking and IDEs autocompletion
33

4-
const lightCodeTheme = require('prism-react-renderer/themes/github');
5-
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
4+
const { themes } = require('prism-react-renderer');
5+
6+
const lightCodeTheme = themes.github;
7+
const darkCodeTheme = themes.shadesOfPurple;
68

79
/** @type {import('@docusaurus/types').Config} */
810
const config = {
9-
title: 'Soql Parser JS',
11+
title: 'SOQL Parser JS',
1012
tagline: 'Parse and generate SOQL queries',
11-
url: 'https://jetstreamapp.github.io',
12-
baseUrl: '/soql-parser-js/',
13+
url: 'https://soql-parser-js.getjetstream.app',
14+
baseUrl: '/',
1315
onBrokenLinks: 'throw',
1416
onBrokenMarkdownLinks: 'warn',
1517
favicon: 'img/favicon.ico',
1618

1719
// GitHub pages deployment config.
1820
// If you aren't using GitHub pages, you don't need these.
1921
organizationName: 'jetstreamapp',
20-
projectName: '@jetstreamapp/soql-parser-js',
22+
projectName: 'soql-parser-js',
2123
deploymentBranch: 'gh-pages',
2224
trailingSlash: false,
2325

@@ -93,10 +95,18 @@ const config = {
9395
},
9496
],
9597
},
98+
markdown: {
99+
mdx1Compat: {
100+
comments: false,
101+
admonitions: false,
102+
headingIds: false,
103+
},
104+
},
96105
prism: {
97106
theme: lightCodeTheme,
98107
darkTheme: darkCodeTheme,
99108
},
109+
additionalLanguages: ['javascript', 'json', 'sql'],
100110
}),
101111
};
102112

docs/package-lock.json

Lines changed: 13104 additions & 10290 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,21 @@
1515
"typecheck": "tsc"
1616
},
1717
"dependencies": {
18-
"@docusaurus/core": "^2.4.1",
19-
"@docusaurus/preset-classic": "^2.4.1",
18+
"@docusaurus/core": "3.4.0",
19+
"@docusaurus/preset-classic": "3.4.0",
2020
"@jetstreamapp/soql-parser-js": "^6.0.0",
21-
"@mdx-js/react": "^1.6.22",
22-
"clsx": "^1.2.1",
23-
"prism-react-renderer": "^1.3.5",
24-
"react": "^17.0.2",
25-
"react-dom": "^17.0.2",
26-
"soql-parser-js": "^5.0.2"
21+
"@mdx-js/react": "^3.0.1",
22+
"clsx": "^2.1.1",
23+
"prism-react-renderer": "^2.3.1",
24+
"react": "^18.3.1",
25+
"react-dom": "^18.3.1"
2726
},
2827
"devDependencies": {
29-
"@docusaurus/module-type-aliases": "^2.4.1",
30-
"@tsconfig/docusaurus": "^1.0.5",
31-
"typescript": "^4.7.4"
28+
"@docusaurus/module-type-aliases": "3.4.0",
29+
"@docusaurus/types": "3.0.0",
30+
"@docusaurus/tsconfig": "3.4.0",
31+
"@types/react": "^18.3.3",
32+
"typescript": "~5.4.5"
3233
},
3334
"browserslist": {
3435
"production": [
@@ -43,6 +44,6 @@
4344
]
4445
},
4546
"engines": {
46-
"node": ">=16.14"
47+
"node": ">=18.0"
4748
}
4849
}

docs/src/components/ComposeQueries/ParsedOutput/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { Highlight } from '../../Utilities/Highlight';
23

34
export interface ParsedOutputProps {
45
query: string;
@@ -10,9 +11,7 @@ export default function ParsedOutput({ query }: ParsedOutputProps): JSX.Element
1011
{query && (
1112
<>
1213
<div className="label">Output</div>
13-
<pre>
14-
<code>{query}</code>
15-
</pre>
14+
<Highlight code={query} language="sql" />
1615
</>
1716
)}
1817
</div>

docs/src/components/HomepageFeatures/index.tsx

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import clsx from 'clsx';
33
import styles from './styles.module.css';
4+
import { Highlight } from '../Utilities/Highlight';
45

56
type FeatureItem = {
67
title: string;
@@ -48,33 +49,19 @@ const FeatureList: FeatureItem[] = [
4849
title: 'Parse',
4950
description: (
5051
<>
51-
<p className={styles.featuresSubHeading}>turn</p>
52-
<div>
53-
<pre>
54-
<code>{exampleSoql}</code>
55-
</pre>
56-
</div>
52+
<Highlight code={exampleSoql} language="sql" />
5753
<p className={styles.featuresSubHeading}>into</p>
58-
<pre>
59-
<code>{exampleCompose}</code>
60-
</pre>
54+
<Highlight code={exampleCompose} language="json" />
6155
</>
6256
),
6357
},
6458
{
6559
title: 'Compose',
6660
description: (
6761
<>
68-
<p className={styles.featuresSubHeading}>turn</p>
69-
<div>
70-
<pre>
71-
<code>{exampleCompose}</code>
72-
</pre>
73-
</div>
62+
<Highlight code={exampleCompose} language="json" />
7463
<p className={styles.featuresSubHeading}>into</p>
75-
<pre>
76-
<code>{exampleSoql}</code>
77-
</pre>
64+
<Highlight code={exampleSoql} language="sql" />
7865
</>
7966
),
8067
},
@@ -83,7 +70,7 @@ const FeatureList: FeatureItem[] = [
8370
description: (
8471
<>
8572
<p>
86-
Your SOQL query is parsed using a proper language parser,{' '}
73+
Your SOQL query is parsed using a language parser,{' '}
8774
<a href="https://chevrotain.io/docs/features/blazing_fast.html" target="_blank">
8875
Chevrotain JS
8976
</a>
@@ -106,7 +93,7 @@ function Feature({ title, description }: FeatureItem) {
10693
<div className={clsx('col col--4')}>
10794
<div className="padding-horiz--md">
10895
<h2 className="text--center">{title}</h2>
109-
<p>{description}</p>
96+
{description}
11097
</div>
11198
</div>
11299
);

docs/src/components/HomepageFeatures/styles.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
text-align: center;
1010
text-transform: uppercase;
1111
font-weight: semi-bold;
12+
margin: 0.5rem 0;
1213
}
1314

1415
.featureSvg {

docs/src/components/ParseQueries/ParsedOutput/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import { parseQuery, Query } from '@jetstreamapp/soql-parser-js';
3+
import { Highlight } from '../../Utilities/Highlight';
34

45
export interface ParsedOutputProps {
56
query: string;
@@ -24,6 +25,8 @@ export default function ParsedOutput({ query }: ParsedOutputProps): JSX.Element
2425
}
2526
}, [query, allowPartialQuery, ignoreParseErrors, allowApexBindVariables]);
2627

28+
const code = parsedQuery ? JSON.stringify(parsedQuery, null, 2) : invalidMessage;
29+
2730
return (
2831
<div className="">
2932
<fieldset>
@@ -50,9 +53,7 @@ export default function ParsedOutput({ query }: ParsedOutputProps): JSX.Element
5053
{(parsedQuery || invalidMessage) && (
5154
<>
5255
<div className="label">Output</div>
53-
<pre>
54-
<code>{parsedQuery ? JSON.stringify(parsedQuery, null, 2) : invalidMessage}</code>
55-
</pre>
56+
<Highlight code={code} language="json" />
5657
</>
5758
)}
5859
</div>

docs/src/components/SoqlList/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import clsx from 'clsx';
33
import styles from './styles.module.css';
44
import sampleQueriesJson from '@site/static/sample-queries-json.json';
5+
import { Highlight } from '../Utilities/Highlight';
56

67
const sampleQueries: string[] = sampleQueriesJson;
78

@@ -26,7 +27,7 @@ export default function SoqlList({ isOpen = true, selected, onSelected, onToggle
2627
className={clsx(styles.listItem, { [styles.selected]: selected === query })}
2728
onClick={() => onSelected(query)}
2829
>
29-
{query}
30+
<Highlight code={query} language="sql" classNames={{ pre: 'wrap-text' }} />
3031
</li>
3132
))}
3233
</ul>

docs/src/components/SoqlList/styles.module.css

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,25 @@
2727
padding: 0;
2828
max-height: calc(100vh - var(--ifm-navbar-height) - 62px - 1rem);
2929
overflow-y: scroll;
30+
margin-top: 0.2rem;
3031
}
3132

3233
.listItem {
3334
padding: 0.5rem;
34-
border-top: 1px solid #e5e5e5;
3535
cursor: pointer;
36-
}
37-
38-
[data-theme='dark'] .listItem.selected {
39-
background-color: #373535;
36+
border-left: 5px solid transparent;
4037
}
4138

4239
.listItem.selected {
43-
background-color: #d7d1d1;
40+
border-left: 5px solid #808080;
4441
}
4542

4643
[data-theme='dark'] .listItem:hover {
47-
background-color: #373535;
44+
border-left: 5px solid #e5e5e5;
4845
text-decoration: none;
4946
}
5047

5148
.listItem:hover {
52-
background-color: #d7d1d1;
49+
border-left: 5px solid #808080;
5350
text-decoration: none;
5451
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Language, Highlight as PrismaHighlight, themes } from 'prism-react-renderer';
2+
import { useColorMode } from '@docusaurus/theme-common';
3+
4+
interface HighlightProps {
5+
code: string;
6+
language: Language;
7+
classNames?: {
8+
pre?: string;
9+
};
10+
}
11+
12+
export function Highlight({ code, language, classNames = {} }: HighlightProps) {
13+
const { colorMode } = useColorMode();
14+
15+
const theme = colorMode === 'light' ? themes.github : themes.shadesOfPurple;
16+
17+
return (
18+
<PrismaHighlight theme={theme} code={code} language={language}>
19+
{({ style, tokens, getLineProps, getTokenProps }) => (
20+
<pre
21+
className={classNames?.pre}
22+
style={{
23+
...style,
24+
margin: 0,
25+
}}
26+
>
27+
{tokens.map((line, i) => (
28+
<div key={i} {...getLineProps({ line })}>
29+
{line.map((token, key) => (
30+
<span key={key} {...getTokenProps({ token })} />
31+
))}
32+
</div>
33+
))}
34+
</pre>
35+
)}
36+
</PrismaHighlight>
37+
);
38+
}

0 commit comments

Comments
 (0)