Skip to content

Commit 0f6ec06

Browse files
authored
Move playground to website (#765)
* Move playground to website * add nx to make website build work * fix dark theme * add tailwindcss, move to src * fix build on netlify * revert _app change * fix option panel width
1 parent d56ea1c commit 0f6ec06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1694
-316
lines changed

.prettierrc.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
trailingComma: 'all',
66
useTabs: false,
77
printWidth: 80,
8-
proseWrap: "always",
8+
proseWrap: 'always',
99
singleQuote: true,
10+
plugins: [require('prettier-plugin-tailwindcss')],
1011
};

nx.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"implicitDependencies": {
3+
"package.json": "*",
4+
"package-lock.json": "*",
5+
"nx.json": "*",
6+
"tsconfig.base.json": "*"
7+
},
8+
"tasksRunnerOptions": {
9+
"default": {
10+
"runner": "nx/tasks-runners/default",
11+
"options": {
12+
"cacheableOperations": ["build", "test"]
13+
}
14+
}
15+
},
16+
"targetDefaults": {
17+
"build": {
18+
"dependsOn": ["^build"],
19+
"outputs": ["{projectRoot}/dist"]
20+
},
21+
"test": {
22+
"dependsOn": ["build"]
23+
}
24+
}
25+
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
"pnpm": "7.30.3"
66
},
77
"scripts": {
8-
"build": "pnpm --filter '!@react-docgen-internal/*' run build",
9-
"watch": "pnpm --filter '!@react-docgen-internal/*' run watch",
8+
"build": "nx run-many --target=build --exclude='@react-docgen-internal/*'",
109
"lint": "eslint . --ext .js,.cjs,.mjs,.ts,.tsx --report-unused-disable-directives --max-warnings=0",
1110
"fix": "eslint . --ext .js,.cjs,.mjs,.ts,.tsx --fix --report-unused-disable-directives --max-warnings=0",
12-
"test": "pnpm build && pnpm --filter '!@react-docgen-internal/*' exec vitest run",
13-
"test:dev": "pnpm build && pnpm --filter '!@react-docgen-internal/*' exec vitest",
11+
"test": "nx run-many --target=test --exclude='@react-docgen-internal/*' --output-style=stream",
1412
"playground:build": "pnpm --filter @react-docgen-internal/playground run build",
1513
"playground:start": "pnpm --filter @react-docgen-internal/playground run start",
1614
"copy:changelog:react-docgen": "cp ./packages/react-docgen/CHANGELOG.md ./packages/website/pages/docs/release-notes/react-docgen.mdx",
@@ -32,7 +30,9 @@
3230
"eslint-config-prettier": "8.8.0",
3331
"eslint-plugin-prettier": "4.2.1",
3432
"execa": "6.1.0",
33+
"nx": "15.8.9",
3534
"prettier": "2.8.7",
35+
"prettier-plugin-tailwindcss": "0.2.5",
3636
"rimraf": "4.4.1",
3737
"tempy": "3.0.0",
3838
"typescript": "5.0.2",

packages/react-docgen-cli/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
},
1616
"scripts": {
1717
"build": "rimraf dist/ && tsc",
18-
"test": "vitest run",
19-
"watch": "rimraf dist/ && tsc --watch"
18+
"test": "vitest run"
2019
},
2120
"keywords": [
2221
"react",

packages/react-docgen/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"typings": "dist/main.d.ts",
2121
"scripts": {
2222
"build": "rimraf dist/ && tsc",
23-
"test": "vitest run",
24-
"watch": "rimraf dist/ && tsc --watch"
23+
"test": "vitest run"
2524
},
2625
"keywords": [
2726
"react",

packages/website/components/.keep

Whitespace-only changes.

packages/website/next.config.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
const withNextra = require('nextra')({
22
theme: 'nextra-theme-docs',
3-
themeConfig: './theme.config.tsx',
3+
themeConfig: './src/theme.config.tsx',
44
});
55

6-
module.exports = withNextra();
6+
module.exports = withNextra({
7+
webpack: (config) => {
8+
if (!config.resolve.fallback) config.resolve.fallback = {};
9+
10+
config.resolve.fallback.fs = false;
11+
12+
return config;
13+
},
14+
});

packages/website/package.json

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,61 @@
44
"version": "0.0.0",
55
"description": "react-docgen website",
66
"scripts": {
7-
"dev": "next dev",
8-
"build": "next build",
9-
"start": "next start"
7+
"dev": "nx exec -- next dev",
8+
"build": "NODE_ENV=production nx exec -- next build",
9+
"start": "nx exec -- next start"
1010
},
1111
"author": "Daniel Tschinder (http://github.com/danez)",
1212
"license": "MIT",
1313
"dependencies": {
14+
"@codemirror/lang-javascript": "6.1.4",
15+
"@codemirror/view": "6.9.3",
16+
"@headlessui/react": "1.7.13",
17+
"@popperjs/core": "2.11.7",
18+
"@types/react-dom": "18.0.11",
19+
"@uiw/react-codemirror": "4.19.9",
20+
"clsx": "1.2.1",
1421
"next": "13.2.4",
22+
"next-themes": "0.2.1",
1523
"nextra": "2.2.20",
1624
"nextra-theme-docs": "2.2.20",
25+
"postcss": "8.4.21",
26+
"postcss-lightningcss": "0.6.0",
1727
"react": "18.2.0",
18-
"react-dom": "18.2.0"
28+
"react-docgen": "workspace:6.0.0-beta.5",
29+
"react-dom": "18.2.0",
30+
"tailwindcss": "3.2.7"
1931
},
2032
"devDependencies": {
2133
"@types/react": "18.0.29"
34+
},
35+
"browserslist": [
36+
"chrome 64",
37+
"edge 79",
38+
"firefox 67",
39+
"opera 51",
40+
"safari 12"
41+
],
42+
"nx": {
43+
"targets": {
44+
"build": {
45+
"dependsOn": [
46+
"^build"
47+
],
48+
"outputs": [
49+
"{projectRoot}/.next"
50+
]
51+
},
52+
"dev": {
53+
"dependsOn": [
54+
"^build"
55+
]
56+
},
57+
"start": {
58+
"dependsOn": [
59+
"build"
60+
]
61+
}
62+
}
2263
}
2364
}

packages/website/pages/_app.mdx

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/website/postcss.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/** @type {import('postcss').Postcss} */
2+
module.exports = {
3+
plugins: {
4+
tailwindcss: {},
5+
'postcss-lightningcss': {},
6+
},
7+
};

0 commit comments

Comments
 (0)