From 505ab56ef4d9f5c8a88546e705148725dd35484c Mon Sep 17 00:00:00 2001 From: Tracy Miranda Date: Sat, 28 Oct 2023 16:16:50 -0400 Subject: [PATCH 1/5] PE 178 Add OSS files (#50) * Add contribution guide * Format improvements * Add security guidelines * Create CODE_OF_CONDUCT.md * Add README.md --- BUILD.md | 7 +- CODE_OF_CONDUCT.md | 128 ++++++++++++++++++ CONTRIBUTING.md | 47 +++++++ README.md | 50 +++++++ SECURITY.md | 5 + .../wave-logo_horizontal-coloronblack.svg | 50 +++++++ .../wave-logo_horizontal-coloronwhite.svg | 50 +++++++ 7 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 SECURITY.md create mode 100644 src/app/assets/wave-logo_horizontal-coloronblack.svg create mode 100644 src/app/assets/wave-logo_horizontal-coloronwhite.svg diff --git a/BUILD.md b/BUILD.md index dfedac331..6adbf8215 100644 --- a/BUILD.md +++ b/BUILD.md @@ -21,7 +21,12 @@ brew install scripthaus ``` You also need a relatively modern nodejs with npm and yarn installed. -Node can be installed from [here](https://nodejs.org). npm can install yarn using `npm install -g yarn`. + * Node can be installed from [https://nodejs.org](https://nodejs.org). + * npm can install yarn using: + +``` +npm install -g yarn +``` ## Clone the Repo diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..a7cae03be --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +coc@commandline.dev. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..d8df18e15 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# Contributing to Wave Terminal + +We welcome and value contributions to Wave Terminal! Wave is an open source project, always open for contributors. There are several ways you can contribute: + * Submit issues related to bugs or new feature requests + * Fix outstanding [issues](https://github.com/wavetermdev/waveterm/issues) with the existing code + * Contribute to [documentation]() + * Spread the word on social media (tag us on [LinkedIn](), [Twitter/X]()) + * Or simply ⭐️ the repository to show your appreciation + +However you choose to contribute, please be mindful and respect our [code of conduct](). + +> All contributions are highly appreciated! 🥰 + +## Before You Start +We accept patches in the form of github pull requests. If you are new to github, please review this [github pull request guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests). + +### Contributor License Agreement +Contributions to this project must be accompanied by a Contributor License Agreement (CLA). You (or your employer) retain the copyright to your contribution, this simply gives us permission to use and redistribute your contributions as part of the project. + * Individuals: On submission of your first pull request you will be prompted to sign the CLA confirming your original code contribution and that you own the intellectual property. + * Companies: Companies may sign a Corporate CLA (link) to allow all employees to contribute. + +### Style guide +The project uses American English. + +Coding style and formatting is automated for each pull request. We use [Prettier](https://prettier.io/). + +## How to contribute + + * For minor changes, you are welcome to [open a pull request](https://github.com/wavetermdev/waveterm/pulls). + * For major changes, please [create an issue](https://github.com/wavetermdev/waveterm/issues/new) first. + * If you are looking for a place to start take a look at [open issues](https://github.com/wavetermdev/waveterm/issues) and [good-first-issues](lh). + * Join the [Discord channel]() to collaborate with the community on your contribution. + + +### Development Environment + +To build and run wave term locally see instructions below: + * [MacOS build instructions]() + * [Linux build instructions]() + +### Create a Pull Request + +Guidelines: + * Before writing any code, please look through existing PRs or issues to make sure nobody is already working on the same thing. + * Develop features on a branch - do not work on the main branch + * For anything but minor fixes, please submit tests and documentation + * Please reference the issue in the pull request diff --git a/README.md b/README.md new file mode 100644 index 000000000..bd30d77ce --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ + +

+ + + + Wave Terminal Logo + +
+

+ +# Wave Terminal + +The universal modern terminal for seamless workflows. + +Wave isn't just another terminal emulator; it's an AI-powered modern terminal designed for developers to never lose focus. With Wave, you can focus on execution, collaboration and context switching seamlessly. + +### Features + +* Render anything inline: review code, images, even csv files without ever leaving the terminal +* Save sessions and history +* AI-powered + +## Installation + +Wave Terminal works with MacOS and Linux (preliminary). + +Install Wave Terminal from: [www.commandline.dev/download](https://www.commandline.dev/download) + +## Quick Start + +A quick start guide is available at [docs.getprompt.dev/quickstart/](https://docs.getprompt.dev/quickstart/) + +## Documentation + +Documentation is available at [docs.getprompt.dev](https://docs.getprompt.dev/) + +## Community + * Joins us on Discord + +## Contributing + +Wave uses Github Project for tracking issues. + +Find more information in our [Contributions Guide](), which includes: + + * Ways to contribute + * How to build and run from source + * Contribution guidelines + + diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..10f45830a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,5 @@ +## Reporting Security Issues + +To report vulnerabilities or security concerns, please email us at: [security@commandline.dev](mailto:security@commandline.dev) + +** Please do not report security vulnerabilities through public github issues. ** \ No newline at end of file diff --git a/src/app/assets/wave-logo_horizontal-coloronblack.svg b/src/app/assets/wave-logo_horizontal-coloronblack.svg new file mode 100644 index 000000000..132c6ad04 --- /dev/null +++ b/src/app/assets/wave-logo_horizontal-coloronblack.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/assets/wave-logo_horizontal-coloronwhite.svg b/src/app/assets/wave-logo_horizontal-coloronwhite.svg new file mode 100644 index 000000000..b081eefae --- /dev/null +++ b/src/app/assets/wave-logo_horizontal-coloronwhite.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + From a0176d0e6472e3b0c765b80af1ae81993886ef66 Mon Sep 17 00:00:00 2001 From: Tracy Miranda Date: Tue, 31 Oct 2023 13:42:04 -0400 Subject: [PATCH 2/5] Update README.md (#58) --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bd30d77ce..917b19e10 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@

- - - Wave Terminal Logo + + + Wave Terminal Logo

@@ -35,16 +35,16 @@ A quick start guide is available at [docs.getprompt.dev/quickstart/](https://doc Documentation is available at [docs.getprompt.dev](https://docs.getprompt.dev/) ## Community - * Joins us on Discord + * Joins us on [Discord](https://discord.gg/XfvZ334gwU) ## Contributing Wave uses Github Project for tracking issues. -Find more information in our [Contributions Guide](), which includes: +Find more information in our [Contributions Guide](CONTRIBUTING.md), which includes: - * Ways to contribute - * How to build and run from source - * Contribution guidelines + * [Ways to contribute](CONTRIBUTING.md#contributing-to-wave-terminal) + * [How to build and run from source](CONTRIBUTING.md#development-environment) + * [Contribution guidelines](CONTRIBUTING.md#before-you-start) From d405352823fd7cb88596668d0259f7ff10a20980 Mon Sep 17 00:00:00 2001 From: sawka Date: Sun, 5 Nov 2023 00:00:47 -0700 Subject: [PATCH 3/5] Create MacOS Universal Build (#62) * testing universal build * arch files not required anymore * use CGO_ENABLED for wavesrv. write out notes about the universal build problems/solution * script and updates for universal build * more updates for sign/notarize flow for universal app * put in prod migration check * build prompt to wave migration into emain. updates to macos build scripts * update some packages * successful universal build * remove unused code --- buildres/.gitignore | 3 + buildres/build-universal.js | 20 ++++ buildres/build-universal.sh | 51 ++++++++++ buildres/osx-notarize.js | 14 +++ buildres/osx-sign.js | 20 ++++ buildres/universal.md | 50 ++++++++++ forge.config.js | 18 +--- housekeeping/wave-migrate.sh | 13 ++- package.json | 1 + scripthaus.md | 44 +-------- src/electron/emain.ts | 30 +++++- yarn.lock | 184 ++++++++++++++++++++++------------- 12 files changed, 316 insertions(+), 132 deletions(-) create mode 100644 buildres/.gitignore create mode 100644 buildres/build-universal.js create mode 100644 buildres/build-universal.sh create mode 100644 buildres/osx-notarize.js create mode 100644 buildres/osx-sign.js create mode 100644 buildres/universal.md diff --git a/buildres/.gitignore b/buildres/.gitignore new file mode 100644 index 000000000..172c4cb81 --- /dev/null +++ b/buildres/.gitignore @@ -0,0 +1,3 @@ +temp/ +*.zip +*.dmg \ No newline at end of file diff --git a/buildres/build-universal.js b/buildres/build-universal.js new file mode 100644 index 000000000..12cdc73a8 --- /dev/null +++ b/buildres/build-universal.js @@ -0,0 +1,20 @@ +const eu = require("@electron/universal"); +const path = require("path"); + +let x64Path = path.resolve(__dirname, "temp", "x64", "Wave.app") +let arm64Path = path.resolve(__dirname, "temp", "arm64", "Wave.app") +let outPath = path.resolve(__dirname, "temp", "Wave.app") + +console.log("building universal package"); +console.log("x64 path", x64Path); +console.log("arm64 path", arm64Path); +console.log("output path", outPath); + +(async () => { + await eu.makeUniversalApp({ + x64AppPath: x64Path, + arm64AppPath: arm64Path, + outAppPath: outPath, + }); + console.log("created macos universal app"); +})(); diff --git a/buildres/build-universal.sh b/buildres/build-universal.sh new file mode 100644 index 000000000..41d553e02 --- /dev/null +++ b/buildres/build-universal.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# assumes we have Wave-darwin-x64-[version].zip and Wave-darwin-arm64-[version].zip in current directory +VERSION=0.5.0 +rm -rf temp +mkdir temp +mkdir temp/x64 +X64_ZIP="Wave-darwin-x64-$VERSION.zip" +ARM64_ZIP="Wave-darwin-arm64-$VERSION.zip" +if ! [ -f $X64_ZIP ]; then + echo "no $X64_ZIP found"; + exit 1; +fi +if ! [ -f $ARM64_ZIP ]; then + echo "no $ARM64_ZIP found" + exit 1; +fi +set -e +echo "unzipping version v$VERSION zip files" +ls -l "$X64_ZIP" "$ARM64_ZIP" +unzip -q $X64_ZIP -d temp/x64 +mkdir temp/arm64 +unzip -q $ARM64_ZIP -d temp/arm64 +lipo -create -output temp/wavesrv temp/x64/Wave.app/Contents/Resources/app/bin/wavesrv temp/arm64/Wave.app/Contents/Resources/app/bin/wavesrv +rm -rf temp/arm64/Wave.app/Contents/Resources/app +mv temp/x64/Wave.app/Contents/Resources/app temp/ +cp temp/wavesrv temp/app/bin/wavesrv +mkdir temp/x64/Wave.app/Contents/Resources/app +mkdir temp/arm64/Wave.app/Contents/Resources/app +node build-universal.js +rm -rf temp/Wave.app/Contents/Resources/app +mv temp/app temp/Wave.app/Contents/Resources/app +node osx-sign.js +DEBUG=electron-notarize node osx-notarize.js +echo "universal app creation success (build/sign/notarize)" +echo "creating universal dmg" +rm -f *.dmg +DMG_VERSION=$(node -e 'console.log(require("../version.js"))') +DMG_NAME="waveterm-macos-universal-${DMG_VERSION}.dmg" +../../create-dmg/create-dmg \ + --volname "WaveTerm" \ + --window-pos 200 120 \ + --window-size 600 300 \ + --icon-size 100 \ + --icon "Wave.app" 200 130 \ + --hide-extension "Wave.app" \ + --app-drop-link 400 125 \ + $DMG_NAME \ + "temp/Wave.app" +echo "success, created $DMG_NAME" +spctl -a -vvv -t install temp/Wave.app/ diff --git a/buildres/osx-notarize.js b/buildres/osx-notarize.js new file mode 100644 index 000000000..3022296c9 --- /dev/null +++ b/buildres/osx-notarize.js @@ -0,0 +1,14 @@ +const { notarize } = require('@electron/notarize'); +// DEBUG=electron-notarize + +console.log("running osx-notarize"); +notarize({ + appPath: "temp/Wave.app", + tool: "notarytool", + keychainProfile: "notarytool-creds", +}).then(() => { + console.log("notarize success"); +}).catch((e) => { + console.log("notarize error", e); + process.exit(1); +}); diff --git a/buildres/osx-sign.js b/buildres/osx-sign.js new file mode 100644 index 000000000..a7e0347c0 --- /dev/null +++ b/buildres/osx-sign.js @@ -0,0 +1,20 @@ +const { signAsync } = require("@electron/osx-sign"); +// DEBUG="electron-osx-sign*" + +console.log("running osx-sign"); +let waveAppPath = "temp/Wave.app"; +signAsync({ + app: "temp/Wave.app", + binaries: [ + waveAppPath + "/Contents/Resources/app/bin/wavesrv", + waveAppPath + "/Contents/Resources/app/bin/mshell/mshell-v0.3-linux.amd64", + waveAppPath + "/Contents/Resources/app/bin/mshell/mshell-v0.3-linux.arm64", + waveAppPath + "/Contents/Resources/app/bin/mshell/mshell-v0.3-darwin.amd64", + waveAppPath + "/Contents/Resources/app/bin/mshell/mshell-v0.3-darwin.arm64", + ], +}).then(() => { + console.log("signing success"); +}).catch((e) => { + console.log("signing error", e); + process.exit(1); +}); diff --git a/buildres/universal.md b/buildres/universal.md new file mode 100644 index 000000000..d118f6e5b --- /dev/null +++ b/buildres/universal.md @@ -0,0 +1,50 @@ +## MacOS Universal Build Notes + +This doesn't work out of the box and doesn't seem to be well documented anywhere. +The basic idea is that we have to create separate x64 and a arm64 builds and +then link them together using @electron/universal. Seems easy, but in +practice it isn't. + +(1) The separate x64 and arm64 builds *cannot* be signed (osx-sign). This +makes sense because once we lipo the executables together they need to be +resigned (their SHA sums will change). If you accidentally sign them +@electron/universal will also refuse to work. + +(2) We already deal with architecture specific builds with Go for wavesrv and +waveshell. This upsets @electron/universal as well since these are *binaries* +and we don't want to lipo them together. + +(3) Small differences in waveterm.js. The non-executable files must be +*identical*. Well, that's a problem when we inject build times into the files. +Other small differences can also happen (like different go toolchains, etc.). + +(4) ASAR builds. By default if there are differences in the "app" folder +@electron/universal plays some neat tricks to separate out the x64 from the +arm64 code using a app.asar stub. That's great for standard electron builds +where the entrypoint is hardcoded to index.js. Ours isn't so this doesn't work. + +(5) ASAR builds and unpacked files. I don't know all the details here, but +for Wave to work we have to have some files unpacked (not in ASAR format). +The reason is that we execute them directly (e.g. wavesrv and waveshell), they +aren't just loaded by electron. + +(6) Ignoring and skipping files in @electron/universal is hard because +it just takes one minimatch pattern. + +--- + +## Solution + +1. Create unsigned builds on x64 and arm64 +2. Move the builds to the core build machine and *extract* their "app" directories. +In theory because we aren't using any native node modules they function the same in +both environments. +3. Run @electron/universal on the two unsigned builds (without their app directories). +4. lipo wavesrv from x64 and arm64 manually to create a universal wavesrv binary. +5. Copy our extracted "app" directory (with the newly created universal "wavesrv") +back into the universal Wave.app created by @electron/universal. +6. Manually run osx-sign to sign the new universal build (make sure to +pass the wavesrv and waveshell programs as extra binaries). +7. Manually create the new universal dmg (using create-dmg). + + diff --git a/forge.config.js b/forge.config.js index 09f7183ef..a7f979064 100644 --- a/forge.config.js +++ b/forge.config.js @@ -40,6 +40,9 @@ function ignoreFn(path) { if (!AllowedNodeModules[nodeModule]) { return true; } + if (nodeModule == "monaco-editor" && parts.length >= 4 && parts[3] != "min") { + return true; + } } return false; } @@ -56,21 +59,6 @@ module.exports = { "node_modules/fsevents/**", ], icon: "public/waveterm.icns", - osxNotarize: { - tool: "notarytool", - keychainProfile: "notarytool-creds", - }, - osxSign: { - "hardened-runtime": true, - binaries: [ - "Contents/Resources/app/bin/wavesrv", - "Contents/Resources/app/bin/mshell/mshell-v0.2-linux.amd64", - "Contents/Resources/app/bin/mshell/mshell-v0.2-linux.arm64", - "Contents/Resources/app/bin/mshell/mshell-v0.2-darwin.amd64", - "Contents/Resources/app/bin/mshell/mshell-v0.2-darwin.arm64", - ], - identity: "VYQ48YC2N2", - }, }, rebuildConfig: {}, makers: [ diff --git a/housekeeping/wave-migrate.sh b/housekeeping/wave-migrate.sh index 569d86208..5b0d9ed74 100644 --- a/housekeeping/wave-migrate.sh +++ b/housekeeping/wave-migrate.sh @@ -4,15 +4,14 @@ if [ ! -d ~/prompt ]; then echo "~/prompt directory does not exist, will not migrate" exit 1; fi -if [ -d ~/.wave ]; then +if [ -d ~/.waveterm ]; then echo "~/.wave directory already exists, will not migrate" exit 1; fi -mv ~/prompt ~/.wave -cd ~/.wave -mv prompt.db wave.db -mv prompt.db-wal wave.db-wal -mv prompt.db-shm wave.db-shm -mv prompt.authkey wave.authkey +mv ~/prompt ~/.waveterm +mv ~/.waveterm/prompt.db ~/.waveterm/waveterm.db +mv ~/.waveterm/prompt.db-wal ~/.waveterm/waveterm.db-wal +mv ~/.waveterm/prompt.db-shm ~/.waveterm/waveterm.db-shm +mv prompt.authkey waveterm.authkey diff --git a/package.json b/package.json index 89c8fd689..6eada7854 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "waveterm", + "author": "Command Line Inc", "productName": "Wave", "version": "0.5.0", "main": "dist/emain.js", diff --git a/scripthaus.md b/scripthaus.md index 05f03708d..7cf5503f7 100644 --- a/scripthaus.md +++ b/scripthaus.md @@ -48,9 +48,7 @@ GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')" (cd waveshell; GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-darwin.arm64 main-waveshell.go) (cd waveshell; GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-linux.amd64 main-waveshell.go) (cd waveshell; GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-linux.arm64 main-waveshell.go) -(cd wavesrv; GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../build/wavesrv.amd64 ./cmd) -(cd wavesrv; GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../build/wavesrv.arm64 ./cmd) -lipo -create -output bin/wavesrv build/wavesrv.amd64 build/wavesrv.arm64 +(cd wavesrv; CGO_ENABLED=1 go build -ldflags="$GO_LDFLAGS" -o ../bin/wavesrv ./cmd) node_modules/.bin/electron-forge make ``` @@ -66,7 +64,7 @@ GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')" (cd waveshell; GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-darwin.arm64 main-waveshell.go) (cd waveshell; GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-linux.amd64 main-waveshell.go) (cd waveshell; GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-linux.arm64 main-waveshell.go) -(cd wavesrv; go build -ldflags="$GO_LDFLAGS" -o ../bin/wavesrv ./cmd) +(cd wavesrv; CGO_ENABLED=1 go build -ldflags="$GO_LDFLAGS" -o ../bin/wavesrv ./cmd) node_modules/.bin/electron-forge make ``` @@ -76,46 +74,10 @@ node_modules/.bin/electron-forge make open out/Wave-darwin-x64/Wave.app ``` -```bash -# @scripthaus command create-dmg -# @scripthaus cd :playbook -DMG_VERSION=$(node -e 'console.log(require("./version.js"))') -DMG_NAME="waveterm-macos-x86-${DMG_VERSION}.dmg" -rm *.dmg -/Users/mike/work/gopath/src/github.com/create-dmg/create-dmg/create-dmg \ - --volname "WaveTerm" \ - --window-pos 200 120 \ - --window-size 600 300 \ - --icon-size 100 \ - --icon "Wave.app" 200 130 \ - --hide-extension "Wave.app" \ - --app-drop-link 400 125 \ - $DMG_NAME \ - "out/Wave-darwin-x64/Wave.app" -``` - -```bash -# @scripthaus command create-dmg-m1 -# @scripthaus cd :playbook -DMG_VERSION=$(node -e 'console.log(require("./version.js"))') -DMG_NAME="waveterm-macos-arm64-${DMG_VERSION}.dmg" -rm *.dmg -/Users/sawka/work/gopath/src/github.com/create-dmg/create-dmg/create-dmg \ - --volname "WaveTerm" \ - --window-pos 200 120 \ - --window-size 600 300 \ - --icon-size 100 \ - --icon "Wave.app" 200 130 \ - --hide-extension "Wave.app" \ - --app-drop-link 400 125 \ - $DMG_NAME \ - "out/Wave-darwin-arm64/Wave.app" -``` - ```bash # @scripthaus command build-wavesrv cd wavesrv -go build -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M')" -o bin/wavesrv ./cmd +CGO_ENABLED=1 go build -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M')" -o bin/wavesrv ./cmd ``` ```bash diff --git a/src/electron/emain.ts b/src/electron/emain.ts index 8c1990685..8fc08792b 100644 --- a/src/electron/emain.ts +++ b/src/electron/emain.ts @@ -21,7 +21,6 @@ const ProdServerEndpoint = "http://127.0.0.1:1619"; let isDev = process.env[WaveDevVarName] != null; let waveHome = getWaveHomeDir(); -ensureDir(waveHome); let DistDir = isDev ? "dist-dev" : "dist"; let GlobalAuthKey = ""; let instanceId = uuidv4(); @@ -29,6 +28,9 @@ let oldConsoleLog = console.log; let wasActive = true; let wasInFg = true; +checkPromptMigrate(); +ensureDir(waveHome); + // these are either "darwin/amd64" or "darwin/arm64" // normalize darwin/x64 to darwin/amd64 for GOARCH compatibility let unamePlatform = process.platform; @@ -91,6 +93,32 @@ function getWaveHomeDir() { return waveHome; } +function checkPromptMigrate() { + let waveHome = getWaveHomeDir(); + if (isDev || fs.existsSync(waveHome)) { + // don't migrate if we're running dev version or if wave home directory already exists + return; + } + let homeDir = process.env.HOME; + let promptHome = path.join(homeDir, "prompt"); + if (!fs.existsSync(promptHome) || !fs.existsSync(path.join(promptHome, "prompt.db"))) { + // make sure we have a valid prompt home directory (prompt.db must exist inside) + return; + } + // rename directory, and then rename db and authkey files + fs.renameSync(promptHome, waveHome); + fs.renameSync(path.join(waveHome, "prompt.db"), path.join(waveHome, "waveterm.db")); + if (fs.existsSync(waveHome, "prompt.db-wal")) { + fs.renameSync(path.join(waveHome, "prompt.db-wal"), path.join(waveHome, "waveterm.db-wal")); + } + if (fs.existsSync(waveHome, "prompt.db-shm")) { + fs.renameSync(path.join(waveHome, "prompt.db-shm"), path.join(waveHome, "waveterm.db-shm")); + } + if (fs.existsSync(waveHome, "prompt.authkey")) { + fs.renameSync(path.join(waveHome, "prompt.authkey"), path.join(waveHome, "waveterm.authkey")); + } +} + // for dev, this is just the waveterm directory // for prod, this is .../Wave.app/Contents/Resources/app function getAppBasePath() { diff --git a/yarn.lock b/yarn.lock index 77791bf56..c40eaa991 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1440,9 +1440,9 @@ integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.19" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811" - integrity sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw== + version "0.3.20" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" + integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" @@ -1659,16 +1659,16 @@ remove-accents "0.4.2" "@tanstack/react-table@^8.10.3": - version "8.10.6" - resolved "https://registry.yarnpkg.com/@tanstack/react-table/-/react-table-8.10.6.tgz#a8c03cc06ac890bce4404739b9356059c4259dd4" - integrity sha512-D0VEfkIYnIKdy6SHiBNEaMc4SxO+MV7ojaPhRu8jP933/gbMi367+Wul2LxkdovJ5cq6awm0L1+jgxdS/unzIg== + version "8.10.7" + resolved "https://registry.yarnpkg.com/@tanstack/react-table/-/react-table-8.10.7.tgz#733f4bee8cf5aa19582f944dd0fd3224b21e8c94" + integrity sha512-bXhjA7xsTcsW8JPTTYlUg/FuBpn8MNjiEPhkNhIGCUR6iRQM2+WEco4OBpvDeVcR9SE+bmWLzdfiY7bCbCSVuA== dependencies: - "@tanstack/table-core" "8.10.6" + "@tanstack/table-core" "8.10.7" -"@tanstack/table-core@8.10.6": - version "8.10.6" - resolved "https://registry.yarnpkg.com/@tanstack/table-core/-/table-core-8.10.6.tgz#c79d145dfc3dc9947a2b1cdac82cd4ec4cef822a" - integrity sha512-9t8brthhAmCBIjzk7fCDa/kPKoLQTtA31l9Ir76jYxciTlHU61r/6gYm69XF9cbg9n88gVL5y7rNpeJ2dc1AFA== +"@tanstack/table-core@8.10.7": + version "8.10.7" + resolved "https://registry.yarnpkg.com/@tanstack/table-core/-/table-core-8.10.7.tgz#577e8a635048875de4c9d6d6a3c21d26ff9f9d08" + integrity sha512-KQk5OMg5OH6rmbHZxuNROvdI+hKDIUxANaHlV+dPlNN7ED3qYQ/WkpY2qlXww1SIdeMlkIhpN/2L00rof0fXFw== "@tootallnate/once@2": version "2.0.0" @@ -1742,25 +1742,25 @@ electron "*" "@types/eslint-scope@^3.7.3": - version "3.7.5" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.5.tgz#e28b09dbb1d9d35fdfa8a884225f00440dfc5a3e" - integrity sha512-JNvhIEyxVW6EoMIFIvj93ZOywYFatlpu9deeH6eSx6PE3WHYvHaQtmHmQeNw7aA81bYGBPPQqdtBm6b1SsQMmA== + version "3.7.6" + resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.6.tgz#585578b368ed170e67de8aae7b93f54a1b2fdc26" + integrity sha512-zfM4ipmxVKWdxtDaJ3MP3pBurDXOCoyjvlpE3u6Qzrmw4BPbfm4/ambIeTk/r/J0iq/+2/xp0Fmt+gFvXJY2PQ== dependencies: "@types/eslint" "*" "@types/estree" "*" "@types/eslint@*": - version "8.44.3" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.3.tgz#96614fae4875ea6328f56de38666f582d911d962" - integrity sha512-iM/WfkwAhwmPff3wZuPLYiHX18HI24jU8k1ZSH7P8FHwxTjZ2P6CoX2wnF43oprR+YXJM6UUxATkNvyv/JHd+g== + version "8.44.6" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.6.tgz#60e564551966dd255f4c01c459f0b4fb87068603" + integrity sha512-P6bY56TVmX8y9J87jHNgQh43h6VVU+6H7oN7hgvivV81K2XY8qJZ5vqPy/HdUoVIelii2kChYVzQanlswPWVFw== dependencies: "@types/estree" "*" "@types/json-schema" "*" "@types/estree@*", "@types/estree@^1.0.0": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.2.tgz#ff02bc3dc8317cd668dfec247b750ba1f1d62453" - integrity sha512-VeiPZ9MMwXjO32/Xu7+OwflfmeoRwkE/qzndw42gGtgJwZopBnzy2gD//NN1+go1mADzkDcqf/KnFRSjTJ8xJA== + version "1.0.4" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.4.tgz#d9748f5742171b26218516cf1828b8eafaf8a9fa" + integrity sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw== "@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.33": version "4.17.37" @@ -1805,9 +1805,9 @@ "@types/unist" "^2" "@types/http-cache-semantics@*": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.2.tgz#abe102d06ccda1efdf0ed98c10ccf7f36a785a41" - integrity sha512-FD+nQWA2zJjh4L9+pFXqWOi0Hs1ryBCfI+985NjluQ1p8EYtoLvjLOKidXBtZ4/IcxDX4o8/E8qDS3540tNliw== + version "4.0.3" + resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz#a3ff232bf7d5c55f38e4e45693eda2ebb545794d" + integrity sha512-V46MYLFp08Wf2mmaBhvgjStM3tPa+2GAdy/iqoX+noX1//zje2x4XmrIU0cAwyClATsTmahbtoQ2EwP7I5WSiA== "@types/http-errors@*": version "2.0.2" @@ -1821,7 +1821,12 @@ dependencies: "@types/node" "*" -"@types/json-schema@*", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.8": + version "7.0.14" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.14.tgz#74a97a5573980802f32c8e47b663530ab3b6b7d1" + integrity sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw== + +"@types/json-schema@^7.0.9": version "7.0.13" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85" integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== @@ -1861,17 +1866,24 @@ integrity sha512-xPSg0jm4mqgEkNhowKgZFBNtwoEwF6gJ4Dhww+GFpm3IgtNseHQZ5IqdNwnquZEoANxyDAKDRAdVo4Z72VvD/g== "@types/node@*": - version "20.8.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.4.tgz#0e9ebb2ff29d5c3302fc84477d066fa7c6b441aa" - integrity sha512-ZVPnqU58giiCjSxjVUESDtdPk4QR5WQhhINbc9UBrKLU68MX5BF6kbQzTrkwbolyr0X8ChBpXfavr5mZFKZQ5A== + version "20.8.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.10.tgz#a5448b895c753ae929c26ce85cab557c6d4a365e" + integrity sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w== dependencies: - undici-types "~5.25.1" + undici-types "~5.26.4" -"@types/node@^18.0.3", "@types/node@^18.11.18": +"@types/node@^18.0.3": version "18.18.4" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.4.tgz#519fef47a13cf869be290c20fc6ae9b7fe887aa7" integrity sha512-t3rNFBgJRugIhackit2mVcLfF6IRc0JE4oeizPQL8Zrm8n2WY/0wOdpOPhdtG0V9Q2TlW/axbF1MJ6z+Yj/kKQ== +"@types/node@^18.11.18": + version "18.18.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.8.tgz#2b285361f2357c8c8578ec86b5d097c7f464cfd6" + integrity sha512-OLGBaaK5V3VRBS1bAkMVP2/W9B+H8meUfl866OrMNQqt7wDgdpWPp5o6gmIc9pB+lIQHSq4ZL8ypeH1vPxcPaQ== + dependencies: + undici-types "~5.26.4" + "@types/papaparse@^5.3.9": version "5.3.9" resolved "https://registry.yarnpkg.com/@types/papaparse/-/papaparse-5.3.9.tgz#5f955949eae512c1eec70bba4bfeb2e7f4396564" @@ -1904,9 +1916,9 @@ csstype "^3.0.2" "@types/responselike@^1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.1.tgz#1dd57e54509b3b95c7958e52709567077019d65d" - integrity sha512-TiGnitEDxj2X0j+98Eqk5lv/Cij8oHd32bU4D/Yw6AOq7vvTk0gSD2GPj0G/HkvhMoVsdlhYF4yqqlyPBTM6Sg== + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.2.tgz#8de1b0477fd7c12df77e50832fa51701a8414bd6" + integrity sha512-/4YQT5Kp6HxUDb4yhRkm0bJ7TbjvTddqX7PZ5hz6qV3pxSo72f/6YPRo+Mu2DU307tm9IioO69l7uAwn5XNcFA== dependencies: "@types/node" "*" @@ -1979,9 +1991,9 @@ "@types/node" "*" "@types/yauzl@^2.9.1": - version "2.10.1" - resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.1.tgz#4e8f299f0934d60f36c74f59cb5a8483fd786691" - integrity sha512-CHzgNU3qYBnp/O4S3yv2tXPlvMTq0YWSTVg2/JYLqWZGHwwgJGAwd00poay/11asPq8wLFwHzubyInqHIFmmiw== + version "2.10.2" + resolved "https://registry.yarnpkg.com/@types/yauzl/-/yauzl-2.10.2.tgz#dab926ef9b41a898bc943f11bca6b0bad6d4b729" + integrity sha512-Km7XAtUIduROw7QPgvcft0lIupeG8a8rdKL8RiSyKvlE7dYY31fEn41HVuQsRFDuROA8tA4K2UVL+WdfFmErBA== dependencies: "@types/node" "*" @@ -2161,11 +2173,16 @@ acorn-walk@^8.0.0: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== -acorn@^8.0.4, acorn@^8.7.1, acorn@^8.8.2: +acorn@^8.0.4: version "8.10.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== +acorn@^8.7.1, acorn@^8.8.2: + version "8.11.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" + integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== + agent-base@6, agent-base@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -2613,9 +2630,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001541: - version "1.0.30001547" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001547.tgz#d4f92efc488aab3c7f92c738d3977c2a3180472b" - integrity sha512-W7CrtIModMAxobGhz8iXmDfuJiiKg1WADMO/9x7/CLNin5cpSbuBjooyoIUVB5eyCc36QuTVlkVa1iB2S5+/eA== + version "1.0.30001561" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz#752f21f56f96f1b1a52e97aae98c57c562d5d9da" + integrity sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw== ccount@^2.0.0: version "2.0.1" @@ -3118,9 +3135,9 @@ defer-to-connect@^2.0.0: integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== define-data-property@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.0.tgz#0db13540704e1d8d479a0656cf781267531b9451" - integrity sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g== + version "1.1.1" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" + integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== dependencies: get-intrinsic "^1.2.1" gopd "^1.0.1" @@ -3378,9 +3395,9 @@ electron-squirrel-startup@^1.0.0: debug "^2.2.0" electron-to-chromium@^1.4.535: - version "1.4.548" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.548.tgz#e695d769e0e801fa6d438b63f6bc9b80372000d6" - integrity sha512-R77KD6mXv37DOyKLN/eW1rGS61N6yHOfapNSX9w+y9DdPG83l9Gkuv7qkCFZ4Ta4JPhrjgQfYbv4Y3TnM1Hi2Q== + version "1.4.576" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.576.tgz#0c6940fdc0d60f7e34bd742b29d8fa847c9294d1" + integrity sha512-yXsZyXJfAqzWk1WKryr0Wl0MN2D47xodPvEEwlVePBnhU5E7raevLQR+E6b9JAD3GfL/7MbAL9ZtWQQPcLx7wA== electron-winstaller@^5.0.0: version "5.1.0" @@ -3827,6 +3844,11 @@ find-up@^6.3.0: locate-path "^7.1.0" path-exists "^5.0.0" +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + flora-colossus@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/flora-colossus/-/flora-colossus-2.0.0.tgz#af1e85db0a8256ef05f3fb531c1235236c97220a" @@ -3958,10 +3980,10 @@ fsevents@~2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.1, function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== galactus@^1.0.0: version "1.0.0" @@ -4016,7 +4038,7 @@ get-installed-path@^2.0.3: dependencies: global-modules "1.0.0" -get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.1: +get-intrinsic@^1.0.2: version "1.2.1" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82" integrity sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw== @@ -4026,6 +4048,16 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@ has-proto "^1.0.1" has-symbols "^1.0.3" +get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" + integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== + dependencies: + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + get-package-info@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/get-package-info/-/get-package-info-1.0.0.tgz#6432796563e28113cd9474dbbd00052985a4999c" @@ -4204,11 +4236,11 @@ has-flag@^4.0.0: integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== has-property-descriptors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" - integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" + integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== dependencies: - get-intrinsic "^1.1.1" + get-intrinsic "^1.2.2" has-proto@^1.0.1: version "1.0.1" @@ -4230,6 +4262,13 @@ has@^1.0.3: resolved "https://registry.yarnpkg.com/has/-/has-1.0.4.tgz#2eb2860e000011dae4f1406a86fe80e530fb2ec6" integrity sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ== +hasown@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== + dependencies: + function-bind "^1.1.2" + hast-util-whitespace@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz#0ec64e257e6fc216c7d14c8a1b74d27d650b4557" @@ -6377,9 +6416,9 @@ pump@^3.0.0: once "^1.3.1" punycode@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" - integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== pure-color@^1.2.0: version "1.3.0" @@ -7418,9 +7457,9 @@ terser-webpack-plugin@^5.3.7: terser "^5.16.8" terser@^5.16.8: - version "5.21.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.21.0.tgz#d2b27e92b5e56650bc83b6defa00a110f0b124b2" - integrity sha512-WtnFKrxu9kaoXuiZFSGrcAvvBqAdmKx0SFNmVNYdJamMu9yyN3I/QF0FbH4QcqJQ+y1CJnzxGIKH0cSj+FGYRw== + version "5.24.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.24.0.tgz#4ae50302977bca4831ccc7b4fef63a3c04228364" + integrity sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -7553,10 +7592,10 @@ ua-parser-js@^1.0.35: resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.36.tgz#a9ab6b9bd3a8efb90bb0816674b412717b7c428c" integrity sha512-znuyCIXzl8ciS3+y3fHJI/2OhQIXbXw9MWC/o3qwyR+RGppjZHrM27CGFSKCJXi2Kctiz537iOu2KnXs1lMQhw== -undici-types@~5.25.1: - version "5.25.3" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.25.3.tgz#e044115914c85f0bcbb229f346ab739f064998c3" - integrity sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA== +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0" @@ -7899,7 +7938,7 @@ webpack-dev-server@^4.9.1: webpack-dev-middleware "^5.3.1" ws "^8.13.0" -webpack-merge@^5.7.3, webpack-merge@^5.8.0: +webpack-merge@^5.7.3: version "5.9.0" resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.9.0.tgz#dc160a1c4cf512ceca515cc231669e9ddb133826" integrity sha512-6NbRQw4+Sy50vYNTw7EyOn41OZItPiXB8GNv3INSoe3PSFaHJEz3SHTrYVaRm2LilNGnFUzh0FAwqPEmU/CwDg== @@ -7907,15 +7946,24 @@ webpack-merge@^5.7.3, webpack-merge@^5.8.0: clone-deep "^4.0.1" wildcard "^2.0.0" +webpack-merge@^5.8.0: + version "5.10.0" + resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.10.0.tgz#a3ad5d773241e9c682803abf628d4cd62b8a4177" + integrity sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA== + dependencies: + clone-deep "^4.0.1" + flat "^5.0.2" + wildcard "^2.0.0" + webpack-sources@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== webpack@^5.73.0: - version "5.88.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.88.2.tgz#f62b4b842f1c6ff580f3fcb2ed4f0b579f4c210e" - integrity sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ== + version "5.89.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.89.0.tgz#56b8bf9a34356e93a6625770006490bf3a7f32dc" + integrity sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw== dependencies: "@types/eslint-scope" "^3.7.3" "@types/estree" "^1.0.0" From 0ae654cd1dbe2a84ddaab70e37bb3c139cc95f25 Mon Sep 17 00:00:00 2001 From: sawka Date: Mon, 6 Nov 2023 12:03:12 -0800 Subject: [PATCH 4/5] upgrade electron/rebuild to get rid of weird lzma-native dependency --- build-linux.md | 24 +++++++++++++----------- forge.config.js | 6 ------ package.json | 2 +- yarn.lock | 43 ++----------------------------------------- 4 files changed, 16 insertions(+), 59 deletions(-) diff --git a/build-linux.md b/build-linux.md index 19b6bbeb9..7e552cc7d 100644 --- a/build-linux.md +++ b/build-linux.md @@ -13,6 +13,7 @@ If you install the production version of Wave, you'll see a semi-transparent sid Download and install Go (must be at least go 1.18). We also need gcc installed to run a CGO build (for Golang): ``` sudo snap install go --classic +sudo apt-get update sudo apt-get install gcc ``` @@ -55,17 +56,6 @@ Move out of the `scripthaus` directory if you're still in it. Clone the wave re git clone git@github.com:wavetermdev/waveterm.git ``` -## Building WaveShell / WaveSrv - -cd into the waveterm directory (if you haven't already) and run the build-backend command using `scripthaus`. - -``` -cd waveterm -scripthaus run build-backend -``` - -This builds the Golang backends for Wave. The binaries will put in waveshell/bin and wavesrv/bin respectively. If you're working on a new plugin or other pure frontend changes to Wave, you won't need to rebuild these unless you pull new code from the Wave Repository. - ## One-Time Setup Install Wave modules (we use yarn): @@ -79,6 +69,18 @@ Electron also requires specific builds of node_modules to work (because Electron scripthaus run electron-rebuild ``` +## Building WaveShell / WaveSrv + +cd into the waveterm directory (if you haven't already) and run the build-backend command using `scripthaus`. + +``` +cd waveterm +scripthaus run build-backend +``` + +This builds the Golang backends for Wave. The binaries will put in waveshell/bin and wavesrv/bin respectively. If you're working on a new plugin or other pure frontend changes to Wave, you won't need to rebuild these unless you pull new code from the Wave Repository. + + ## Running WebPack We use webpack to build both the React and Electron App Wrapper code. They are both run together using: diff --git a/forge.config.js b/forge.config.js index a7f979064..c73f1e14c 100644 --- a/forge.config.js +++ b/forge.config.js @@ -7,9 +7,6 @@ var AllowedFirstParts = { }; var AllowedNodeModules = { - // "lzma-native": true, - // "fs-ext": true, - // "fsevents": true, "monaco-editor": true, }; @@ -54,9 +51,6 @@ module.exports = { "package.json", "dist/*", "public/*", - "node_modules/lzma-native/**", - "node_modules/fs-ext/**", - "node_modules/fsevents/**", ], icon: "public/waveterm.icns", }, diff --git a/package.json b/package.json index 6eada7854..77c030fa0 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@electron-forge/maker-snap": "^6.4.2", "@electron-forge/maker-squirrel": "^6.0.0-beta.70", "@electron-forge/maker-zip": "^6.0.0-beta.70", + "@electron/rebuild": "^3.3.0", "@svgr/webpack": "^8.1.0", "@types/classnames": "^2.3.1", "@types/electron": "^1.6.10", @@ -66,7 +67,6 @@ "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", "electron": "27.0.0", - "electron-rebuild": "^3.2.8", "file-loader": "^6.2.0", "http-server": "^14.1.1", "less": "^4.1.2", diff --git a/yarn.lock b/yarn.lock index c40eaa991..60731a996 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1363,7 +1363,7 @@ minimist "^1.2.6" plist "^3.0.5" -"@electron/rebuild@^3.2.10": +"@electron/rebuild@^3.2.10", "@electron/rebuild@^3.3.0": version "3.3.0" resolved "https://registry.yarnpkg.com/@electron/rebuild/-/rebuild-3.3.0.tgz#6ba0ae1cb545b2e314901d2ac175ca9c03a2e3da" integrity sha512-S1vgpzIOS1wCJmsYjdLz97MTUV6UTLcMk/HE3w90HYtVxvW+PQdwxLbgsrECX2bysqcnmM5a0K6mXj/gwVgYtQ== @@ -3367,26 +3367,6 @@ electron-packager@^17.1.2: semver "^7.1.3" yargs-parser "^21.1.1" -electron-rebuild@^3.2.8: - version "3.2.9" - resolved "https://registry.yarnpkg.com/electron-rebuild/-/electron-rebuild-3.2.9.tgz#ea372be15f591f8d6d978ee9bca6526dadbcf20f" - integrity sha512-FkEZNFViUem3P0RLYbZkUjC8LUFIK+wKq09GHoOITSJjfDAVQv964hwaNseTTWt58sITQX3/5fHNYcTefqaCWw== - dependencies: - "@malept/cross-spawn-promise" "^2.0.0" - chalk "^4.0.0" - debug "^4.1.1" - detect-libc "^2.0.1" - fs-extra "^10.0.0" - got "^11.7.0" - lzma-native "^8.0.5" - node-abi "^3.0.0" - node-api-version "^0.1.4" - node-gyp "^9.0.0" - ora "^5.1.0" - semver "^7.3.5" - tar "^6.0.5" - yargs "^17.0.1" - electron-squirrel-startup@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/electron-squirrel-startup/-/electron-squirrel-startup-1.0.0.tgz#19b4e55933fa0ef8f556784b9c660f772546a0b8" @@ -5056,15 +5036,6 @@ lru-cache@^7.7.1: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a" integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g== -lzma-native@^8.0.5: - version "8.0.6" - resolved "https://registry.yarnpkg.com/lzma-native/-/lzma-native-8.0.6.tgz#3ea456209d643bafd9b5d911781bdf0b396b2665" - integrity sha512-09xfg67mkL2Lz20PrrDeNYZxzeW7ADtpYFbwSQh9U8+76RIzx5QsJBMy8qikv3hbUPfpy6hqwxt6FcGK81g9AA== - dependencies: - node-addon-api "^3.1.0" - node-gyp-build "^4.2.1" - readable-stream "^3.6.0" - make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -5819,18 +5790,13 @@ no-case@^3.0.4: lower-case "^2.0.2" tslib "^2.0.3" -node-abi@^3.0.0, node-abi@^3.45.0: +node-abi@^3.45.0: version "3.48.0" resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.48.0.tgz#122d132ae1ac097b0d711144560b17922de026ab" integrity sha512-uWR/uwQyVV2iN5+Wkf1/oQxOR9YjU7gBclJLg2qK7GDvVohcnY6LaBXKV89N79EQFyN4/e43O32yQYE5QdFYTA== dependencies: semver "^7.3.5" -node-addon-api@^3.1.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" - integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A== - node-api-version@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/node-api-version/-/node-api-version-0.1.4.tgz#1ed46a485e462d55d66b5aa1fe2821720dedf080" @@ -5864,11 +5830,6 @@ node-forge@^1: resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== -node-gyp-build@^4.2.1: - version "4.6.1" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.1.tgz#24b6d075e5e391b8d5539d98c7fc5c210cac8a3e" - integrity sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ== - node-gyp@^9.0.0: version "9.4.0" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.4.0.tgz#2a7a91c7cba4eccfd95e949369f27c9ba704f369" From 498c393baaef982a8c79ac8f7f46d78ccb0e39d1 Mon Sep 17 00:00:00 2001 From: sawka Date: Mon, 6 Nov 2023 13:39:27 -0800 Subject: [PATCH 5/5] zip is a requirement for linux builds --- build-linux.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build-linux.md b/build-linux.md index 7e552cc7d..63c6b0ee9 100644 --- a/build-linux.md +++ b/build-linux.md @@ -10,11 +10,14 @@ If you install the production version of Wave, you'll see a semi-transparent sid ## Prereqs and Tools -Download and install Go (must be at least go 1.18). We also need gcc installed to run a CGO build (for Golang): +Download and install Go (must be at least go 1.18). We also need gcc installed to run a CGO build (for Golang). +zip is required to build linux deployment packages (not required for running and debugging dev builds). + ``` sudo snap install go --classic sudo apt-get update sudo apt-get install gcc +sudo apt-get install zip ``` Download and install [ScriptHaus](https://github.com/scripthaus-dev/scripthaus) (to run the build commands):