refactor: add mise, update electron-forge, add ci/cd workflow for lint
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
This commit is contained in:
parent
c5573330a9
commit
bc818fabc8
|
|
@ -12,5 +12,14 @@
|
|||
"plugin:import/electron",
|
||||
"plugin:import/typescript"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser"
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"rules": {
|
||||
"import/no-unresolved": ["error", {
|
||||
"ignore": ["^.*\\?asset$"]
|
||||
}],
|
||||
"@typescript-eslint/no-unused-vars": ["warn", {
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_"
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- ".github/**"
|
||||
- "!.github/workflows/build.yml"
|
||||
- ".vscode/**"
|
||||
- ".gitignore"
|
||||
- "README.md"
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
|
@ -13,16 +19,22 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout assets
|
||||
run: git -c submodule."assets".update=checkout submodule update --init assets
|
||||
|
||||
- name: Setup Mise
|
||||
uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
|
||||
uses: immich-app/devtools/actions/use-mise@7b8610a904d57da241e4ddba17fa62b62b15aed4 # use-mise-action-v2.0.2
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Checkout assets
|
||||
run: mise assets
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
run: mise install:frozen
|
||||
|
||||
- name: Lint
|
||||
run: mise lint
|
||||
|
||||
- name: Format
|
||||
run: mise format
|
||||
|
||||
- name: Build
|
||||
run: pnpm run package
|
||||
run: mise build
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
min_version = { soft = "2026.5.15", hard = "2026.5.12" }
|
||||
|
||||
[tools]
|
||||
node = "26.2.0"
|
||||
pnpm = "11.17.0"
|
||||
gh = "2.93.0"
|
||||
"github:git-town/git-town" = "23.0.1"
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Pull in Stoat brand assets"
|
||||
#MISE depends=["assets:fallback"]
|
||||
set -e
|
||||
|
||||
git -c submodule."assets".update=checkout submodule update --init assets
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Remove Stoat brand assets and use fallback"
|
||||
set -e
|
||||
|
||||
git submodule deinit -f assets
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Build desktop app"
|
||||
set -e
|
||||
|
||||
pnpm run package
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Run the desktop app in dev mode"
|
||||
set -e
|
||||
|
||||
pnpm run start
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Check code formatting"
|
||||
set -e
|
||||
|
||||
pnpm run fmt
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Fix code formatting"
|
||||
set -e
|
||||
|
||||
pnpm run fmt:fix
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Install dependencies with frozen lockfile"
|
||||
set -e
|
||||
|
||||
pnpm install --frozen-lockfile
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Lint code and find issues"
|
||||
set -e
|
||||
|
||||
pnpm run lint
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Lint code and fix issues"
|
||||
set -e
|
||||
|
||||
pnpm run lint:fix
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#MISE description="Make desktop app targets"
|
||||
set -e
|
||||
|
||||
pnpm run make
|
||||
26
README.md
26
README.md
|
|
@ -29,9 +29,8 @@ _Contribution guidelines for Desktop app TBA!_
|
|||
|
||||
Before getting started, you'll want to install:
|
||||
|
||||
- Git
|
||||
- Node.js
|
||||
- pnpm (run `corepack enable`)
|
||||
- [Git](https://git-scm.com/install/)
|
||||
- [mise-en-place](https://mise.jdx.dev/getting-started.html)
|
||||
|
||||
Then proceed to setup:
|
||||
|
||||
|
|
@ -40,28 +39,31 @@ Then proceed to setup:
|
|||
git clone --recursive https://github.com/stoatchat/for-desktop stoat-for-desktop
|
||||
cd stoat-for-desktop
|
||||
|
||||
# Install tools from mise
|
||||
mise install
|
||||
|
||||
# install all packages
|
||||
pnpm i --frozen-lockfile
|
||||
mise install:frozen
|
||||
|
||||
# start the application
|
||||
pnpm start
|
||||
mise dev
|
||||
# ... or build the bundle
|
||||
pnpm package
|
||||
mise build
|
||||
# ... or build all distributables
|
||||
pnpm make
|
||||
mise make
|
||||
```
|
||||
|
||||
Various useful commands for development testing:
|
||||
|
||||
```bash
|
||||
# connect to the development server
|
||||
pnpm start -- --force-server http://localhost:5173
|
||||
mise exec -- pnpm start -- --force-server http://localhost:5173
|
||||
|
||||
# test the flatpak (after `make`)
|
||||
pnpm install:flatpak
|
||||
pnpm run:flatpak
|
||||
mise exec -- pnpm install:flatpak
|
||||
mise exec -- pnpm run:flatpak
|
||||
# ... also connect to dev server like so:
|
||||
pnpm run:flatpak --force-server http://localhost:5173
|
||||
mise exec -- pnpm run:flatpak --force-server http://localhost:5173
|
||||
|
||||
# Nix-specific instructions for testing
|
||||
pnpm package
|
||||
|
|
@ -78,7 +80,7 @@ If you want to pull in Stoat brand assets after pulling, run the following:
|
|||
|
||||
```bash
|
||||
# update the assets
|
||||
git -c submodule."assets".update=checkout submodule update --init assets
|
||||
mise assets
|
||||
```
|
||||
|
||||
Currently, this is required to build, any forks are expected to provide their own assets.
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
[tools]
|
||||
node = "25.4.0"
|
||||
pnpm = "10.28.1"
|
||||
gh = "2.25.0"
|
||||
"github:git-town/git-town" = "22.4.0"
|
||||
29
package.json
29
package.json
|
|
@ -10,6 +10,9 @@
|
|||
"make": "electron-forge make",
|
||||
"publish": "electron-forge publish",
|
||||
"lint": "eslint --ext .ts,.tsx .",
|
||||
"lint:fix": "eslint --ext --fix .ts,.tsx .",
|
||||
"fmt": "prettier --check 'src/**/*.{ts,tsx,json}'",
|
||||
"fmt:fix": "prettier --write 'src/**/*.{ts,tsx,json}'",
|
||||
"install:flatpak": "flatpak --user install out/make/flatpak/x86_64/chat.stoat.StoatDesktop_stable_x86_64.flatpak",
|
||||
"run:flatpak": "flatpak run --socket=session-bus chat.stoat.StoatDesktop",
|
||||
"run:nix": "/usr/bin/env electron-nix ."
|
||||
|
|
@ -20,15 +23,16 @@
|
|||
"email": "me@insrt.uk"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-forge/cli": "^7.9.0",
|
||||
"@electron-forge/maker-deb": "^7.9.0",
|
||||
"@electron-forge/maker-flatpak": "^7.9.0",
|
||||
"@electron-forge/maker-squirrel": "^7.9.0",
|
||||
"@electron-forge/maker-zip": "^7.9.0",
|
||||
"@electron-forge/plugin-auto-unpack-natives": "^7.9.0",
|
||||
"@electron-forge/plugin-fuses": "^7.9.0",
|
||||
"@electron-forge/plugin-vite": "^7.9.0",
|
||||
"@electron-forge/publisher-github": "^7.9.0",
|
||||
"@electron-forge/cli": "^7.11.2",
|
||||
"@electron-forge/maker-deb": "^7.11.2",
|
||||
"@electron-forge/maker-flatpak": "^7.11.2",
|
||||
"@electron-forge/maker-squirrel": "^7.11.2",
|
||||
"@electron-forge/maker-zip": "^7.11.2",
|
||||
"@electron-forge/plugin-auto-unpack-natives": "^7.11.2",
|
||||
"@electron-forge/plugin-fuses": "^7.11.2",
|
||||
"@electron-forge/plugin-vite": "^7.11.2",
|
||||
"@electron-forge/publisher-github": "^7.11.2",
|
||||
"@electron-forge/maker-appx": "^7.11.2",
|
||||
"@electron/fuses": "^1.8.0",
|
||||
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
||||
"@types/auto-launch": "^5.0.5",
|
||||
|
|
@ -37,6 +41,8 @@
|
|||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"electron": "^40.8.3",
|
||||
"electron-vite": "^5.0.0",
|
||||
"electron-windows-store": "^2.1.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"json-schema-typed": "^8.0.1",
|
||||
|
|
@ -45,7 +51,6 @@
|
|||
"vite": "^5.4.20"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron-forge/maker-appx": "^7.9.0",
|
||||
"@homebridge/dbus-native": "^0.7.2",
|
||||
"auto-launch": "^5.0.6",
|
||||
"bufferutil": "^4.0.9",
|
||||
|
|
@ -55,5 +60,5 @@
|
|||
"update-electron-app": "^3.1.1",
|
||||
"utf-8-validate": "^6.0.5"
|
||||
},
|
||||
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34"
|
||||
}
|
||||
"packageManager": "pnpm@11.17.0+sha512.cca3cea332ad254bb84145f966d19f4879615210346fc92c79a047f23a0d7b3cca3c3792f0076ba1f1831d277efbcf0a9119b31a9a60eca7fb3d6231f331ef72"
|
||||
}
|
||||
|
|
|
|||
1712
pnpm-lock.yaml
1712
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -1,9 +1,11 @@
|
|||
allowBuilds:
|
||||
bufferutil: true
|
||||
electron: true
|
||||
electron-winstaller: true
|
||||
esbuild: true
|
||||
register-scheme@https://codeload.github.com/devsnek/node-register-scheme/tar.gz/e7cc9a63a1f512565da44cb57316d9fb10750e17: true
|
||||
utf-8-validate: true
|
||||
|
||||
nodeLinker: hoisted
|
||||
|
||||
onlyBuiltDependencies:
|
||||
- bufferutil
|
||||
- electron
|
||||
- electron-winstaller
|
||||
- esbuild
|
||||
- register-scheme
|
||||
- utf-8-validate
|
||||
blockExoticSubdeps: false # required to make discord-rpc work
|
||||
|
|
@ -3,7 +3,6 @@ import { IUpdateInfo, updateElectronApp } from "update-electron-app";
|
|||
import { BrowserWindow, Notification, app, shell } from "electron";
|
||||
import started from "electron-squirrel-startup";
|
||||
|
||||
import { autoLaunch } from "./native/autoLaunch";
|
||||
import { config } from "./native/config";
|
||||
import { initDiscordRpc } from "./native/discordRpc";
|
||||
import { initTray } from "./native/tray";
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import AutoLaunch from "auto-launch";
|
|||
|
||||
import { ipcMain } from "electron";
|
||||
|
||||
import { mainWindow } from "./window";
|
||||
|
||||
export const autoLaunch = new AutoLaunch({
|
||||
name: "Stoat",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ export function initTray() {
|
|||
tray.setImage(trayIcon);
|
||||
tray.on("click", () => {
|
||||
if (mainWindow.isVisible()) {
|
||||
mainWindow.hide();
|
||||
mainWindow.hide();
|
||||
} else {
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue