Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot committed May 14, 2024
2 parents 0722ee1 + 9ff235e commit 7afd082
Show file tree
Hide file tree
Showing 21 changed files with 1,924 additions and 211 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ pnpm-lock.yaml
/packages/toolpad-studio/.next
/packages/toolpad-studio/public

build

/examples/*/toolpad.yml

/test/integration/*/fixture*/
Expand Down
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

engine-strict = true
auto-install-peers = true
strict-peer-dependencies=false
strict-peer-dependencies = false
62 changes: 62 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const productionPlugins = [
['babel-plugin-react-remove-properties', { properties: ['data-mui-test'] }],
];

module.exports = function getBabelConfig(api) {
const useCommonjs = api.env(['node']);

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

const plugins = [
[
'@babel/plugin-transform-runtime',
{
useESModules: !useCommonjs,
// 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'],
},
],
};
};
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
},
"devDependencies": {
"@argos-ci/core": "1.5.5",
"@babel/cli": "7.24.1",
"@babel/core": "7.24.4",
"@babel/node": "7.23.9",
"@babel/plugin-transform-react-constant-elements": "7.24.1",
"@babel/plugin-transform-runtime": "7.24.3",
"@babel/preset-env": "7.24.4",
"@babel/preset-react": "7.24.1",
"@babel/preset-typescript": "7.24.1",
"@mui/monorepo": "github:mui/material-ui#6477d93ce61ab0e6b500b90e484129217eb6f5ec",
"@mui/x-charts": "7.4.0",
"@next/eslint-plugin-next": "14.2.3",
Expand All @@ -50,6 +58,8 @@
"@types/node": "20.12.8",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
"babel-plugin-react-remove-properties": "0.3.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"chalk": "5.3.0",
"eslint": "8.57.0",
"eslint-config-airbnb": "19.0.4",
Expand All @@ -65,7 +75,9 @@
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-typescript-enum": "2.1.0",
"execa": "8.0.1",
"fast-glob": "^3.3.2",
"format-util": "1.0.5",
"fs-extra": "11.2.0",
"globby": "14.0.1",
"jsdom": "24.0.0",
"lerna": "7.4.2",
Expand Down
68 changes: 32 additions & 36 deletions packages/toolpad-core/package.json
Original file line number Diff line number Diff line change
@@ -1,75 +1,71 @@
{
"name": "@toolpad/core",
"version": "0.1.55",
"author": "Toolpad Team",
"description": "Dashboard framework powered by MUI.",
"main": "./build/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./*": {
"types": "./build/*/index.d.ts",
"default": "./build/*/index.js"
}
},
"keywords": [
"react",
"mui",
"toolpad"
],
"description": "Build dashboards fast.",
"repository": {
"type": "git",
"url": "https://github.com/mui/mui-toolpad.git",
"directory": "packages/toolpad-core"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/mui/mui-toolpad/issues"
},
"author": "Toolpad Team",
"homepage": "https://github.com/mui/mui-toolpad#readme",
"license": "MIT",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./*": {
"types": "./dist/*.d.ts",
"require": "./dist/*.cjs",
"default": "./dist/*.js"
}
},
"files": [
"dist"
],
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"check-types": "tsup && tsc --noEmit",
"build": "pnpm prebuild && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
"build:node": "node ../../scripts/build.mjs node",
"build:stable": "node ../../scripts/build.mjs stable",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"build:types": "tsc -b tsconfig.build.json",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"dev": "pnpm build:stable --watch & pnpm build:types --watch",
"check-types": "tsc --noEmit",
"test": "vitest run"
},
"dependencies": {
"@emotion/cache": "11.11.0",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.5",
"@mui/icons-material": "5.15.17",
"@mui/material": "5.15.17",
"@mui/material-nextjs": "5.15.11",
"next": "14.2.3",
"react": "18.2.0",
"react-dom": "^18.2.0"
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0"
},
"peerDependencies": {
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@mui/icons-material": "^5",
"@mui/material": "^5",
"@types/react": "^18",
"next": "^14",
"react": "^18",
"react-dom": "^18"
"react": "^18"
},
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=18"
}
},
"files": [
"build"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import * as React from 'react';
import { describe, test, expect, afterEach } from 'vitest';
import { render, cleanup, screen } from '@testing-library/react';
import { createTheme } from '@mui/material/styles';
import AppProvider from './AppProvider';

afterEach(cleanup);
import { AppProvider } from './AppProvider';

describe('AppProvider', () => {
afterEach(cleanup);

test('renders content correctly', async () => {
const theme = createTheme();

Expand Down
15 changes: 6 additions & 9 deletions packages/toolpad-core/src/AppProvider/AppProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter';
import { ThemeProvider } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';

Expand All @@ -10,14 +9,12 @@ interface AppProviderProps {
theme: Theme;
}

export default function AppProvider({ children, theme }: AppProviderProps) {
export function AppProvider({ children, theme }: AppProviderProps) {
return (
<AppRouterCacheProvider options={{ enableCssLayer: true }}>
<ThemeProvider theme={theme}>
{/* CssBaseline kickstarts an elegant, consistent, and simple baseline to build upon. */}
<CssBaseline />
{children}
</ThemeProvider>
</AppRouterCacheProvider>
<ThemeProvider theme={theme}>
{/* CssBaseline kickstarts an elegant, consistent, and simple baseline to build upon. */}
<CssBaseline />
{children}
</ThemeProvider>
);
}
3 changes: 2 additions & 1 deletion packages/toolpad-core/src/AppProvider/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default } from './AppProvider';
'use client';
export * from './AppProvider';
9 changes: 9 additions & 0 deletions packages/toolpad-core/src/DashboardLayout/DashboardLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';

interface DashboardLayoutProps {
children: React.ReactNode;
}

export function DashboardLayout({ children }: DashboardLayoutProps) {
return children;
}
2 changes: 2 additions & 0 deletions packages/toolpad-core/src/DashboardLayout/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'use client';
export * from './DashboardLayout';
5 changes: 2 additions & 3 deletions packages/toolpad-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/export */
export { AppProvider } from './AppProvider';

export { default as AppProvider } from './AppProvider';
export * from './AppProvider';
export { DashboardLayout } from './DashboardLayout';
15 changes: 15 additions & 0 deletions packages/toolpad-core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// This config is for emitting declarations (.d.ts) only
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "build",
"rootDir": "./src"
},
"include": ["src/**/*.ts*"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
}
27 changes: 14 additions & 13 deletions packages/toolpad-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"allowJs": true,
"isolatedModules": true,
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": false,
"outDir": "./dist",
"pretty": true,
"preserveWatchOutput": true,
"rootDir": "src",
"target": "es5",
"lib": ["es2020", "dom"],
"jsx": "preserve",
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"target": "es2020",
"types": ["react", "node"]
"noEmit": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"noErrorTruncation": false,
"allowJs": true,
"paths": {}
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/index.ts"],
"exclude": ["dist", "src/**/*.spec.*"]
"include": ["src/**/*"],
"exclude": ["build", "node_modules"]
}
37 changes: 0 additions & 37 deletions packages/toolpad-core/tsup.config.ts

This file was deleted.

Loading

0 comments on commit 7afd082

Please sign in to comment.