Skip to content

Commit

Permalink
#9 adding installation script for the example application, use yalc f…
Browse files Browse the repository at this point in the history
…or the example
  • Loading branch information
ddelpiano committed Nov 6, 2022
1 parent a534290 commit 3afdb19
Show file tree
Hide file tree
Showing 4 changed files with 578 additions and 143 deletions.
11 changes: 9 additions & 2 deletions example/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'react-app-polyfill/ie11';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import MetaDiagram, { MetaNode, Position, ComponentsMap, MetaLink, MetaPort, PortTypes } from './..';
import MetaDiagram, { MetaNode, Position, ComponentsMap, MetaLink, MetaPort, PortTypes } from '@metacell/meta-diagram';
// import {makeStyles} from "@material-ui/core";
import CustomLinkWidget from './components/widgets/CustomLinkWidget';
import BG from './components/assets/svg/bg-dotted.svg';
Expand Down Expand Up @@ -34,6 +34,7 @@ const App = () => {
'node-red',
null,
[new MetaPort('in', 'in', PortTypes.INPUT_PORT, undefined, undefined), new MetaPort('out', 'out', PortTypes.OUTPUT_PORT, undefined, undefined)],
[],
new Map(Object.entries({ color: 'rgb(0,255,0)' }))
);

Expand All @@ -45,6 +46,7 @@ const App = () => {
'node-blue',
grandparent,
[new MetaPort('in', 'in', PortTypes.INPUT_PORT, undefined, undefined), new MetaPort('out', 'out', PortTypes.OUTPUT_PORT, undefined, undefined)],
[],
new Map(Object.entries({ color: 'rgb(255,0,0)' }))
);

Expand All @@ -56,6 +58,7 @@ const App = () => {
'node-red',
parent,
[new MetaPort('in', 'in', PortTypes.INPUT_PORT, undefined, undefined), new MetaPort('out', 'out', PortTypes.OUTPUT_PORT, undefined, undefined)],
[],
new Map(Object.entries({ color: 'rgb(0,192,255)' }))
);

Expand All @@ -67,6 +70,7 @@ const App = () => {
'node-blue',
parent,
[new MetaPort('in', 'in', PortTypes.INPUT_PORT, undefined, undefined), new MetaPort('out', 'out', PortTypes.OUTPUT_PORT, undefined, undefined)],
[],
new Map(Object.entries({ color: 'rgb(255,255,0)' }))
);

Expand All @@ -87,12 +91,15 @@ const App = () => {
new Map(Object.entries({ default: CustomLinkWidget }))
);

const nodes = [node1, node2, parent, grandparent];
const metaNodes = nodes.map((item:MetaNode) => item.toModel());

return (
<ThemeProvider theme={theme}>
<CssBaseline />
<div className={classes.main}>
<MetaDiagram
metaNodes={[node1, node2, parent, grandparent]}
metaNodes={metaNodes}
metaLinks={[]}
componentsMap={componentsMap}
metaTheme={{
Expand Down
15 changes: 15 additions & 0 deletions example/installation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e

echo "=== Install / Update script for PsyNeuLinkViewer and meta-diagram ==="

npm -g install yalc

cd ../
yarn && yarn run build:dev && yalc push --changed
cd example

yalc add @metacell/meta-diagram
rm -rf node_modules/
yarn
yarn run start
7 changes: 4 additions & 3 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"dependencies": {
"@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3",
"@metacell/meta-diagram": "file:.yalc/@metacell/meta-diagram",
"@mui/icons-material": "^5.8.4",
"@mui/material": "^5.8.4",
"@mui/styles": "^5.8.4",
"react-app-polyfill": "^1.0.0",
"react-is": "^18.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react-app-polyfill": "^1.0.0",
"react-dom": "^17.0.2",
"react-is": "^18.2.0"
},
"alias": {
"react": "../node_modules/react",
Expand Down
Loading

0 comments on commit 3afdb19

Please sign in to comment.