Clean up app package (#118)

This commit is contained in:
Evan Simkowitz 2024-07-18 15:16:49 -07:00 committed by GitHub
parent 2a81f19b15
commit 01d61dabec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 250 additions and 62 deletions

View File

@ -13,7 +13,7 @@ tasks:
electron:dev:
desc: Run the Electron application directly.
cmds:
- WAVETERM_DEV=1 yarn dev
- yarn dev
deps:
- generate
- build:server
@ -22,7 +22,7 @@ tasks:
electron:start:
desc: Run the Electron application via the Vite dev server (enables hot reloading).
cmds:
- WAVETERM_DEV=1 yarn start
- yarn start
deps:
- generate
- build:server
@ -31,6 +31,8 @@ tasks:
package:
desc: Package the application for the current platform.
cmds:
- cmd: rm -rf make
ignore_error: true
- yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never
deps:
- generate
@ -62,6 +64,8 @@ tasks:
status:
- exit {{if eq OS "darwin"}}1{{else}}0{{end}}
cmds:
- cmd: rm dist/bin/wavesrv*
ignore_error: true
- task: build:server:internal
vars:
GOARCH: arm64
@ -74,13 +78,14 @@ tasks:
status:
- exit {{if eq OS "darwin"}}0{{else}}1{{end}}
cmds:
- cmd: rm dist/bin/wavesrv*
ignore_error: true
- task: build:server:internal
vars:
GOARCH:
sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
GO_LDFLAGS: -linkmode 'external' -extldflags=-static
build:server:internal:
requires:
vars:
@ -98,7 +103,9 @@ tasks:
build:wsh:
desc: Build the wsh component for all possible targets.
deps:
cmds:
- cmd: rm dist/bin/wsh*
ignore_error: true
- task: build:wsh:internal
vars:
GOOS: darwin

View File

@ -24,6 +24,7 @@ const config = {
to: ".",
filter: ["package.json"],
},
"!node_modules", // We don't need electron-builder to package in Node modules as Vite has already bundled any code that our program is using.
],
directories: {
output: "make",

View File

@ -1,8 +1,10 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import react from "@vitejs/plugin-react";
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "electron-vite";
import flow from "rollup-plugin-flow";
import { ViteImageOptimizer } from "vite-plugin-image-optimizer";
import { viteStaticCopy } from "vite-plugin-static-copy";
import tsconfigPaths from "vite-tsconfig-paths";
@ -17,7 +19,7 @@ export default defineConfig({
},
outDir: "dist/main",
},
plugins: [tsconfigPaths()],
plugins: [tsconfigPaths(), flow()],
resolve: {
alias: {
"@": "frontend",
@ -38,7 +40,7 @@ export default defineConfig({
},
outDir: "dist/preload",
},
plugins: [tsconfigPaths()],
plugins: [tsconfigPaths(), flow()],
},
renderer: {
root: ".",
@ -56,8 +58,10 @@ export default defineConfig({
open: false,
},
plugins: [
react({}),
ViteImageOptimizer(),
tsconfigPaths(),
react({}),
flow(),
viteStaticCopy({
targets: [{ src: "node_modules/monaco-editor/min/vs/*", dest: "monaco" }],
}),

View File

@ -1,6 +1,7 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { WaveDevVarName, WaveDevViteVarName } from "@/util/isdev";
import * as electron from "electron";
import fs from "fs";
import * as child_process from "node:child_process";
@ -12,8 +13,7 @@ import { debounce } from "throttle-debounce";
import * as util from "util";
import winston from "winston";
import * as services from "../frontend/app/store/services";
import { getWebServerEndpoint, WebServerEndpointVarName, WSServerEndpointVarName } from "../frontend/util/endpoints";
import { WaveDevVarName, WaveDevViteVarName } from "../frontend/util/isdev";
import { WSServerEndpointVarName, WebServerEndpointVarName, getWebServerEndpoint } from "../frontend/util/endpoints";
import * as keyutil from "../frontend/util/keyutil";
import { fireAndForget } from "../frontend/util/util";
@ -35,9 +35,15 @@ let globalIsStarting = true;
const isDev = !electron.app.isPackaged;
const isDevVite = isDev && process.env.ELECTRON_RENDERER_URL;
if (isDev) {
process.env[WaveDevVarName] = "1";
}
if (isDevVite) {
process.env[WaveDevViteVarName] = "1";
}
let waveSrvProc: child_process.ChildProcessWithoutNullStreams | null = null;
electronApp.setName(isDev ? "NextWave (Dev)" : "NextWave");
electronApp.setName(isDev ? "TheNextWave (Dev)" : "TheNextWave");
const unamePlatform = process.platform;
let unameArch: string = process.arch;
if (unameArch == "x64") {
@ -127,14 +133,6 @@ function runWaveSrv(): Promise<boolean> {
pResolve = argResolve;
pReject = argReject;
});
if (isDev) {
process.env[WaveDevVarName] = "1";
}
if (isDevVite) {
process.env[WaveDevViteVarName] = "1";
}
const envCopy = { ...process.env };
envCopy[WaveAppPathVarName] = getGoAppBasePath();
envCopy[WaveSrvReadySignalPidVarName] = process.pid.toString();

View File

@ -44,7 +44,7 @@
"@types/throttle-debounce": "^5",
"@types/tinycolor2": "^1",
"@types/uuid": "^9.0.8",
"@vitejs/plugin-react": "^4.3.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"@vitest/coverage-istanbul": "^1.6.0",
"electron": "^31.1.0",
"electron-builder": "^24.13.3",
@ -55,6 +55,7 @@
"prettier": "^3.2.5",
"prettier-plugin-jsdoc": "^1.3.0",
"prettier-plugin-organize-imports": "^3.2.4",
"rollup-plugin-flow": "^1.1.1",
"storybook": "^8.1.10",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
@ -62,6 +63,7 @@
"typescript": "^5.4.5",
"typescript-eslint": "^7.8.0",
"vite": "^5.0.0",
"vite-plugin-image-optimizer": "^1.1.8",
"vite-plugin-static-copy": "^1.0.5",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0"

260
yarn.lock
View File

@ -74,7 +74,7 @@ __metadata:
languageName: node
linkType: hard
"@babel/core@npm:^7.18.9, @babel/core@npm:^7.23.0, @babel/core@npm:^7.23.9, @babel/core@npm:^7.24.4, @babel/core@npm:^7.24.5":
"@babel/core@npm:^7.18.9, @babel/core@npm:^7.23.0, @babel/core@npm:^7.23.9, @babel/core@npm:^7.24.4":
version: 7.24.6
resolution: "@babel/core@npm:7.24.6"
dependencies:
@ -1345,28 +1345,6 @@ __metadata:
languageName: node
linkType: hard
"@babel/plugin-transform-react-jsx-self@npm:^7.24.5":
version: 7.24.6
resolution: "@babel/plugin-transform-react-jsx-self@npm:7.24.6"
dependencies:
"@babel/helper-plugin-utils": "npm:^7.24.6"
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: 10c0/df136207167fd7a87c70235ef17a8d6c15f9704b979a00260d7babd6d71c3fdfc01a624335e10bdfbde0654cc35a1d9120d54b11697d10670472230a8fdbdb06
languageName: node
linkType: hard
"@babel/plugin-transform-react-jsx-source@npm:^7.24.1":
version: 7.24.6
resolution: "@babel/plugin-transform-react-jsx-source@npm:7.24.6"
dependencies:
"@babel/helper-plugin-utils": "npm:^7.24.6"
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: 10c0/1fa643bc8ca6a404835d07fc219bb74304aec549b30f68f31cef6a5227f44badb8fc208f46e4c9231da480e29e62b42a7567a7c9e0b9b7db6ac3643a3b11e40b
languageName: node
linkType: hard
"@babel/plugin-transform-regenerator@npm:^7.24.6":
version: 7.24.6
resolution: "@babel/plugin-transform-regenerator@npm:7.24.6"
@ -3992,6 +3970,138 @@ __metadata:
languageName: node
linkType: hard
"@swc/core-darwin-arm64@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-darwin-arm64@npm:1.7.0"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard
"@swc/core-darwin-x64@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-darwin-x64@npm:1.7.0"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard
"@swc/core-linux-arm-gnueabihf@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.7.0"
conditions: os=linux & cpu=arm
languageName: node
linkType: hard
"@swc/core-linux-arm64-gnu@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-linux-arm64-gnu@npm:1.7.0"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard
"@swc/core-linux-arm64-musl@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-linux-arm64-musl@npm:1.7.0"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard
"@swc/core-linux-x64-gnu@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-linux-x64-gnu@npm:1.7.0"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard
"@swc/core-linux-x64-musl@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-linux-x64-musl@npm:1.7.0"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard
"@swc/core-win32-arm64-msvc@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-win32-arm64-msvc@npm:1.7.0"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard
"@swc/core-win32-ia32-msvc@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-win32-ia32-msvc@npm:1.7.0"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard
"@swc/core-win32-x64-msvc@npm:1.7.0":
version: 1.7.0
resolution: "@swc/core-win32-x64-msvc@npm:1.7.0"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
"@swc/core@npm:^1.5.7":
version: 1.7.0
resolution: "@swc/core@npm:1.7.0"
dependencies:
"@swc/core-darwin-arm64": "npm:1.7.0"
"@swc/core-darwin-x64": "npm:1.7.0"
"@swc/core-linux-arm-gnueabihf": "npm:1.7.0"
"@swc/core-linux-arm64-gnu": "npm:1.7.0"
"@swc/core-linux-arm64-musl": "npm:1.7.0"
"@swc/core-linux-x64-gnu": "npm:1.7.0"
"@swc/core-linux-x64-musl": "npm:1.7.0"
"@swc/core-win32-arm64-msvc": "npm:1.7.0"
"@swc/core-win32-ia32-msvc": "npm:1.7.0"
"@swc/core-win32-x64-msvc": "npm:1.7.0"
"@swc/counter": "npm:^0.1.3"
"@swc/types": "npm:^0.1.9"
peerDependencies:
"@swc/helpers": "*"
dependenciesMeta:
"@swc/core-darwin-arm64":
optional: true
"@swc/core-darwin-x64":
optional: true
"@swc/core-linux-arm-gnueabihf":
optional: true
"@swc/core-linux-arm64-gnu":
optional: true
"@swc/core-linux-arm64-musl":
optional: true
"@swc/core-linux-x64-gnu":
optional: true
"@swc/core-linux-x64-musl":
optional: true
"@swc/core-win32-arm64-msvc":
optional: true
"@swc/core-win32-ia32-msvc":
optional: true
"@swc/core-win32-x64-msvc":
optional: true
peerDependenciesMeta:
"@swc/helpers":
optional: true
checksum: 10c0/8c98bd94dcf1bb002c84cbb66cce7c656f5e71c8bbe439669af9c24a3d58f7c768b8cdd8d779f9683d9beb14bac1ce56a231b0ebf1f5b24563e7fac46cd5dbb7
languageName: node
linkType: hard
"@swc/counter@npm:^0.1.3":
version: 0.1.3
resolution: "@swc/counter@npm:0.1.3"
checksum: 10c0/8424f60f6bf8694cfd2a9bca45845bce29f26105cda8cf19cdb9fd3e78dc6338699e4db77a89ae449260bafa1cc6bec307e81e7fb96dbf7dcfce0eea55151356
languageName: node
linkType: hard
"@swc/types@npm:^0.1.9":
version: 0.1.9
resolution: "@swc/types@npm:0.1.9"
dependencies:
"@swc/counter": "npm:^0.1.3"
checksum: 10c0/e47db2a06189f100696837ac3d56feaf67e8e68541b236c2de497e066689230f5cbb538fc0ca77c04739ae7653c20a2d79c7ab57ecf7506e2d008cb5e523f724
languageName: node
linkType: hard
"@szmarczak/http-timer@npm:^4.0.5":
version: 4.0.6
resolution: "@szmarczak/http-timer@npm:4.0.6"
@ -4136,7 +4246,7 @@ __metadata:
languageName: node
linkType: hard
"@types/babel__core@npm:^7.18.0, @types/babel__core@npm:^7.20.5":
"@types/babel__core@npm:^7.18.0":
version: 7.20.5
resolution: "@types/babel__core@npm:7.20.5"
dependencies:
@ -4777,18 +4887,14 @@ __metadata:
languageName: node
linkType: hard
"@vitejs/plugin-react@npm:^4.3.0":
version: 4.3.0
resolution: "@vitejs/plugin-react@npm:4.3.0"
"@vitejs/plugin-react-swc@npm:^3.7.0":
version: 3.7.0
resolution: "@vitejs/plugin-react-swc@npm:3.7.0"
dependencies:
"@babel/core": "npm:^7.24.5"
"@babel/plugin-transform-react-jsx-self": "npm:^7.24.5"
"@babel/plugin-transform-react-jsx-source": "npm:^7.24.1"
"@types/babel__core": "npm:^7.20.5"
react-refresh: "npm:^0.14.2"
"@swc/core": "npm:^1.5.7"
peerDependencies:
vite: ^4.2.0 || ^5.0.0
checksum: 10c0/38ef4c4b7fd626d3b47b5498bd248967eed970099c97f051f29dbe9f72792a4f511ccb10f664dff865c595526ab7265eda5837852bc82bb56a24030302eb23e3
vite: ^4 || ^5
checksum: 10c0/f9f562c87f0fd384d160c5d499056841f8a38050fc01f5295d3394a77c288eca1f78f6df3aa08c01f3f5cb3e4937c6490607ac87b700d87bab425b7c4dc15e91
languageName: node
linkType: hard
@ -5074,6 +5180,13 @@ __metadata:
languageName: node
linkType: hard
"ansi-colors@npm:^4.1.3":
version: 4.1.3
resolution: "ansi-colors@npm:4.1.3"
checksum: 10c0/ec87a2f59902f74e61eada7f6e6fe20094a628dab765cfdbd03c3477599368768cffccdb5d3bb19a1b6c99126783a143b1fee31aab729b31ffe5836c7e5e28b9
languageName: node
linkType: hard
"ansi-regex@npm:^5.0.1":
version: 5.0.1
resolution: "ansi-regex@npm:5.0.1"
@ -5372,6 +5485,15 @@ __metadata:
languageName: node
linkType: hard
"babylon@npm:^6.15.0":
version: 6.18.0
resolution: "babylon@npm:6.18.0"
bin:
babylon: ./bin/babylon.js
checksum: 10c0/9b1bf946e16782deadb1f5414c1269efa6044eb1e97a3de2051f09a3f2a54e97be3542d4242b28d23de0ef67816f519d38ce1ec3ddb7be306131c39a60e5a667
languageName: node
linkType: hard
"bail@npm:^2.0.0":
version: 2.0.2
resolution: "bail@npm:2.0.2"
@ -7666,6 +7788,13 @@ __metadata:
languageName: node
linkType: hard
"estree-walker@npm:^0.2.1":
version: 0.2.1
resolution: "estree-walker@npm:0.2.1"
checksum: 10c0/5a7285ba6f4fd29d5ac112fdf3950929b2a52805b6683329355cbddf40edf08b52e6c9a4be28b5426e694d54f8b4594478eb66005b9fea641f18fa427e7888c8
languageName: node
linkType: hard
"estree-walker@npm:^2.0.2":
version: 2.0.2
resolution: "estree-walker@npm:2.0.2"
@ -8007,6 +8136,19 @@ __metadata:
languageName: node
linkType: hard
"flow-remove-types@npm:^1.1.0":
version: 1.2.3
resolution: "flow-remove-types@npm:1.2.3"
dependencies:
babylon: "npm:^6.15.0"
vlq: "npm:^0.2.1"
bin:
flow-node: ./flow-node
flow-remove-types: ./flow-remove-types
checksum: 10c0/df11795c056e80fea684e715448c83f6d23114c67d3a78370a7a97030c17518bff81484b11d5cf765a19134e2fbe05d075188972aa2e7aa30c79167de237d1eb
languageName: node
linkType: hard
"fn.name@npm:1.x.x":
version: 1.1.0
resolution: "fn.name@npm:1.1.0"
@ -12026,13 +12168,6 @@ __metadata:
languageName: node
linkType: hard
"react-refresh@npm:^0.14.2":
version: 0.14.2
resolution: "react-refresh@npm:0.14.2"
checksum: 10c0/875b72ef56b147a131e33f2abd6ec059d1989854b3ff438898e4f9310bfcc73acff709445b7ba843318a953cb9424bcc2c05af2b3d80011cee28f25aef3e2ebb
languageName: node
linkType: hard
"react-remove-scroll-bar@npm:^2.3.3":
version: 2.3.6
resolution: "react-remove-scroll-bar@npm:2.3.6"
@ -12481,6 +12616,26 @@ __metadata:
languageName: node
linkType: hard
"rollup-plugin-flow@npm:^1.1.1":
version: 1.1.1
resolution: "rollup-plugin-flow@npm:1.1.1"
dependencies:
flow-remove-types: "npm:^1.1.0"
rollup-pluginutils: "npm:^1.5.1"
checksum: 10c0/5dbf9820657cff23efca56d033a80356fc74e0673b2610e165517e8816d087b94f46625cf52386e215f9ec99c029a1e0d785072b44351f95ede9a0e6cef5015d
languageName: node
linkType: hard
"rollup-pluginutils@npm:^1.5.1":
version: 1.5.2
resolution: "rollup-pluginutils@npm:1.5.2"
dependencies:
estree-walker: "npm:^0.2.1"
minimatch: "npm:^3.0.2"
checksum: 10c0/dd116e92b66432b987fb0cb1bb71ec7317ec4fa5fe9673a98498fd966e94daef9dc6f34deee204b17bb9438f05b8dfa370bb03e83e06af9e377e4ab9c83b048a
languageName: node
linkType: hard
"rollup@npm:^4.13.0":
version: 4.17.2
resolution: "rollup@npm:4.17.2"
@ -13339,7 +13494,7 @@ __metadata:
"@types/throttle-debounce": "npm:^5"
"@types/tinycolor2": "npm:^1"
"@types/uuid": "npm:^9.0.8"
"@vitejs/plugin-react": "npm:^4.3.0"
"@vitejs/plugin-react-swc": "npm:^3.7.0"
"@vitest/coverage-istanbul": "npm:^1.6.0"
"@xterm/addon-fit": "npm:^0.10.0"
"@xterm/addon-serialize": "npm:^0.13.0"
@ -13372,6 +13527,7 @@ __metadata:
react-markdown: "npm:^9.0.1"
rehype-raw: "npm:^7.0.0"
remark-gfm: "npm:^4.0.0"
rollup-plugin-flow: "npm:^1.1.1"
rxjs: "npm:^7.8.1"
sprintf-js: "npm:^1.1.3"
storybook: "npm:^8.1.10"
@ -13385,6 +13541,7 @@ __metadata:
use-device-pixel-ratio: "npm:^1.1.2"
uuid: "npm:^9.0.1"
vite: "npm:^5.0.0"
vite-plugin-image-optimizer: "npm:^1.1.8"
vite-plugin-static-copy: "npm:^1.0.5"
vite-tsconfig-paths: "npm:^4.3.2"
vitest: "npm:^1.6.0"
@ -14148,6 +14305,18 @@ __metadata:
languageName: node
linkType: hard
"vite-plugin-image-optimizer@npm:^1.1.8":
version: 1.1.8
resolution: "vite-plugin-image-optimizer@npm:1.1.8"
dependencies:
ansi-colors: "npm:^4.1.3"
pathe: "npm:^1.1.2"
peerDependencies:
vite: ">=3"
checksum: 10c0/1631e0a1604b42b12348b99ecf86565f06e3e3ccd2ce3be8c2b9ac85e3292c5ec6101130b4860424e06932c81c5b7fcc2540504d8b7bc73aa4e08e0eb5073247
languageName: node
linkType: hard
"vite-plugin-static-copy@npm:^1.0.5":
version: 1.0.5
resolution: "vite-plugin-static-copy@npm:1.0.5"
@ -14268,6 +14437,13 @@ __metadata:
languageName: node
linkType: hard
"vlq@npm:^0.2.1":
version: 0.2.3
resolution: "vlq@npm:0.2.3"
checksum: 10c0/d1557b404353ca75c7affaaf403d245a3273a7d1c6b3380ed7f04ae3f080e4658f41ac700d6f48acb3cd4875fe7bc7da4924b3572cd5584a5de83b35b1de5e12
languageName: node
linkType: hard
"watchpack@npm:^2.2.0":
version: 2.4.1
resolution: "watchpack@npm:2.4.1"