Skip to content

Commit

Permalink
Export
Browse files Browse the repository at this point in the history
  • Loading branch information
balbatross committed Aug 25, 2023
1 parent ec0ef53 commit e7d2513
Show file tree
Hide file tree
Showing 34 changed files with 80 additions and 42 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/webapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ jobs:
echo "PUBLIC_PATH=https://apps.hexhive.io/${{matrix.apps}}/" >> $GITHUB_ENV
echo "REACT_APP_API=https://api.hexhive.io" >> $GITHUB_ENV
if: ${{ github.ref == 'refs/heads/master' }}

- name: Build deps
run: lerna run build --scope @hive-command/electrical-editor


- name: Build web
run: (export NODE_ENV=production CI=false; lerna run build --scope @hive-command/${{ matrix.apps }} --include-dependencies)
env:
Expand Down
Binary file not shown.
3 changes: 2 additions & 1 deletion packages/app/hivecommand-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
"pretty-quick": "^3.1.1",
"process": "^0.11.10",
"ts-config-single-spa": "^2.0.1",
"ts-loader": "^9.4.4",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"webpack": "^5.40.0",
"webpack": "^5.88.2",
"webpack-cli": "^4.7.2",
"webpack-config-single-spa-react": "^3.0.0",
"webpack-config-single-spa-react-ts": "^3.0.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/app/hivecommand-frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { HexHiveTheme } from "@hexhive/styles";
import { ApolloClient, ApolloProvider, fallbackHttpConfig, InMemoryCache, selectHttpOptionsAndBody, serializeFetchParameter, split } from "@apollo/client";
import { AuthProvider } from '@hexhive/auth-ui'
import { ThemeProvider, Box, createTheme, CircularProgress } from '@mui/material'
import { CommandSurface } from "@hive-command/command-surface";
// import { EditorPage } from "./views/Editor";
import { HttpLink } from "@apollo/client";
import { getMainDefinition } from "@apollo/client/utilities";
import { ApolloLink } from "@apollo/client";
Expand Down
1 change: 0 additions & 1 deletion packages/app/hivecommand-frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"references": [
{"path": "../hivecommand-api"},
{"path": "../../core-ui/command-electrical-editor"},
{"path": "../../core-ui/command-canvas-nodes"},
{"path": "../../core-ui/command-remote-components"},
{"path": "../../core-ui/command-surface"},
{"path": "../../core/command-scripting"}
Expand Down
43 changes: 24 additions & 19 deletions packages/app/hivecommand-frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ module.exports = (webpackConfigEnv, argv) => {
},

resolve: {
alias: {
typescript: path.resolve(__dirname, 'node_modules/typescript'),
// },
// alias: {
'react-resize-aware': path.resolve(__dirname, '../../../node_modules/react-resize-aware'),
// '@mui/material': path.resolve(__dirname, 'node_modules/@mui/material'),
// "@mui/x-date-pickers": path.resolve(__dirname, 'node_modules/@mui/x-date-pickers'),
// '@mui/icons-material': path.resolve(__dirname, 'node_modules/@mui/icons-material'),
// typescript: path.resolve(__dirname, 'node_modules/typescript'),
// // },
// // alias: {
// 'react-resize-aware': path.resolve(__dirname, '../../../node_modules/react-resize-aware'),
// // '@mui/material': path.resolve(__dirname, 'node_modules/@mui/material'),
// // "@mui/x-date-pickers": path.resolve(__dirname, 'node_modules/@mui/x-date-pickers'),
// // '@mui/icons-material': path.resolve(__dirname, 'node_modules/@mui/icons-material'),

react: path.resolve(__dirname, '../../../node_modules/react'),
'@hexhive/ui': path.resolve(__dirname, '../../../node_modules/@hexhive/ui'),
'@hexhive/utils': path.resolve(__dirname, '../../../node_modules/@hexhive/utils'),
'@hexhive/styles': path.resolve(__dirname, '../../../node_modules/@hexhive/styles'),
"@mui/x-date-pickers": path.resolve(__dirname, '../../../node_modules/@mui/x-date-pickers'),
// '@mui/icons-material': path.resolve(__dirname, 'node_modules/@mui/icons-material'),
'@mui/material': path.resolve(__dirname, '../../../node_modules/@mui/material'),
'styled-components': path.resolve(__dirname, '../../../node_modules/styled-components'),
'react-router-dom': path.resolve(__dirname, '../../../node_modules/react-router-dom'),
'@emotion/react': path.resolve(__dirname, '../../../node_modules/@emotion/react')
},
// react: path.resolve(__dirname, '../../../node_modules/react'),
// '@hexhive/ui': path.resolve(__dirname, '../../../node_modules/@hexhive/ui'),
// '@hexhive/utils': path.resolve(__dirname, '../../../node_modules/@hexhive/utils'),
// '@hexhive/styles': path.resolve(__dirname, '../../../node_modules/@hexhive/styles'),
// "@mui/x-date-pickers": path.resolve(__dirname, '../../../node_modules/@mui/x-date-pickers'),
// // '@mui/icons-material': path.resolve(__dirname, 'node_modules/@mui/icons-material'),
// '@mui/material': path.resolve(__dirname, '../../../node_modules/@mui/material'),
// 'styled-components': path.resolve(__dirname, '../../../node_modules/styled-components'),
// 'react-router-dom': path.resolve(__dirname, '../../../node_modules/react-router-dom'),
// '@emotion/react': path.resolve(__dirname, '../../../node_modules/@emotion/react')
// },
plugins: [
new TsconfigPathsPlugin(),
new TsconfigPathsPlugin({logLevel: 'info', logInfoToStdOut: true}),
],
fallback: {
// https: false,
Expand All @@ -77,6 +77,11 @@ module.exports = (webpackConfigEnv, argv) => {
fullySpecified: false,
},
},
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: { projectReferences: true },
},
{
test: /\.ttf$/,
use: ['file-loader']
Expand Down
3 changes: 3 additions & 0 deletions packages/core-ui/command-electrical-editor/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
1 change: 1 addition & 0 deletions packages/core-ui/command-electrical-editor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "@hive-command/export-page",
"version": "0.1.0",
"private": true,
"main": "build/index.html",
"files": [
"build/"
],
"dependencies": {
"@hive-command/remote-components": "workspace:^",
"@hive-command/schematic-viewer": "workspace:^",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"dom.iterable",
"esnext"
],
"composite": true,
"outDir": "build/",
"rootDir": "src/",
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand Down
1 change: 1 addition & 0 deletions packages/core-ui/command-remote-components/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */

Expand Down
1 change: 1 addition & 0 deletions packages/core/command-schematic-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"typescript": "^5.1.6"
},
"dependencies": {
"@hive-command/export-page": "workspace:^",
"express": "^4.18.2",
"pdf-lib": "^1.17.1",
"puppeteer": "^21.1.0"
Expand Down
16 changes: 9 additions & 7 deletions packages/core/command-schematic-export/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import express from 'express';
import { PDFDocument } from 'pdf-lib';
import { writeFileSync } from 'fs';

const html_index = require.resolve('@hive-command/export-page');

export const export_schematic = async (schematic: {pages: any[]}) => {

const pages = (schematic?.pages || []).sort((a,b) => (a.rank || '').localeCompare(b.rank || ''));
Expand All @@ -12,7 +14,7 @@ export const export_schematic = async (schematic: {pages: any[]}) => {

const app = express();

app.use(express.static(path.join(__dirname, 'export-page/build')));
app.use(express.static(path.dirname(html_index)));

app.get('/schematic/pages/:ix', (req, res) => {

Expand Down Expand Up @@ -69,9 +71,9 @@ export const export_schematic = async (schematic: {pages: any[]}) => {

}

export_schematic({
pages: [
{id: '1', nodes: [{id: '1', type: 'electricalSymbol', position: {x: 50, y: 10}, data: {} }, {id: '2', type: 'electricalSymbol', position: {x: 1200, y: 800}, data: {symbol: 'AcCoil'} }]},
{id: '2', nodes: [{ id: '2', type: 'electricalSymbol', position: {x: 10, y: 10}, data: {symbol: 'AcCoil'} }]},
]
})
// export_schematic({
// pages: [
// {id: '1', nodes: [{id: '1', type: 'electricalSymbol', position: {x: 50, y: 10}, data: {} }, {id: '2', type: 'electricalSymbol', position: {x: 1200, y: 800}, data: {symbol: 'AcCoil'} }]},
// {id: '2', nodes: [{ id: '2', type: 'electricalSymbol', position: {x: 10, y: 10}, data: {symbol: 'AcCoil'} }]},
// ]
// })
5 changes: 4 additions & 1 deletion packages/core/command-schematic-export/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,8 @@
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
},
"references": [
{"path": "../../core-ui/command-export-page"}
]
}
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@hive-command/threads": ["../node_modules/@hive-command/threads"],
// "node-opcua": ["../node_modules/node-opcua"],

"@hive-command/remote-components": ["../core-ui/command-remote-components/src"],
"@hive-command/remote-components": ["./core-ui/command-remote-components/src"],

"@hexhive/ui": ["../node_modules/@hexhive/ui"],
"@hexhive/utils": ["../node_modules/@hexhive/utils"],
Expand All @@ -35,6 +35,9 @@

"@hive-command/command-surface": ["./core-ui/command-surface/src"],
"@hive-command/electrical-editor": ["./core-ui/command-electrical-editor/src"],
"@hive-command/schematic-viewer": ["./core-ui/command-schematic-viewer/src"],
"@hive-command/export-page": ["./core-ui/command-export-page/src"],

"@hive-command/canvas-nodes": ["./core-ui/command-canvas-nodes/src"],

"@hive-command/data": ["./core/command-data/src"],
Expand Down
29 changes: 23 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3172,9 +3172,9 @@ __metadata:
languageName: unknown
linkType: soft

"@hive-command/export-page@workspace:packages/core-ui/export-page":
"@hive-command/export-page@workspace:^, @hive-command/export-page@workspace:packages/core-ui/command-export-page":
version: 0.0.0-use.local
resolution: "@hive-command/export-page@workspace:packages/core-ui/export-page"
resolution: "@hive-command/export-page@workspace:packages/core-ui/command-export-page"
dependencies:
"@babel/plugin-proposal-private-property-in-object": ^7.21.11
"@hive-command/remote-components": "workspace:^"
Expand Down Expand Up @@ -3280,9 +3280,10 @@ __metadata:
stream-browserify: ^3.0.0
systemjs: ^6.12.1
ts-config-single-spa: ^2.0.1
ts-loader: ^9.4.4
tsconfig-paths-webpack-plugin: ^4.1.0
typescript: ^5.1.3
webpack: ^5.40.0
webpack: ^5.88.2
webpack-cli: ^4.7.2
webpack-config-single-spa-react: ^3.0.0
webpack-config-single-spa-react-ts: ^3.0.0
Expand Down Expand Up @@ -3511,6 +3512,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hive-command/schematic-export@workspace:packages/core/command-schematic-export"
dependencies:
"@hive-command/export-page": "workspace:^"
express: ^4.18.2
pdf-lib: ^1.17.1
puppeteer: ^21.1.0
Expand Down Expand Up @@ -13527,7 +13529,7 @@ __metadata:
languageName: node
linkType: hard

"enhanced-resolve@npm:^5.15.0, enhanced-resolve@npm:^5.7.0":
"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.15.0, enhanced-resolve@npm:^5.7.0":
version: 5.15.0
resolution: "enhanced-resolve@npm:5.15.0"
dependencies:
Expand Down Expand Up @@ -20392,7 +20394,7 @@ __metadata:
languageName: node
linkType: hard

"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5":
"micromatch@npm:^4.0.0, micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5":
version: 4.0.5
resolution: "micromatch@npm:4.0.5"
dependencies:
Expand Down Expand Up @@ -29944,6 +29946,21 @@ __metadata:
languageName: node
linkType: hard

"ts-loader@npm:^9.4.4":
version: 9.4.4
resolution: "ts-loader@npm:9.4.4"
dependencies:
chalk: ^4.1.0
enhanced-resolve: ^5.0.0
micromatch: ^4.0.0
semver: ^7.3.4
peerDependencies:
typescript: "*"
webpack: ^5.0.0
checksum: 8e5e6b839b0edfa40d2156c880d88ccab58226894ea5978221bc48c7db3215e2e856bfd0093f148e925a2befc42d6c94cafa9a994a7da274541efaa916012b63
languageName: node
linkType: hard

"ts-node@npm:^10.4.0, ts-node@npm:^10.9.1":
version: 10.9.1
resolution: "ts-node@npm:10.9.1"
Expand Down Expand Up @@ -31202,7 +31219,7 @@ __metadata:
languageName: node
linkType: hard

"webpack@npm:^5.40.0, webpack@npm:^5.64.4":
"webpack@npm:^5.64.4, webpack@npm:^5.88.2":
version: 5.88.2
resolution: "webpack@npm:5.88.2"
dependencies:
Expand Down

0 comments on commit e7d2513

Please sign in to comment.