Skip to content

Commit fd2e373

Browse files
authored
feat: electron app setup (#123)
* add: electron project * update: project * update: cleanup * fix: build * fix: lint
1 parent 24fed67 commit fd2e373

22 files changed

+8067
-2020
lines changed

benchmarking/src/app/app.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Route, BrowserRouter as Router, Routes } from 'react-router-dom';
1+
import { Link, Route, BrowserRouter as Router, Routes } from 'react-router-dom';
22
import { IndexedDBMProvider } from './dbm-context/indexed-dbm-context';
33
import { MemoryDBMProvider } from './dbm-context/memory-dbm-context';
44
import { ParallelIndexedDBMProvider } from './dbm-context/parallel-indexed-dbm-context';
@@ -10,6 +10,25 @@ import { QueryBenchmarking } from './query-benchmarking/query-benchmarking';
1010
export function App() {
1111
return (
1212
<Router>
13+
<nav>
14+
<ul>
15+
<li>
16+
<Link to="/raw-dbm">Raw DuckDB</Link>
17+
</li>
18+
<li>
19+
<Link to="/memory-dbm">In Memory Sequence DuckDB</Link>
20+
</li>
21+
<li>
22+
<Link to="/indexed-dbm">IndexedDB DuckDB</Link>
23+
</li>
24+
<li>
25+
<Link to="/parallel-memory-dbm">Parallel Memory DuckDB</Link>
26+
</li>
27+
<li>
28+
<Link to="/parallel-indexed-dbm">Parallel Indexed DuckDB</Link>
29+
</li>
30+
</ul>
31+
</nav>
1332
<Routes>
1433
<Route
1534
path="/raw-dbm"

benchmarking/src/app/benchmarking-tests/dbm-benchmarking.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('Benchmarking DBMs', () => {
2828
while (!serverStarted) {
2929
console.info('Waiting for server to start');
3030
try {
31-
await page.goto('http://localhost:4200');
31+
await page.goto('http://localhost:4204');
3232
serverStarted = true;
3333
} catch (error) {
3434
console.info('Server not started yet', error);
@@ -51,7 +51,7 @@ describe('Benchmarking DBMs', () => {
5151
}, 30000);
5252

5353
it('Benchmark raw duckdb with memory sequence duckdb', async () => {
54-
await page.goto('http://localhost:4200/raw-dbm');
54+
await page.goto('http://localhost:4204/raw-dbm');
5555
/**
5656
* wait for total time to be render
5757
*/
@@ -65,7 +65,7 @@ describe('Benchmarking DBMs', () => {
6565

6666
console.info('totalTimeForRawDB', totalTimeForRawDB);
6767

68-
await page.goto('http://localhost:4200/memory-dbm');
68+
await page.goto('http://localhost:4204/memory-dbm');
6969

7070
/**
7171
* wait for total time to be render
@@ -88,7 +88,7 @@ describe('Benchmarking DBMs', () => {
8888
}, 220000);
8989

9090
it('Benchmark indexed dbm duckdb', async () => {
91-
await page.goto('http://localhost:4200/indexed-dbm');
91+
await page.goto('http://localhost:4204/indexed-dbm');
9292
/**
9393
* wait for total time to be render
9494
*/
@@ -109,7 +109,7 @@ describe('Benchmarking DBMs', () => {
109109
}, 300000);
110110

111111
it('Benchmark parallel memory dbm duckdb', async () => {
112-
await page.goto('http://localhost:4200/parallel-memory-dbm');
112+
await page.goto('http://localhost:4204/parallel-memory-dbm');
113113
/**
114114
* wait for total time to be render
115115
*/

benchmarking/src/app/dbm-context/parallel-indexed-dbm-context.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export const ParallelIndexedDBMProvider = ({
3737
return;
3838
}
3939
const iframeManager = new IFrameRunnerManager({
40-
runnerURL: 'http://localhost:4200/runner/indexeddb-runner.html',
41-
origin: 'http://localhost:4200',
40+
runnerURL: 'http://localhost:4204/runner/indexeddb-runner.html',
41+
origin: 'http://localhost:4204',
4242
totalRunners: 4,
4343
fetchTableFileBuffers: async (table) => {
4444
return [];

benchmarking/src/app/dbm-context/parallel-memory-dbm-context.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export const ParallelMemoryDBMProvider = ({
3737
return;
3838
}
3939
const iframeManager = new IFrameRunnerManager({
40-
runnerURL: 'http://localhost:4200/runner/memory-runner.html',
41-
origin: 'http://localhost:4200',
40+
runnerURL: 'http://localhost:4204/runner/memory-runner.html',
41+
origin: 'http://localhost:4204',
4242
totalRunners: 4,
4343
fetchTableFileBuffers: async (table) => {
4444
return fileManagerRef.current.getTableBufferData(table);

benchmarking/src/app/file-loader/file-loader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const FileLoader = ({
2020
useClassicEffect(() => {
2121
(async () => {
2222
const file = await axios.get(
23-
'http://localhost:4200/data-sets/fhvhv_tripdata_2023-01.parquet',
23+
'http://localhost:4204/data-sets/fhvhv_tripdata_2023-01.parquet',
2424
{ responseType: 'arraybuffer' }
2525
);
2626
const fileBuffer = file.data;

benchmarking/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default defineConfig({
77
cacheDir: '../node_modules/.vite/benchmarking-app',
88

99
server: {
10-
port: 4200,
10+
port: 4204,
1111
host: 'localhost',
1212
headers: {
1313
'Cross-Origin-Opener-Policy': 'same-origin',

electron-app/.eslintrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"extends": ["../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
},
17+
{
18+
"files": ["*.json"],
19+
"parser": "jsonc-eslint-parser",
20+
"rules": {
21+
"@nx/dependency-checks": "error"
22+
}
23+
}
24+
]
25+
}

electron-app/jest.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* eslint-disable */
2+
export default {
3+
displayName: 'electron-app',
4+
preset: '../jest.preset.js',
5+
testEnvironment: 'node',
6+
transform: {
7+
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
8+
},
9+
moduleFileExtensions: ['ts', 'js', 'html'],
10+
coverageDirectory: '../coverage/electron-app',
11+
};

electron-app/project.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"name": "electron-app",
3+
"$schema": "../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "electron-app/src",
5+
"projectType": "application",
6+
"targets": {
7+
"build": {
8+
"executor": "nx-electron:build",
9+
"outputs": ["{options.outputPath}"],
10+
"options": {
11+
"outputPath": "dist/electron-app",
12+
"main": "electron-app/src/main.ts",
13+
"tsConfig": "electron-app/tsconfig.app.json",
14+
"assets": ["electron-app/src/assets"]
15+
},
16+
"configurations": {
17+
"production": {
18+
"optimization": true,
19+
"extractLicenses": true,
20+
"inspect": false,
21+
"fileReplacements": [
22+
{
23+
"replace": "electron-app/src/environments/environment.ts",
24+
"with": "electron-app/src/environments/environment.prod.ts"
25+
}
26+
]
27+
}
28+
}
29+
},
30+
"serve": {
31+
"executor": "nx-electron:execute",
32+
"options": {
33+
"buildTarget": "electron-app:build"
34+
}
35+
},
36+
"package": {
37+
"executor": "nx-electron:package",
38+
"options": {
39+
"name": "electron-app",
40+
"frontendProject": "benchmarking-app",
41+
"sourcePath": "dist/apps",
42+
"outputPath": "dist/packages",
43+
"prepackageOnly": true
44+
}
45+
},
46+
"make": {
47+
"executor": "nx-electron:make",
48+
"options": {
49+
"name": "electron-app",
50+
"frontendProject": "benchmarking-app",
51+
"sourcePath": "dist/apps",
52+
"outputPath": "dist/executables"
53+
}
54+
},
55+
"lint": {
56+
"executor": "@nx/eslint:lint",
57+
"options": {
58+
"lintFilePatterns": ["electron-app/**/*.ts"]
59+
}
60+
},
61+
"test": {
62+
"executor": "@nx/jest:jest",
63+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
64+
"options": {
65+
"jestConfig": "electron-app/jest.config.ts",
66+
"passWithNoTests": true
67+
},
68+
"configurations": {
69+
"ci": {
70+
"ci": true,
71+
"codeCoverage": true
72+
}
73+
}
74+
}
75+
}
76+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { contextBridge } from 'electron';
2+
3+
contextBridge.exposeInMainWorld('electron', {
4+
platform: process.platform,
5+
});

0 commit comments

Comments
 (0)