Skip to content

Commit

Permalink
Charts: Adding build option
Browse files Browse the repository at this point in the history
  • Loading branch information
grzegorz-cp committed Dec 19, 2024
1 parent cff42cc commit 6011c10
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 6 deletions.
6 changes: 6 additions & 0 deletions projects/js-packages/charts/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
]
},
"scripts": {
"build-development": [
"pnpm run build"
],
"build-production": [
"NODE_ENV=production pnpm run build"
],
"test-coverage": [
"pnpm run test-coverage"
],
Expand Down
19 changes: 19 additions & 0 deletions projects/js-packages/charts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Charts
export { BarChart } from './src/components/bar-chart';
export { LineChart } from './src/components/line-chart';
export { PieChart } from './src/components/pie-chart';
export { PieSemiCircleChart } from './src/components/pie-semi-circle-chart';

// Chart components
export { BaseTooltip } from './src/components/tooltip';
export { Legend } from './src/components/legend';

// Providers
export { ThemeProvider } from './src/providers/theme';

// Hooks
export { default as useChartMouseHandler } from './src/hooks/use-chart-mouse-handler';

// Types
export type * from './src/components/shared/types';
export type { BaseTooltipProps } from './src/components/tooltip';
5 changes: 4 additions & 1 deletion projects/js-packages/charts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"clean": "rm -rf node_modules",
"test": "jest --config=tests/jest.config.cjs",
"test-coverage": "pnpm run test --coverage",
"storybook": "cd ../storybook && pnpm run storybook:dev"
"storybook": "cd ../storybook && pnpm run storybook:dev",
"compile-ts": "tsc --pretty",
"build": "pnpm run clean-build && pnpm run compile-ts",
"clean-build": "rm -rf build/"
},
"dependencies": {
"@react-spring/web": "9.7.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './bar-chart';
export { default as BarChart } from './bar-chart';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BarChart from '../index';
import { BarChart } from '../index';
import data from './sample-data';
import type { Meta, StoryObj } from '@storybook/react';

Expand Down
4 changes: 3 additions & 1 deletion projects/js-packages/charts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Charts
export { default as BarChart } from './components/bar-chart';
export { BarChart } from './components/bar-chart';
export { LineChart } from './components/line-chart';
export { PieChart } from './components/pie-chart';
export { PieSemiCircleChart } from './components/pie-semi-circle-chart';

// Chart components
export { BaseTooltip } from './components/tooltip';
export { Legend } from './components/legend';

// Providers
export { ThemeProvider } from './providers/theme';

// Hooks
export { default as useChartMouseHandler } from './hooks/use-chart-mouse-handler';

// Types
export type * from './components/shared/types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meta, StoryObj } from '@storybook/react';
import { ThemeProvider, jetpackTheme, wooTheme } from '../.';
import { LineChart, BarChart, PieSemiCircleChart } from '../../..';
import { LineChart, BarChart, PieSemiCircleChart } from '../../../.';
import barSampleData from '../../../components/bar-chart/stories/sample-data';

const meta: Meta< typeof LineChart > = {
Expand Down
2 changes: 1 addition & 1 deletion projects/js-packages/charts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"outDir": "./build/"
},
// List all sources and source-containing subdirs.
"include": [ "./src" ]
"include": [ "./index.ts", "./src" ]
}

0 comments on commit 6011c10

Please sign in to comment.