Compare commits

...

24 Commits

Author SHA1 Message Date
Evan Simkowitz 14b1ee0f75 blah 2024-03-01 18:47:05 -08:00
Evan Simkowitz 25788bc30b test 2024-03-01 18:21:34 -08:00
Evan Simkowitz c08b1eb54f remove large 2024-03-01 18:10:25 -08:00
Evan Simkowitz a1c87e85fa test more 2024-03-01 18:08:02 -08:00
Evan Simkowitz 1358fa0d0a iterate array 2024-03-01 18:01:07 -08:00
Evan Simkowitz 95d7f72456 okay let's see what happens 2024-03-01 17:58:59 -08:00
Evan Simkowitz 07f176ea53 save work 2024-03-01 16:21:18 -08:00
Evan Simkowitz 5c436198af add bin to packagerConfig 2024-03-01 12:24:07 -08:00
Evan Simkowitz 6527659108 save work 2024-02-29 14:56:23 -08:00
Evan Simkowitz 01c6c74137 save rpm info 2024-02-29 13:55:49 -08:00
Evan Simkowitz 5083c31f99 update package info 2024-02-29 13:49:08 -08:00
Evan Simkowitz 40d285213a add command to flatten directory structure 2024-02-29 13:03:40 -08:00
Evan Simkowitz 6715865861 remove flatpak for now 2024-02-29 12:42:56 -08:00
Evan Simkowitz 0e3692845a test adding dev dependencies 2024-02-29 12:30:11 -08:00
Evan Simkowitz 12309754fe test flatpak 2024-02-29 12:23:44 -08:00
Evan Simkowitz fa295a2bb4 add bin to both 2024-02-29 12:08:14 -08:00
Evan Simkowitz 679d336dfd use bin 2024-02-29 12:02:03 -08:00
Evan Simkowitz c7ab077e55 add exec name 2024-02-29 11:59:22 -08:00
Evan Simkowitz 5add91f960 remove v from version 2024-02-29 11:53:35 -08:00
Evan Simkowitz 5b741b570c add description 2024-02-29 11:49:14 -08:00
Evan Simkowitz 73187dd06a blah 2024-02-29 11:44:02 -08:00
Evan Simkowitz 33fd18c0c6 remove eu-strip 2024-02-29 11:36:37 -08:00
Evan Simkowitz 2a1f8aa4d4 missed some 2024-02-29 11:32:30 -08:00
Evan Simkowitz e860e330ab Add linux makers 2024-02-29 11:32:24 -08:00
9 changed files with 968 additions and 131 deletions
+89 -17
View File
@@ -11,15 +11,15 @@ jobs:
matrix:
include:
- platform: "darwin"
arch: "x64"
runner: "macos-latest"
scripthaus: "build-package"
- platform: "darwin"
arch: "arm64"
arch: "universal"
runner: "macos-latest-xlarge"
scripthaus: "build-package"
- platform: "linux"
arch: "x64"
arch: "arm64"
runner: "ubuntu-latest"
scripthaus: "build-package-linux"
- platform: "linux"
arch: "amd64"
runner: "ubuntu-latest"
scripthaus: "build-package-linux"
runs-on: ${{ matrix.runner }}
@@ -29,6 +29,11 @@ jobs:
with:
repository: scripthaus-dev/scripthaus
path: scripthaus
- name: Install Linux Build Dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install rpm flatpak flatpak-builder snapcraft
- uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
@@ -36,7 +41,8 @@ jobs:
wavesrv/go.sum
waveshell/go.sum
scripthaus/go.sum
- run: |
- name: Install Scripthaus
run: |
go work use ./scripthaus;
cd scripthaus;
go get ./...;
@@ -45,30 +51,96 @@ jobs:
with:
node-version: ${{env.NODE_VERSION}}
cache: "yarn"
- id: set-version
- name: Set Version
id: set-version
run: |
VERSION=$(node -e 'console.log(require("./version.js"))')
echo "WAVETERM_VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
- run: yarn --frozen-lockfile
- run: ./scripthaus/scripthaus run ${{ matrix.scripthaus }}
- name: Install Yarn Dependencies
run: yarn --frozen-lockfile
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
run: ./scripthaus/scripthaus run ${{ matrix.scripthaus }}
env:
GOARCH: ${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: waveterm-build-${{ matrix.platform }}-${{ matrix.arch }}
path: out/make/zip/${{ matrix.platform }}/${{ matrix.arch }}/*.zip
name: waveterm-build-${{ matrix.platform }}
path: out/make/*
retention-days: 2
runbuild-linux-arm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: scripthaus-dev/scripthaus
path: scripthaus
- name: Install Linux Build Dependencies
run: |
sudo apt-get update
sudo apt-get install rpm flatpak flatpak-builder snapcraft
- uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: |
wavesrv/go.sum
waveshell/go.sum
scripthaus/go.sum
- name: Install Scripthaus
run: |
go work use ./scripthaus;
cd scripthaus;
go get ./...;
CGO_ENABLED=1 go build -o scripthaus cmd/main.go
- uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
cache: "yarn"
- name: Set Version
id: set-version
run: |
VERSION=$(node -e 'console.log(require("./version.js"))')
echo "WAVETERM_VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Install Yarn Dependencies
run: yarn --frozen-lockfile
- name: Build linux/arm64
uses: pguyot/arm-runner-action@v2
with:
image_additional_mb: 2000
base_image: dietpi:rpi_armv8_bullseye
bind_mount_repository: true
commands: |
sudo apt-get update && sudo apt-get install -y snapd git
sudo snap install --classic go
git clone
- uses: actions/upload-artifact@v4
with:
name: waveterm-build-linux-arm
path: out/make/*
retention-days: 2
upload:
name: "Upload Builds"
runs-on: ubuntu-latest
needs: [runbuild]
needs: [runbuild, runbuild-linux-arm]
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: buildtemp
- run: |
path: download
- name: Move builds into buildtemp
run: |
mkdir buildtemp
# Will only move over the files, flattening the directory structure
find download -mindepth 2 -type f -exec mv -t buildtemp -i '{}' +
- name: Set `version.txt`
run: |
echo "${{ needs.runbuild.outputs.WAVETERM_VERSION }}" > buildtemp/version.txt
- run: (cd buildtemp; zip ../waveterm-builds.zip *)
- run: aws s3 cp waveterm-builds.zip s3://waveterm-github-artifacts/
- name: Zip Builds
run: (cd buildtemp; zip ../waveterm-builds.zip *)
- name: Upload to S3
run: aws s3 cp waveterm-builds.zip s3://waveterm-github-artifacts/
env:
AWS_ACCESS_KEY_ID: "${{ secrets.S3_USERID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.S3_SECRETKEY }}"
+1 -1
View File
@@ -9,7 +9,7 @@
# Wave Terminal
A open-source, cross-platform, AI-integrated, modern terminal for seamless workflows.
An open-source, cross-platform, AI-integrated, modern terminal for seamless workflows.
Wave isn't just another terminal emulator; it's a rethink on how terminals are built. Wave combines command line with the power of the open web to help veteran CLI users and new developers alike.
+24
View File
@@ -0,0 +1,24 @@
sudo apt-get update && sudo apt-get install -y snapd git
sudo snap install --classic go && sudo snap install --classic yarn
rm -rf dist/
rm -rf bin/
rm -rf build/
node_modules/.bin/webpack --env prod
WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))')
WAVESHELL_VERSION=v0.4
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
function buildWaveShell {
(cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go)
}
function buildWaveSrv {
# adds -extldflags=-static, *only* on linux (macos does not support fully static binaries) to avoid a glibc dependency
(cd wavesrv; CGO_ENABLED=1 GOARCH=$1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-linkmode 'external' -extldflags=-static $GO_LDFLAGS -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$1 ./cmd)
}
buildWaveShell darwin amd64
buildWaveShell darwin arm64
buildWaveShell linux amd64
buildWaveShell linux arm64
buildWaveSrv $GOARCH
yarn run electron-builder -c electron-builder.config.js -l
+71
View File
@@ -0,0 +1,71 @@
const pkg = require("./package.json");
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const config = {
artifactName: "${productName}-${version}-${arch}.${ext}",
npmRebuild: false,
nodeGypRebuild: false,
electronCompile: false,
publish: null,
files: [
{
from: "./dist",
to: "./dist",
filter: ["**/*"],
},
{
from: "./public",
to: "./public",
filter: ["**/*"],
},
{
from: "./bin",
to: "./bin",
filter: ["**/*"],
},
{
from: ".",
to: ".",
filter: ["package.json"],
},
"!**/node_modules/**${/*}", // Ignore node_modules by default
{
from: "./node_modules",
to: "./node_modules",
filter: ["monaco-editor/min/**/*"], // This is the only module we want to include
},
],
directories: {
output: "make",
},
appId: pkg.build.appId,
productName: pkg.productName,
mac: {
target: {
target: "zip",
arch: "universal",
},
icon: "public/waveterm.icns",
category: "public.app-category.developer-tools",
minimumSystemVersion: "10.15.0",
asarUnpack: ["bin/**/*"],
},
linux: {
executableName: pkg.productName,
category: "TerminalEmulator",
icon: "public/waveterm.icns",
target: ["zip", "deb"],
asar: false,
desktop: {
Name: pkg.productName,
Comment: pkg.description,
Keywords: "developer;terminal;emulator;",
category: "Development;Utility;",
},
},
};
module.exports = config;
+59 -8
View File
@@ -1,4 +1,5 @@
var AllowedFirstParts = {
const pkg = require("./package.json");
let AllowedFirstParts = {
"package.json": true,
dist: true,
public: true,
@@ -6,11 +7,11 @@ var AllowedFirstParts = {
bin: true,
};
var AllowedNodeModules = {
let AllowedNodeModules = {
"monaco-editor": true,
};
var modCache = {};
let modCache = {};
function ignoreFn(path) {
let parts = path.split("/");
@@ -47,11 +48,7 @@ function ignoreFn(path) {
module.exports = {
packagerConfig: {
ignore: ignoreFn,
files: [
"package.json",
"dist/*",
"public/*",
],
files: ["package.json", "dist/*", "public/*", "bin/*"],
icon: "public/waveterm.icns",
},
rebuildConfig: {},
@@ -60,5 +57,59 @@ module.exports = {
name: "@electron-forge/maker-zip",
platforms: ["darwin", "linux"],
},
{
name: "@electron-forge/maker-deb",
config: {
options: {
bin: pkg.productName,
name: pkg.name,
genericName: "Terminal Emulator",
productName: pkg.productName,
productDescription: pkg.description,
icon: "public/waveterm.icns",
categories: ["Utility", "Development"],
maintainer: pkg.author,
homepage: pkg.homepage,
license: pkg.license,
version: pkg.version,
},
},
},
{
name: "@electron-forge/maker-rpm",
config: {
options: {
bin: pkg.productName,
name: pkg.name,
genericName: "Terminal Emulator",
productName: pkg.productName,
description: pkg.description,
productDescription: pkg.description,
icon: "public/waveterm.icns",
categories: ["Utility", "Development"],
license: pkg.license,
version: pkg.version,
},
},
},
// {
// name: "@electron-forge/maker-flatpak",
// config: {
// options: {
// bin: pkg.productName,
// mimeType: ["text/plain"],
// },
// },
// },
// {
// name: "@electron-forge/maker-snap",
// config: {
// features: {
// audio: true,
// mpris: "com.commandline.waveterm",
// webgl: true,
// },
// },
// },
],
};
+23 -8
View File
@@ -1,10 +1,22 @@
{
"name": "waveterm",
"author": "Command Line Inc",
"author": {
"name": "Command Line Inc",
"email": "info@commandline.dev"
},
"productName": "Wave",
"version": "v0.6.1",
"description": "An open-source, cross-platform, AI-integrated, modern terminal for seamless workflows.",
"version": "0.6.1",
"main": "dist/emain.js",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/wavetermdev/waveterm"
},
"homepage": "https://waveterm.dev",
"build": {
"appId": "dev.commandline.waveterm"
},
"dependencies": {
"@monaco-editor/react": "^4.5.1",
"@table-nav/core": "^0.0.7",
@@ -51,12 +63,12 @@
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.17.12",
"@electron-forge/cli": "^7.2.0",
"@electron-forge/maker-deb": "^7.2.0",
"@electron-forge/maker-rpm": "^7.2.0",
"@electron-forge/maker-deb": "^7.3.0",
"@electron-forge/maker-flatpak": "^7.3.0",
"@electron-forge/maker-rpm": "^7.3.0",
"@electron-forge/maker-snap": "^7.2.0",
"@electron-forge/maker-squirrel": "^7.2.0",
"@electron-forge/maker-zip": "^7.2.0",
"@electron/rebuild": "^3.4.0",
"@electron-forge/maker-zip": "^7.3.0",
"@svgr/webpack": "^8.1.0",
"@types/classnames": "^2.3.1",
"@types/electron": "^1.6.10",
@@ -72,6 +84,7 @@
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.1",
"electron": "29.0.1",
"electron-builder": "^24.12.0",
"file-loader": "^6.2.0",
"http-server": "^14.1.1",
"less": "^4.1.2",
@@ -89,5 +102,7 @@
"webpack-dev-server": "^4.9.1",
"webpack-merge": "^5.8.0"
},
"scripts": {}
}
"scripts": {
"postinstall": "electron-builder install-app-deps"
}
}
+37 -24
View File
@@ -44,13 +44,21 @@ rm -rf bin/
rm -rf build/
node_modules/.bin/webpack --env prod
WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))')
WAVESHELL_VERSION=v0.4
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
(cd waveshell; CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.amd64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.arm64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.amd64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.arm64 main-waveshell.go)
(cd wavesrv; CGO_ENABLED=1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv ./cmd)
node_modules/.bin/electron-forge make
function buildWaveShell {
(cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go)
}
function buildWaveSrv {
(cd wavesrv; CGO_ENABLED=1 GOARCH=$1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$1 ./cmd)
}
buildWaveShell darwin amd64
buildWaveShell darwin arm64
buildWaveShell linux amd64
buildWaveShell linux arm64
buildWaveSrv arm64
buildWaveSrv amd64
yarn run electron-builder -c electron-builder.config.js -m
```
```bash
@@ -61,38 +69,43 @@ rm -rf bin/
rm -rf build/
node_modules/.bin/webpack --env prod
WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))')
WAVESHELL_VERSION=v0.4
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
(cd waveshell; CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.amd64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.arm64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.amd64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.arm64 main-waveshell.go)
# adds -extldflags=-static, *only* on linux (macos does not support fully static binaries) to avoid a glibc dependency
(cd wavesrv; CGO_ENABLED=1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-linkmode 'external' -extldflags=-static $GO_LDFLAGS -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv ./cmd)
node_modules/.bin/electron-forge make
```
```bash
# @scripthaus command open-electron-package
# @scripthaus cd :playbook
open out/Wave-darwin-x64/Wave.app
function buildWaveShell {
(cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go)
}
function buildWaveSrv {
# adds -extldflags=-static, *only* on linux (macos does not support fully static binaries) to avoid a glibc dependency
(cd wavesrv; CGO_ENABLED=1 GOARCH=$1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-linkmode 'external' -extldflags=-static $GO_LDFLAGS -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$1 ./cmd)
}
buildWaveShell darwin amd64
buildWaveShell darwin arm64
buildWaveShell linux amd64
buildWaveShell linux arm64
buildWaveSrv $GOARCH
yarn run electron-builder -c electron-builder.config.js -l
```
```bash
# @scripthaus command build-wavesrv
WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))')
cd wavesrv
CGO_ENABLED=1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv ./cmd
CGO_ENABLED=1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$GOARCH ./cmd
```
```bash
# @scripthaus command fullbuild-waveshell
set -e
cd waveshell
WAVESHELL_VERSION=v0.4
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.amd64 main-waveshell.go
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.arm64 main-waveshell.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.amd64 main-waveshell.go
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.arm64 main-waveshell.go
function buildWaveShell {
(cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go)
}
buildWaveShell darwin amd64
buildWaveShell darwin arm64
buildWaveShell linux amd64
buildWaveShell linux arm64
```
```bash
+37 -21
View File
@@ -69,9 +69,10 @@ function log(...msg: any[]) {
console.log = log;
console.log(
sprintf(
"waveterm-app starting, WAVETERM_HOME=%s, apppath=%s arch=%s/%s",
"waveterm-app starting, WAVETERM_HOME=%s, electronpath=%s gopath=%s arch=%s/%s",
waveHome,
getAppBasePath(),
getElectronAppBasePath(),
getGoAppBasePath(),
unamePlatform,
unameArch
)
@@ -130,31 +131,46 @@ function checkPromptMigrate() {
}
}
// for dev, this is just the waveterm directory
// for prod, this is .../Wave.app/Contents/Resources/app
function getAppBasePath() {
/**
* Gets the base path to the Electron app resources. For dev, this is the root of the project. For packaged apps, this is the app.asar archive.
* @returns The base path of the Electron application
*/
function getElectronAppBasePath(): string {
return path.dirname(__dirname);
}
function getBaseHostPort() {
/**
* Gets the base path to the Go backend. If the app is packaged as an asar, the path will be in a separate unpacked directory.
* @returns The base path of the Go backend
*/
function getGoAppBasePath(): string {
const appDir = getElectronAppBasePath();
if (appDir.endsWith(".asar")) {
return `${appDir}.unpacked`;
} else {
return appDir;
}
}
function getBaseHostPort(): string {
if (isDev) {
return DevServerEndpoint;
}
return ProdServerEndpoint;
}
function getWaveSrvPath() {
return path.join(getAppBasePath(), "bin", "wavesrv");
function getWaveSrvPath(): string {
return path.join(getGoAppBasePath(), "bin", `wavesrv.${unameArch}`);
}
function getWaveSrvCmd() {
function getWaveSrvCmd(): string {
const waveSrvPath = getWaveSrvPath();
const waveHome = getWaveHomeDir();
const logFile = path.join(waveHome, "wavesrv.log");
return `"${waveSrvPath}" >> "${logFile}" 2>&1`;
}
function getWaveSrvCwd() {
function getWaveSrvCwd(): string {
return getWaveHomeDir();
}
@@ -162,7 +178,7 @@ function ensureDir(dir: fs.PathLike) {
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
}
function readAuthKey() {
function readAuthKey(): string {
const homeDir = getWaveHomeDir();
const authKeyFileName = path.join(homeDir, AuthKeyFile);
if (!fs.existsSync(authKeyFileName)) {
@@ -259,7 +275,7 @@ electron.Menu.setApplicationMenu(menu);
let MainWindow: Electron.BrowserWindow | null = null;
function getMods(input: any) {
function getMods(input: any): object {
return { meta: input.meta, shift: input.shift, ctrl: input.control, alt: input.alt };
}
@@ -291,7 +307,7 @@ function shFrameNavHandler(event: Electron.Event<Electron.WebContentsWillFrameNa
console.log("frame navigation canceled");
}
function createMainWindow(clientData: ClientDataType | null) {
function createMainWindow(clientData: ClientDataType | null): Electron.BrowserWindow {
const bounds = calcBounds(clientData);
setKeyUtilPlatform(platform());
const win = new electron.BrowserWindow({
@@ -305,11 +321,11 @@ function createMainWindow(clientData: ClientDataType | null) {
transparent: true,
icon: unamePlatform == "linux" ? "public/logos/wave-logo-dark.png" : undefined,
webPreferences: {
preload: path.join(getAppBasePath(), DistDir, "preload.js"),
preload: path.join(getElectronAppBasePath(), DistDir, "preload.js"),
},
});
const indexHtml = isDev ? "index-dev.html" : "index.html";
win.loadFile(path.join(getAppBasePath(), "public", indexHtml));
win.loadFile(path.join(getElectronAppBasePath(), "public", indexHtml));
win.webContents.on("before-input-event", (e, input) => {
const waveEvent = adaptFromElectronKeyEvent(input);
if (win.isFocused()) {
@@ -450,7 +466,7 @@ function mainResizeHandler(_: any, win: Electron.BrowserWindow) {
});
}
function calcBounds(clientData: ClientDataType) {
function calcBounds(clientData: ClientDataType): Electron.Rectangle {
const primaryDisplay = electron.screen.getPrimaryDisplay();
const pdBounds = primaryDisplay.bounds;
const size = { x: 100, y: 100, width: pdBounds.width - 200, height: pdBounds.height - 200 };
@@ -572,7 +588,7 @@ function readLastLinesOfFile(filePath: string, lineCount: number) {
});
}
function getContextMenu(): any {
function getContextMenu(): electron.Menu {
const menu = new electron.Menu();
const menuItem = new electron.MenuItem({ label: "Testing", click: () => console.log("click testing!") });
menu.append(menuItem);
@@ -585,7 +601,7 @@ function getFetchHeaders() {
};
}
async function getClientDataPoll(loopNum: number) {
async function getClientDataPoll(loopNum: number): Promise<ClientDataType | null> {
const lastTime = loopNum >= 6;
const cdata = await getClientData(!lastTime, loopNum);
if (lastTime || cdata != null) {
@@ -595,7 +611,7 @@ async function getClientDataPoll(loopNum: number) {
return getClientDataPoll(loopNum + 1);
}
async function getClientData(willRetry: boolean, retryNum: number) {
async function getClientData(willRetry: boolean, retryNum: number): Promise<ClientDataType | null> {
const url = new URL(getBaseHostPort() + "/api/get-client-data");
const fetchHeaders = getFetchHeaders();
return fetch(url, { headers: fetchHeaders })
@@ -634,13 +650,13 @@ function runWaveSrv() {
pReject = argReject;
});
const envCopy = { ...process.env };
envCopy[WaveAppPathVarName] = getAppBasePath();
envCopy[WaveAppPathVarName] = getGoAppBasePath();
if (isDev) {
envCopy[WaveDevVarName] = "1";
}
const waveSrvCmd = getWaveSrvCmd();
console.log("trying to run local server", waveSrvCmd);
const proc = child_process.spawn("bash", ["-c", waveSrvCmd], {
const proc = child_process.execFile("bash", ["-c", waveSrvCmd], {
cwd: getWaveSrvCwd(),
env: envCopy,
});
+627 -52
View File
File diff suppressed because it is too large Load Diff