Skip to content
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

Generate API docs for Toolpad Core #3536

Merged
merged 96 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
bebb82e
Improve bundling, try to fix MUI/Next integration bugs
apedroferreira Mar 28, 2024
03786bd
Fix import in template
apedroferreira Mar 28, 2024
fd68ff0
fix it more
apedroferreira Mar 28, 2024
4d04649
Re-add icon imports
apedroferreira Mar 28, 2024
8630f2a
Always clean or it gets messy
apedroferreira Mar 28, 2024
235116a
Basic layout - a start
apedroferreira Mar 29, 2024
1311f6f
Remove unused icon
apedroferreira Apr 1, 2024
8f6c9db
Basic header, sidebar in progress
apedroferreira Apr 2, 2024
e6d436b
Header with branding + navigation with nesting
apedroferreira Apr 3, 2024
4807db7
Grammar
apedroferreira Apr 3, 2024
926102f
Much better test
apedroferreira Apr 3, 2024
f0c6180
Update created app files
apedroferreira Apr 4, 2024
4175348
Scaffolding fixes
apedroferreira Apr 4, 2024
8f19dde
Add DashboardLayout tests
apedroferreira Apr 4, 2024
f44f5a0
Remove this thing I guess
apedroferreira Apr 4, 2024
d250929
Nevermind
apedroferreira Apr 4, 2024
06da40c
Fix dependencies if they're broken
apedroferreira Apr 4, 2024
f0a17e4
Merge remote-tracking branch 'upstream/master' into add-layout-component
apedroferreira Apr 4, 2024
3dab0a8
Review fixes, make everything more generic, use playground folder
apedroferreira Apr 16, 2024
eb8a6f1
Build with babel, create development tools
apedroferreira Apr 18, 2024
b8fdf8d
Merge remote-tracking branch 'upstream/master' into add-layout-component
apedroferreira Apr 18, 2024
229dffc
Update create-toolpad-app for core
apedroferreira Apr 18, 2024
1c777d3
Review suggestions and add DashboardLayout demo to docs
apedroferreira Apr 23, 2024
9efd2f5
Merge remote-tracking branch 'upstream/master' into add-layout-component
apedroferreira Apr 23, 2024
c31fe20
Fix this example
apedroferreira Apr 23, 2024
7fd54d4
Dedupe
apedroferreira Apr 23, 2024
c6819a5
Use new navigation system
apedroferreira Apr 26, 2024
c4da025
Better component name
apedroferreira Apr 26, 2024
e105c15
DashboardLayout docs, missing API reference
apedroferreira Apr 30, 2024
0327c4f
Update
apedroferreira May 2, 2024
4b59fc0
Merge remote-tracking branch 'upstream/master' into add-layout-component
apedroferreira May 2, 2024
cbc3045
Reuse theme in docs
apedroferreira May 2, 2024
6508899
Fix core publish
apedroferreira May 2, 2024
34e9255
Rerun install
apedroferreira May 2, 2024
fa9b64f
Fix tests and other errors
apedroferreira May 3, 2024
c21a36e
Set exports too
apedroferreira May 3, 2024
83e99e2
whoops
apedroferreira May 3, 2024
effcabf
Merge branch 'master' into add-layout-component
apedroferreira May 3, 2024
0de2030
Try Netlify deploy with imports from root
apedroferreira May 3, 2024
dd39264
Stupid VSCode setting
apedroferreira May 3, 2024
65acf1d
Linters
apedroferreira May 3, 2024
67f724b
Attempt to fix netlify build
apedroferreira May 6, 2024
4b033f7
Merge remote-tracking branch 'upstream/master' into add-layout-component
apedroferreira May 6, 2024
6da38cb
Try to fix OOM in Circle CI
apedroferreira May 6, 2024
1c4f46b
Another attempt to fix OOM in CI
apedroferreira May 6, 2024
a154f6f
Add Toolpad Core contributing instructions
apedroferreira May 6, 2024
c939d98
Try Jan's changes and some other but keep playground
apedroferreira May 7, 2024
b56c288
Merge remote-tracking branch 'upstream/master' into add-layout-component
apedroferreira May 7, 2024
69f2db0
Another attempt
apedroferreira May 7, 2024
661c6ad
More cleanup before trying to remove playground
apedroferreira May 7, 2024
291c78f
Update lockfile
apedroferreira May 7, 2024
c355188
Retry filter option to try to keep playground alive
apedroferreira May 7, 2024
701187e
Try with correct option
apedroferreira May 7, 2024
fef1864
Dedupe again
apedroferreira May 7, 2024
deb85ea
ugh
apedroferreira May 7, 2024
b3346b9
Maybe this
apedroferreira May 7, 2024
f7a9cbb
Revert last failed attempts
apedroferreira May 8, 2024
31a4af8
Try older pnpm patch version
apedroferreira May 8, 2024
1c996a7
Try latest pnpm minor version
apedroferreira May 8, 2024
631afc1
Try pnpm 9
apedroferreira May 8, 2024
5682085
Properly try previous minor version
apedroferreira May 8, 2024
ce8102e
Try latesg pnpm commit ( I think)
apedroferreira May 8, 2024
22cfa4f
gh
apedroferreira May 8, 2024
8fa6300
Fix mismatched packages
apedroferreira May 8, 2024
8ac56cb
Playing around with pnpm had somehow broken the lockfile permanently
apedroferreira May 8, 2024
09a4741
Final cleanup
apedroferreira May 8, 2024
52283d7
api docs generation (WIP)
apedroferreira May 9, 2024
dcdffd3
Fix some more stuff, trying to figure out mess with path aliases...
apedroferreira May 10, 2024
7d7fff1
Rest of the stuff, also fixes aliases
apedroferreira May 10, 2024
4e7d81c
Many review improvements, provide some themes too
apedroferreira May 13, 2024
dbc0e1b
Merge remote-tracking branch 'upstream/master' into add-layout-component
apedroferreira May 14, 2024
59e4121
Remove more leftovers
apedroferreira May 14, 2024
9e26e6e
Review fixes, prep to split into another PR
apedroferreira May 14, 2024
6277b31
Add TODO comments
apedroferreira May 14, 2024
7b963c7
Merge branch 'add-layout-component' into generate-core-api-docs
apedroferreira May 15, 2024
f684a4c
Save progress
apedroferreira May 15, 2024
64e83c1
dfegrstd
apedroferreira May 16, 2024
5e93460
Get it mostly right just need to fix API pages and a few more things
apedroferreira May 17, 2024
1ae8c50
Final things
apedroferreira May 20, 2024
bdbe1e5
Merge remote-tracking branch 'upstream/master' into generate-core-api…
apedroferreira May 21, 2024
c5a37b0
Continue rebasing
apedroferreira May 21, 2024
1077f8e
Cleanup attempt
apedroferreira May 21, 2024
355bad7
Cleanup/fix some more
apedroferreira May 21, 2024
52f3706
Some more cleanup
apedroferreira May 21, 2024
20d8954
Move logo back inside component
apedroferreira May 21, 2024
56045b5
Clean up props
apedroferreira May 21, 2024
79f8a38
Dependency fixes
apedroferreira May 21, 2024
2744ba7
Probably almost ready
apedroferreira May 21, 2024
0ff9260
Merge remote-tracking branch 'upstream/master' into generate-core-api…
apedroferreira May 21, 2024
f01e7d3
Fix prop types generation
apedroferreira May 22, 2024
01eaf42
Merge remote-tracking branch 'upstream/master' into generate-core-api…
apedroferreira May 22, 2024
da1b4ce
Build API docs again
apedroferreira May 22, 2024
a2dcaff
Small spacing fix
apedroferreira May 22, 2024
8502820
keep spacing after all i guess
apedroferreira May 22, 2024
0d162c6
Update previews
apedroferreira May 22, 2024
9b46b1d
remove docs alias
Janpot May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pnpm-lock.yaml
/docs/export
/docs/schemas
/packages/**/dist
/packages/**/build
/packages/toolpad-studio/.next
/packages/toolpad-studio/public

Expand Down
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ module.exports = {
'error',
{
// https://github.com/import-js/eslint-plugin-import/issues/1739
ignore: ['\\.md\\?muiMarkdown$'],
ignore: ['\\?@mui/markdown$'],
},
],
'import/no-restricted-paths': [
Expand Down Expand Up @@ -129,7 +129,14 @@ module.exports = {
'packages/toolpad-studio-runtime/**/*',
'packages/toolpad-utils/**/*',
],
excludedFiles: ['tsup.config.ts', '*.spec.ts', '*.spec.tsx', 'vitest.config.ts'],
excludedFiles: [
'tsup.config.ts',
'*.spec.ts',
'*.spec.tsx',
'*.test.ts',
'*.test.tsx',
'vitest.config.ts',
],
rules: {
'import/no-extraneous-dependencies': ['error'],
},
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ lerna-debug.log
.env

dist/
build/

packages/toolpad-studio/public/web_modules
packages/toolpad-studio/public/runtime
Expand Down
4 changes: 2 additions & 2 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Enforce pnpm

engine-strict = true
auto-install-peers = true
engine-strict=true
auto-install-peers=true
strict-peer-dependencies=false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that a space is supposed to be present from https://docs.npmjs.com/cli/v9/configuring-npm/npmrc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok I was changing these for consistency as I had seen different spacing in different places, will make all of them include the spacing then.

34 changes: 31 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Local development

If you would like to hack on Toolpad Studio or want to run the latest version, you can follow these steps:
If you would like to hack on Toolpad or want to run the latest version, you can follow these steps:

_If you're looking into contributing to the docs, follow the [instructions](#building-and-running-the-documentation) down below_

Expand All @@ -11,7 +11,7 @@ _If you're looking into contributing to the docs, follow the [instructions](#bui
- git
- node.js

### Running apps inside the monorepo (recommended)
### Running Toolpad Studio apps inside the monorepo (recommended)

This uses the local version of Toolpad Studio as built in the mono-repository.
This is recommended when your app is in a folder inside of the mono-repository.
Expand Down Expand Up @@ -139,6 +139,34 @@ pnpm install

</details>

### Developing on Toolpad Core

This uses the local version of Toolpad Core as built in the mono-repository, and allows for quickly testing out changes and their results.

Some application examples for different JavaScript frameworks (such as Next.js, Vite...) are present in the `playground` folder that can be used to quickly develop on Toolpad Core on a live application.

1. Install dependencies:

```bash
pnpm install
```

2. Run the built-in watch mode

```bash
pnpm dev
```

3. Run any application in the `playground` folder in development mode, such as `toolpad-core-nextjs`

```bash
cd playground/toolpad-core-nextjs
```

```bash
pnpm dev
```

## Running integration tests

The playwright tests can be run in one of two modes:
Expand Down Expand Up @@ -198,7 +226,7 @@ Use the `--ui` flag to run the tests interactively.

## Using CodeSandbox CI

Each pull request is built on [CodeSandbox CI](https://codesandbox.io/docs/learn/sandboxes/ci). As a result of that we have a published Toolpad Studio package for ever pull request. To use the package from the pull request, take the following steps:
Each pull request is built on [CodeSandbox CI](https://codesandbox.io/docs/learn/sandboxes/ci). As a result of that we have a published Toolpad Studio package for every pull request. To use the package from the pull request, take the following steps:

1. In the GitHub PR checks, locate the ci/codesandbox check and make sure it has successfully finished building. Click on "details" to open the CodeSandbox CI user interface.

Expand Down
150 changes: 150 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
const path = require('path');

const errorCodesPath = path.resolve(__dirname, './docs/public/static/error-codes.json');
const missingError = process.env.MUI_EXTRACT_ERROR_CODES === 'true' ? 'write' : 'annotate';

function resolveAliasPath(relativeToBabelConf) {
const resolvedPath = path.relative(process.cwd(), path.resolve(__dirname, relativeToBabelConf));
return `./${resolvedPath.replace('\\', '/')}`;
}

const productionPlugins = [
['babel-plugin-react-remove-properties', { properties: ['data-mui-test'] }],
];

module.exports = function getBabelConfig(api) {
const useESModules = api.env(['regressions', 'stable', 'rollup']);

const defaultAlias = {
'@toolpad/core': resolveAliasPath('./packages/toolpad-core/src'),
docs: resolveAliasPath('./node_modules/@mui/monorepo/docs'),
'docs-toolpad': resolveAliasPath('./docs'),
test: resolveAliasPath('./test'),
'@mui-internal/api-docs-builder': resolveAliasPath(
'./node_modules/@mui/monorepo/packages/api-docs-builder',
),
};

const presets = [
[
'@babel/preset-env',
{
bugfixes: true,
browserslistEnv: process.env.BABEL_ENV || process.env.NODE_ENV,
debug: process.env.MUI_BUILD_VERBOSE === 'true',
modules: useESModules ? false : 'commonjs',
},
],
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
'@babel/preset-typescript',
];

const plugins = [
[
'babel-plugin-macros',
{
muiError: {
errorCodesPath,
missingError,
},
},
],
'babel-plugin-optimize-clsx',
[
'@babel/plugin-transform-runtime',
{
useESModules,
// any package needs to declare 7.4.4 as a runtime dependency. default is ^7.0.0
version: '^7.4.4',
},
],
[
'babel-plugin-transform-react-remove-prop-types',
{
mode: 'unsafe-wrap',
},
],
];

if (process.env.NODE_ENV === 'production') {
plugins.push(...productionPlugins);
}

return {
assumptions: {
noDocumentAll: true,
},
presets,
plugins,
ignore: [/@babel[\\|/]runtime/], // Fix a Windows issue.
overrides: [
{
exclude: /\.test\.(js|ts|tsx)$/,
plugins: ['@babel/plugin-transform-react-constant-elements'],
},
],
env: {
coverage: {
plugins: [
'babel-plugin-istanbul',
[
'babel-plugin-module-resolver',
{
root: ['./'],
alias: defaultAlias,
},
],
],
},
development: {
plugins: [
[
'babel-plugin-module-resolver',
{
root: ['./'],
alias: defaultAlias,
},
],
],
},
rollup: {
plugins: [
[
'babel-plugin-module-resolver',
{
alias: defaultAlias,
},
],
],
},
test: {
sourceMaps: 'both',
plugins: [
[
'babel-plugin-module-resolver',
{
root: ['./'],
alias: defaultAlias,
},
],
],
},
benchmark: {
plugins: [
...productionPlugins,
[
'babel-plugin-module-resolver',
{
alias: defaultAlias,
},
],
],
},
},
};
};
7 changes: 7 additions & 0 deletions docs/config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const LANGUAGES: string[];

export const LANGUAGES_SSR: string[];

export const LANGUAGES_IN_PROGRESS: string[];

export const LANGUAGES_IGNORE_PAGES: (pathname: string) => boolean;
3 changes: 0 additions & 3 deletions docs/data/toolpad/core/api/components/dashboard.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/data/toolpad/core/api/components/data-grid.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/data/toolpad/core/api/components/line-chart.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/data/toolpad/core/api/components/select-filter.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/data/toolpad/core/api/hooks/use-filter-state.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/data/toolpad/core/api/index.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
productId: toolpad-core
title: App Provider
components: AppProvider
---

# App Provider

<p class="description">The app provider component provides the necessary context for a Toolpad application.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import BarChartIcon from '@mui/icons-material/BarChart';
import DescriptionIcon from '@mui/icons-material/Description';
import LayersIcon from '@mui/icons-material/Layers';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import theme from '../theme';

const NAVIGATION = [
{
kind: 'header',
title: 'Main items',
},
{
title: 'Dashboard',
icon: <DashboardIcon />,
},
{
title: 'Orders',
icon: <ShoppingCartIcon />,
},
{
kind: 'divider',
},
{
kind: 'header',
title: 'Analytics',
},
{
title: 'Reports',
icon: <BarChartIcon />,
children: [
{
title: 'Sales',
icon: <DescriptionIcon />,
},
{
title: 'Traffic',
icon: <DescriptionIcon />,
},
],
},
{
title: 'Integrations',
icon: <LayersIcon />,
},
];

export default function DashboardLayoutBasic() {
return (
<AppProvider theme={theme} navigation={NAVIGATION}>
<DashboardLayout>
<Box
sx={{
py: 4,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
>
<Typography>Dashboard content goes here.</Typography>
</Box>
</DashboardLayout>
</AppProvider>
);
}
Loading