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

updated version of the sandbox #1818

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

updated version of the sandbox #1818

wants to merge 1 commit into from

Conversation

signatenkov
Copy link
Contributor

This PR replaces existing /debug folder with alternative version for more convenient and streamlined experimentation with lightweight-charts.

The main difference with my first attempt is focus on simplicity, ability to have unlimited amount of sandboxes.

Performance considerations was also taken into account and every sandbox is sharing the same common root /debug/playground and their packages. Any dependency managed under sandbox would happen under common root.

@signatenkov signatenkov self-assigned this Feb 17, 2025
Copy link
Contributor

@SlicedSilver SlicedSilver left a comment

Choose a reason for hiding this comment

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

This is really cool 🤩

Very simple and fast to create new examples. Great work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add something about how to test using the production (minified) version of the library?
Since we use the following in our library package:

"exports": {
    "./package.json": "./package.json",
    ".": {
      "development": {
        "types": "./dist/typings.d.ts",
        "import": "./dist/lightweight-charts.development.mjs"
      },
      "production": {
        "types": "./dist/typings.d.ts",
        "import": "./dist/lightweight-charts.production.mjs"
      },
      "default": {
        "types": "./dist/typings.d.ts",
        "import": "./dist/lightweight-charts.production.mjs"
      }
    }
  },

It means all that we need to do to tell vite to use the production version is to set the NODE_ENV to production.

So if I want to run my playground with the production then I just do this:

NODE_ENV=production npm run serve my-playground

Comment on lines +1 to +15
import {
AreaSeries,
CandlestickSeries,
createChart,
} from "lightweight-charts";

const chartOptions = {
layout: {
textColor: "black",
background: {
type: "solid",
color: "white",
},
},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I got a typescript warning when I opened the file in my playground.
Lets add some types to make TS happy.

Suggested change
import {
AreaSeries,
CandlestickSeries,
createChart,
} from "lightweight-charts";
const chartOptions = {
layout: {
textColor: "black",
background: {
type: "solid",
color: "white",
},
},
};
import {
AreaSeries,
CandlestickSeries,
ChartOptions,
ColorType,
createChart,
DeepPartial,
} from "lightweight-charts";
const chartOptions = {
layout: {
textColor: "black",
background: {
type: ColorType.Solid,
color: "white",
},
},
} satisfies DeepPartial<ChartOptions>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants