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

Update dependencies to work with Vite and NextJS, combine css files into a single css file #1510

Merged
merged 16 commits into from
Sep 13, 2023
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
17 changes: 16 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,20 @@
["@babel/plugin-proposal-private-property-in-object", { "loose": true }],
["@babel/plugin-proposal-private-methods", { "loose": true }]
],
"presets": ["@babel/preset-env", "@babel/preset-react"]
"presets": ["@babel/preset-env", "@babel/preset-react"],
"env": {
"lib": {
"plugins": [
"@babel/plugin-transform-runtime",
["@babel/plugin-proposal-class-properties", { "loose": true }],
[
"@babel/plugin-proposal-private-property-in-object",
{ "loose": true }
],
["@babel/plugin-proposal-private-methods", { "loose": true }],
["babel-plugin-transform-remove-imports", { "test": "\\.(scss)$" }]
],
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
}
}
2 changes: 1 addition & 1 deletion .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ jobs:
command: npm run lint
- run:
name: Run JavaScript tests
command: npm run build:css && npm run test:ci
command: npm run test:ci
- run:
name: Run Javascript end to end tests
command: npm run cy:ci
Expand Down
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,26 @@ train_evaluation.r2_score_linear_regression:

### Standalone React component usage

To use Kedro-Viz as a standalone React component, import the component and supply a data JSON as prop:
To use Kedro-Viz as a standalone React component, you can follow the example below. However, please note that Kedro-Viz does not support server-side rendering (SSR). If you're using Next.js or another SSR framework, you should be aware of this limitation.

```javascript
import KedroViz from '@quantumblack/kedro-viz';
import '@quantumblack/kedro-viz/lib/styles/styles.min.css';

const MyApp = () => (
<div style={{ height: '100vh' }}>
<KedroViz data={json} />
</div>
);
const MyApp = () => <KedroViz data={json} />;
```

To use with NextJS:

```javascript
import '@quantumblack/kedro-viz/lib/styles/styles.min.css';
import dynamic from 'next/dynamic';

const NoSSRKedro = dynamic(() => import('@quantumblack/kedro-viz'), {
ssr: false,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome !!


const MyApp = () => <NoSSRKedro data={json} />;
```

The JSON can be obtained by running:
Expand Down
7 changes: 6 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Please follow the established format:

- Fix for Kedro Viz Connection Error (#1507)

# Release 6.5.1

## Bug fixes and other changes

- Updated dependencies to ensure compatibility with Vite and Next.js environments; combine CSS into a single file when used as a React component. (#1510)

# Release 6.5.0

## Major features and improvements
Expand All @@ -23,7 +29,6 @@ Please follow the established format:
- Add favicon to Kedro-Viz. (#1509)
- Remove python upper-bound requirements and add KedroVizPythonVersion warning. (#1506)


# Release 6.4.0

## Major features and improvements
Expand Down
Loading