mirror of
https://github.com/wavetermdev/backup.git
synced 2026-04-22 15:26:58 -07:00
Compare commits
24 Commits
v0.7.3
...
evan/linux-arm
| Author | SHA1 | Date | |
|---|---|---|---|
| 14b1ee0f75 | |||
| 25788bc30b | |||
| c08b1eb54f | |||
| a1c87e85fa | |||
| 1358fa0d0a | |||
| 95d7f72456 | |||
| 07f176ea53 | |||
| 5c436198af | |||
| 6527659108 | |||
| 01c6c74137 | |||
| 5083c31f99 | |||
| 40d285213a | |||
| 6715865861 | |||
| 0e3692845a | |||
| 12309754fe | |||
| fa295a2bb4 | |||
| 679d336dfd | |||
| c7ab077e55 | |||
| 5add91f960 | |||
| 5b741b570c | |||
| 73187dd06a | |||
| 33fd18c0c6 | |||
| 2a1f8aa4d4 | |||
| e860e330ab |
@@ -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 }}"
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user