Skip to content

Commit

Permalink
Clean up dependencies, use plotly reduced distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Jun 17, 2024
1 parent ef33eab commit 2a67cc5
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3,201 deletions.
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

0 comments on commit 2a67cc5

Please sign in to comment.