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

Clean up dependencies, use plotly reduced distribution #75

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: test stan-playground

on:
push:
branches: ['main']
pull_request:
branches: ['main']
workflow_dispatch:
Expand Down
9 changes: 1 addition & 8 deletions gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,12 @@
"@mui/material": "^5.15.17",
"jszip": "^3.10.1",
"monaco-editor": "^0.48.0",
"plotly.js": "^2.33.0",
"plotly.js-cartesian-dist": "^2.33.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8",
"react-plotly.js": "^2.6.0",
"react-router-dom": "^6.17.0",
"react-syntax-highlighter": "^15.5.0",
"react-visibility-sensor": "^5.1.1",
"rehype-mathjax": "^6.0.0",
"rehype-raw": "^6.1.1",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"tinystan": "^0.0.2"
},
"devDependencies": {
Expand All @@ -43,7 +37,6 @@
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@types/react-plotly.js": "^2.6.3",
"@types/react-syntax-highlighter": "^15.5.13",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
Expand Down
88 changes: 0 additions & 88 deletions gui/src/app/Markdown/Markdown.tsx

This file was deleted.

8 changes: 6 additions & 2 deletions gui/src/app/components/LazyPlotlyPlot.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React, { FunctionComponent, Suspense } from 'react'

import type { PlotParams } from 'react-plotly.js';
const Plot = React.lazy(() => (import('react-plotly.js')))
import createPlotlyComponent from "react-plotly.js/factory";
const Plot = React.lazy(async () => {
const plotly = await import('plotly.js-cartesian-dist');
return {default: createPlotlyComponent(plotly)};
})

const LazyPlotlyPlot: FunctionComponent<PlotParams> = ({ data, layout }) => {
return (
Expand All @@ -14,4 +18,4 @@ const LazyPlotlyPlot: FunctionComponent<PlotParams> = ({ data, layout }) => {
)
}

export default LazyPlotlyPlot
export default LazyPlotlyPlot
6 changes: 6 additions & 0 deletions gui/src/app/types/plotly-cartesian.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// See https://github.com/plotly/plotly.js/blob/master/dist/README.md
// This results in much smaller final bundle sizes than importing 'plotly.js',
// but there is no @types/plotly.js-cartesian-dist package.
declare module "plotly.js-cartesian-dist" {
export * from "plotly.js";
}
Loading