diff --git a/BUILD.md b/BUILD.md index 49e864c7b..9d8866a86 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..917b19e10 --- /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](https://discord.gg/XfvZ334gwU) + +## Contributing + +Wave uses Github Project for tracking issues. + +Find more information in our [Contributions Guide](CONTRIBUTING.md), which includes: + + * [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) + + 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/build-linux.md b/build-linux.md index 19b6bbeb9..63c6b0ee9 100644 --- a/build-linux.md +++ b/build-linux.md @@ -10,10 +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): @@ -55,17 +59,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 +72,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/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..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, }; @@ -40,6 +37,9 @@ function ignoreFn(path) { if (!AllowedNodeModules[nodeModule]) { return true; } + if (nodeModule == "monaco-editor" && parts.length >= 4 && parts[3] != "min") { + return true; + } } return false; } @@ -51,26 +51,8 @@ module.exports = { "package.json", "dist/*", "public/*", - "node_modules/lzma-native/**", - "node_modules/fs-ext/**", - "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 76545daca..60e5cb853 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", @@ -52,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", @@ -67,7 +69,6 @@ "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", "electron": "27.0.3", - "electron-rebuild": "^3.2.8", "file-loader": "^6.2.0", "http-server": "^14.1.1", "less": "^4.1.2", 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/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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 c49de9ce4..e5522070e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1488,7 +1488,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== @@ -1990,13 +1990,18 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.32.tgz#f6cd08939ae3ad886fcc92ef7f0109dacddf61ab" integrity sha512-xPSg0jm4mqgEkNhowKgZFBNtwoEwF6gJ4Dhww+GFpm3IgtNseHQZ5IqdNwnquZEoANxyDAKDRAdVo4Z72VvD/g== -"@types/node@*", "@types/node@^20.4.0": +"@types/node@*": version "20.8.10" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.10.tgz#a5448b895c753ae929c26ce85cab557c6d4a365e" integrity sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w== dependencies: undici-types "~5.26.4" +"@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" @@ -2004,10 +2009,10 @@ dependencies: undici-types "~5.26.4" -"@types/papaparse@^5.3.10": - version "5.3.10" - resolved "https://registry.yarnpkg.com/@types/papaparse/-/papaparse-5.3.10.tgz#d315347dfafd0458aa25062ec9e3dcebb948b6de" - integrity sha512-mS1Fta/xJ9EDYmAvpeWzcV9Gr0cOl1ClpW7di9+wSUNDIDO55tBtyXg97O7K+Syrd9rDEmuejM2iqmJIJ1SO5g== +"@types/papaparse@^5.3.9": + version "5.3.9" + resolved "https://registry.yarnpkg.com/@types/papaparse/-/papaparse-5.3.9.tgz#5f955949eae512c1eec70bba4bfeb2e7f4396564" + integrity sha512-sZcrKD63qA4/6GyBcVvX6AIp0AkpfyYk00CUQHMBvb4+OVXTZWyXUvidUZaai1wyKUVyJoxO7mgREam/pMRrDw== dependencies: "@types/node" "*" @@ -3507,26 +3512,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" @@ -5212,15 +5197,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" @@ -5968,18 +5944,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" @@ -6013,11 +5984,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"