Skip to content

Commit

Permalink
#300: Make dsfr-chart an optional dev depencency
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Sep 9, 2024
1 parent bc2c2be commit 0c93902
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 9 deletions.
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,19 @@
],
"homepage": "https://github.com/codegouvfr/react-dsfr",
"dependencies": {
"@gouvfr/dsfr-chart": "^1.0.0",
"tsafe": "^1.7.2",
"yargs-parser": "^21.1.1"
},
"peerDependencies": {
"@gouvfr/dsfr-chart": "^1.0.0"
},
"peerDependenciesMeta": {
"@gouvfr/dsfr-chart": {
"optional": true
}
},
"devDependencies": {
"@gouvfr/dsfr-chart": "^1.0.0",
"@babel/core": "^7.20.2",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
Expand Down
2 changes: 2 additions & 0 deletions src/Chart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ export const BarChart = chartWrapper((props: BarChartBaseProps) => {
BarChart.displayName = symToStr({ BarChart });

export default BarChart;

// Just so that the icon is included: "fr-icon-arrow-go-back-fill"
6 changes: 6 additions & 0 deletions src/bin/only-include-used-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ async function getCommandContext(args: string[]): Promise<CommandContext> {
return false;
}

console.log(relativeDirPath);

This comment has been minimized.

Copy link
@totakoko

totakoko Sep 9, 2024

Contributor

Hello @garronej, possible d'enlever ce console.log ? 😄

This comment has been minimized.

Copy link
@garronej

garronej Sep 9, 2024

Author Collaborator

Ah oui zut!


if (parsedPackageJson["name"] === "@gouvfr/dsfr-chart") {
return false;
}

for (const packageName of [
CODEGOUV_REACT_DSFR,
"@gouvfr/dsfr",
Expand Down
9 changes: 8 additions & 1 deletion stories/charts/BarChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const { meta, getStory } = getStoryFactory<BarChartProps>({
"wrappedComponent": { BarChart },
"description": `
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants-beta/graphiques-charts/)
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)`,
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)
To use this component you need to add \`@gouvfr/dsfr-chart\` to your dependencies.
Note for Next users: Chart components are not SSR compatible. You need to import them dynamically with [\`next/dynamic\`](https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#nextdynamic).
You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2c2be290b09684711c53176b7a379cebed08a8/test/integration/next-appdir/app/dsfr-chart/page.tsx#L8-L9).
`,
"argTypes": {
"x": {
"description": "Array of value for the x axis"
Expand Down
9 changes: 8 additions & 1 deletion stories/charts/BarLineChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const { meta, getStory } = getStoryFactory<BarLineChartProps>({
"wrappedComponent": { BarLineChart },
"description": `
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants-beta/graphiques-charts/)
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)`,
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)
To use this component you need to add \`@gouvfr/dsfr-chart\` to your dependencies.
Note for Next users: Chart components are not SSR compatible. You need to import them dynamically with [\`next/dynamic\`](https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#nextdynamic).
You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2c2be290b09684711c53176b7a379cebed08a8/test/integration/next-appdir/app/dsfr-chart/page.tsx#L8-L9).
`,
"argTypes": {
"x": {
"description": "Array of value for the x axis"
Expand Down
9 changes: 8 additions & 1 deletion stories/charts/GaugeChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const { meta, getStory } = getStoryFactory<GaugeChartProps>({
"wrappedComponent": { GaugeChart },
"description": `
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants-beta/graphiques-charts/)
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)`,
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)
To use this component you need to add \`@gouvfr/dsfr-chart\` to your dependencies.
Note for Next users: Chart components are not SSR compatible. You need to import them dynamically with [\`next/dynamic\`](https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#nextdynamic).
You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2c2be290b09684711c53176b7a379cebed08a8/test/integration/next-appdir/app/dsfr-chart/page.tsx#L8-L9).
`,
"argTypes": {
"value": {
"description": "Current value"
Expand Down
9 changes: 8 additions & 1 deletion stories/charts/LineChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const { meta, getStory } = getStoryFactory<LineChartProps>({
"wrappedComponent": { LineChart },
"description": `
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants-beta/graphiques-charts/)
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)`,
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)
To use this component you need to add \`@gouvfr/dsfr-chart\` to your dependencies.
Note for Next users: Chart components are not SSR compatible. You need to import them dynamically with [\`next/dynamic\`](https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#nextdynamic).
You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2c2be290b09684711c53176b7a379cebed08a8/test/integration/next-appdir/app/dsfr-chart/page.tsx#L8-L9).
`,
"argTypes": {
"x": {
"description": "Array of value for the x axis"
Expand Down
9 changes: 8 additions & 1 deletion stories/charts/MultiLineChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const { meta, getStory } = getStoryFactory<MultiLineChartProps>({
"wrappedComponent": { MultiLineChart },
"description": `
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants-beta/graphiques-charts/)
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)`,
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)
To use this component you need to add \`@gouvfr/dsfr-chart\` to your dependencies.
Note for Next users: Chart components are not SSR compatible. You need to import them dynamically with [\`next/dynamic\`](https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#nextdynamic).
You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2c2be290b09684711c53176b7a379cebed08a8/test/integration/next-appdir/app/dsfr-chart/page.tsx#L8-L9).
`,
"argTypes": {
"x": {
"description": "Array of value for the x axis"
Expand Down
9 changes: 8 additions & 1 deletion stories/charts/PieChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const { meta, getStory } = getStoryFactory<PieChartProps>({
"wrappedComponent": { PieChart },
"description": `
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants-beta/graphiques-charts/)
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)`,
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)
To use this component you need to add \`@gouvfr/dsfr-chart\` to your dependencies.
Note for Next users: Chart components are not SSR compatible. You need to import them dynamically with [\`next/dynamic\`](https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#nextdynamic).
You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2c2be290b09684711c53176b7a379cebed08a8/test/integration/next-appdir/app/dsfr-chart/page.tsx#L8-L9).
`,
"argTypes": {
"x": {
"description": "Array of value for the x axis"
Expand Down
9 changes: 8 additions & 1 deletion stories/charts/RadarChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const { meta, getStory } = getStoryFactory<RadarChartProps>({
"wrappedComponent": { RadarChart },
"description": `
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants-beta/graphiques-charts/)
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)`,
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)
To use this component you need to add \`@gouvfr/dsfr-chart\` to your dependencies.
Note for Next users: Chart components are not SSR compatible. You need to import them dynamically with [\`next/dynamic\`](https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#nextdynamic).
You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2c2be290b09684711c53176b7a379cebed08a8/test/integration/next-appdir/app/dsfr-chart/page.tsx#L8-L9).
`,
"argTypes": {
"x": {
"description": "Array of value for the x axis"
Expand Down
9 changes: 8 additions & 1 deletion stories/charts/ScatterChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const { meta, getStory } = getStoryFactory<ScatterChartProps>({
"wrappedComponent": { ScatterChart },
"description": `
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/composants-et-modeles/composants-beta/graphiques-charts/)
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)`,
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Chart/BarChart.tsx)
To use this component you need to add \`@gouvfr/dsfr-chart\` to your dependencies.
Note for Next users: Chart components are not SSR compatible. You need to import them dynamically with [\`next/dynamic\`](https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#nextdynamic).
You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2c2be290b09684711c53176b7a379cebed08a8/test/integration/next-appdir/app/dsfr-chart/page.tsx#L8-L9).
`,
"argTypes": {
"x": {
"description": "Array of value for the x axis"
Expand Down
1 change: 1 addition & 0 deletions test/integration/next-appdir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@mui/x-date-pickers": "^6.18.2",
"dayjs": "^1.11.7",
"@mui/x-data-grid": "^6.18.2",
"@gouvfr/dsfr-chart": "^1.0.0",
"@codegouvfr/react-dsfr": "file:../../../dist"
},
"devDependencies": {
Expand Down

0 comments on commit 0c93902

Please sign in to comment.