Skip to content

Commit 88968b6

Browse files
Remove npm build dependency (#286)
Co-authored-by: Owen McGirr <o.a.mcgirr@gmail.com>
1 parent 4cc09c2 commit 88968b6

17 files changed

Lines changed: 702 additions & 778 deletions

.github/workflows/ci.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,24 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v6
1919

20-
- name: Setup Node.js
21-
uses: actions/setup-node@v6
22-
with:
23-
node-version: 25
24-
cache: npm
25-
2620
- name: Setup .NET
2721
uses: actions/setup-dotnet@v5
2822
with:
2923
dotnet-version: 8.0.x
3024

31-
- name: Install dependencies
32-
run: npm ci
33-
34-
- name: Restore C# solution
35-
run: npm run dotnet:restore
25+
- name: Restore
26+
run: dotnet restore src/SwitchifyPc.sln
3627

37-
- name: Build C# solution
38-
run: npm run dotnet:build
28+
- name: Build
29+
run: dotnet build src/SwitchifyPc.sln -c Release --no-restore
3930

40-
- name: Test C# solution
41-
run: npm run dotnet:test
31+
- name: Test
32+
run: dotnet test src/SwitchifyPc.sln -c Release --no-build
4233

43-
- name: Stage C# Windows package
44-
run: npm run dotnet:package:win:stage
34+
- name: Stage Windows package
35+
shell: pwsh
36+
run: pwsh scripts/Package-Windows.ps1 -StageOnly -SkipSign
4537

46-
- name: Verify staged C# Windows package
47-
run: npm run dotnet:package:win:verify
38+
- name: Verify staged Windows package
39+
shell: pwsh
40+
run: pwsh scripts/Verify-DotnetPackage.ps1

.github/workflows/release.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,19 @@ jobs:
4545
with:
4646
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
4747

48-
- name: Setup Node.js
49-
uses: actions/setup-node@v6
48+
- name: Setup .NET
49+
uses: actions/setup-dotnet@v5
5050
with:
51-
node-version: 25
52-
cache: npm
51+
dotnet-version: 8.0.x
5352

54-
- name: Install dependencies
55-
run: npm ci
53+
- name: Restore
54+
run: dotnet restore src/SwitchifyPc.sln
5655

57-
- name: Typecheck
58-
run: npm run typecheck
56+
- name: Build
57+
run: dotnet build src/SwitchifyPc.sln -c Release --no-restore
5958

6059
- name: Test
61-
run: npm test
60+
run: dotnet test src/SwitchifyPc.sln -c Release --no-build
6261

6362
- name: Verify Certum signing certificate
6463
shell: powershell
@@ -73,34 +72,34 @@ jobs:
7372
Select-Object -First 1
7473
7574
if (-not $cert) {
76-
throw "Certum code-signing certificate $thumbprint was not found in Cert:\CurrentUser\My. Make sure SimplySign Desktop is logged in before running the release."
75+
throw "Certum code-signing certificate was not found in Cert:\CurrentUser\My. Make sure SimplySign Desktop is logged in before running the release."
7776
}
7877
7978
if (-not $cert.HasPrivateKey) {
80-
throw "Certum certificate $thumbprint is present but has no private key."
79+
throw "Certum certificate is present but has no private key."
8180
}
8281
8382
Write-Host "Using Certum signing certificate: $($cert.Subject)"
8483
85-
- name: Build native cursor overlay helper
86-
run: npm run native:build-overlay
87-
88-
- name: Smoke native cursor overlay helper
89-
run: npm run native:smoke-overlay
90-
9184
- name: Package Windows installer
92-
run: npm run package:win
85+
shell: powershell
86+
run: powershell -NoProfile -ExecutionPolicy Bypass -File scripts\Package-Windows.ps1
9387

9488
- name: Verify updater metadata
95-
run: npm run package:win:verify-updater-metadata
89+
shell: powershell
90+
run: powershell -NoProfile -ExecutionPolicy Bypass -File scripts\Verify-UpdaterMetadata.ps1
9691

97-
- name: Verify release tag matches package version
92+
- name: Verify release tag matches app version
9893
shell: powershell
9994
run: |
100-
$package = Get-Content package.json | ConvertFrom-Json
101-
$expectedTag = "v$($package.version)"
95+
[xml]$project = Get-Content src\SwitchifyPc.App\SwitchifyPc.App.csproj
96+
$version = $project.Project.PropertyGroup.Version | Select-Object -First 1
97+
if (-not $version) {
98+
throw 'Could not read C# app project version.'
99+
}
100+
$expectedTag = "v$version"
102101
if ($env:RELEASE_TAG -ne $expectedTag) {
103-
throw "Release tag $env:RELEASE_TAG does not match package.json version $expectedTag."
102+
throw "Release tag $env:RELEASE_TAG does not match app version $expectedTag."
104103
}
105104
106105
- name: Publish GitHub release

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
node_modules/
21
dist/
3-
dist-dotnet/
42
build/
53
!build/
64
build/*
@@ -17,9 +15,5 @@ src/**/obj/
1715
.env
1816
.env.*
1917
*.log
20-
npm-debug.log*
21-
yarn-debug.log*
22-
yarn-error.log*
23-
pnpm-debug.log*
2418
.DS_Store
2519
Thumbs.db

AGENTS.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
## Project overview
44

5-
Switchify PC is the desktop companion app for Switchify Android. Its first target is a Windows-first Electron app that accepts authenticated local WebSocket commands from the Android app and turns them into PC mouse, keyboard, text, media, and status actions.
5+
Switchify PC is the Windows-native C#/.NET WPF desktop companion app for Switchify Android. It accepts authenticated Bluetooth commands from the Android app and turns them into PC mouse, keyboard, text, media, window, and status actions.
66

77
The app should be treated as a trusted local control agent. Be conservative with networking, authentication, logging, and desktop input behavior.
88

99
## Work flow
1010

1111
- Every change needs a GitHub issue before implementation.
1212
- Every change needs its own branch from `main`.
13-
- Branch names should be short and scoped, for example `chore/electron-scaffold-1`, `feat/pairing-auth-3`, or `fix/ws-reconnect`.
13+
- Branch names should be short and scoped, for example `chore/dotnet-package-1`, `feat/pairing-auth-3`, or `fix/bluetooth-reconnect`.
1414
- Keep pull requests tightly scoped to one issue wherever possible.
1515
- Do not mix implementation work with broad refactors unless the issue explicitly calls for it.
1616
- Prefer existing project patterns once the app scaffold exists.
1717
- Before creating a milestone, verify whether the intended milestone already exists.
1818
- Reuse an existing open milestone instead of creating a duplicate.
1919
- Create a release milestone only when it is missing.
20-
- Do not create future release milestones casually. The active release milestone should normally be the next version after `package.json`.
21-
- Before release work starts, verify the target milestone name exactly matches the version being released, for example `Release 0.1.8` for `package.json` version `0.1.8`.
20+
- Do not create future release milestones casually. The active release milestone should normally be the next version after the C# app project `<Version>`.
21+
- Before release work starts, verify the target milestone name exactly matches the version being released, for example `Release 0.2.0` for app project version `0.2.0`.
2222

2323
## Development standards
2424

25-
- Use TypeScript for app code.
26-
- Keep Electron main-process code, renderer code, and shared protocol code clearly separated.
27-
- Keep OS input execution behind a narrow adapter interface so protocol handling is not tied directly to a native automation library.
25+
- Use C#/.NET for app code.
26+
- Keep WPF app composition, core protocol/control logic, and Windows-specific integrations clearly separated.
27+
- Keep OS input execution behind a narrow adapter interface so protocol handling is not tied directly to Win32 APIs.
2828
- Validate all WebSocket messages at runtime before using them.
2929
- Prefer small, testable modules for protocol parsing, pairing, auth, command routing, and desktop input mapping.
3030
- Do not log pairing tokens, shared secrets, raw auth headers, or full typed text payloads.
@@ -47,13 +47,12 @@ The app should be treated as a trusted local control agent. Be conservative with
4747
- Convert native automation failures into structured command errors.
4848
- Manual Windows smoke testing matters for input changes because unit tests should use fake adapters instead of controlling the real OS.
4949

50-
## Electron app guidance
50+
## Windows app guidance
5151

52-
- The main process owns WebSocket server lifecycle, pairing/auth state, tray behavior, and desktop input execution.
53-
- The renderer shows pairing, connection status, server status, and recent non-sensitive errors.
54-
- Communicate between renderer and main process through explicit IPC channels.
52+
- The app owns Bluetooth lifecycle, pairing/auth state, tray behavior, update checks, and desktop input execution.
53+
- The UI shows pairing, connection status, Bluetooth status, update state, and recent non-sensitive errors.
5554
- Keep the app useful from the tray: show window, server status, disconnect, and quit.
56-
- Avoid blocking the Electron main process with long-running work.
55+
- Avoid blocking the UI thread with long-running work.
5756

5857
## Design language
5958

@@ -68,8 +67,9 @@ The app should be treated as a trusted local control agent. Be conservative with
6867
Before pushing implementation changes, run the most relevant checks available for the current scaffold. As the repo matures, this should normally include:
6968

7069
```powershell
71-
npm test
72-
npm run build
70+
dotnet restore src/SwitchifyPc.sln
71+
dotnet build src/SwitchifyPc.sln -c Release --no-restore
72+
dotnet test src/SwitchifyPc.sln -c Release --no-build
7373
```
7474

7575
For desktop input or packaging changes, also run the relevant manual smoke path:
@@ -85,14 +85,14 @@ For desktop input or packaging changes, also run the relevant manual smoke path:
8585

8686
Only the maintainer should publish releases.
8787

88-
Release builds are published from tags named `vX.Y.Z`, where `X.Y.Z` must match `package.json`.
88+
Release builds are published from tags named `vX.Y.Z`, where `X.Y.Z` must match `src/SwitchifyPc.App/SwitchifyPc.App.csproj` `<Version>`.
8989

9090
Before creating a release milestone, verify whether the intended milestone already exists. Reuse an existing open milestone. Create the milestone only if it is missing. If the milestone exists but is closed, reopen it only when the work truly belongs in that release.
9191

9292
The release workflow is `.github/workflows/release.yml`. It runs on the self-hosted Windows signing runner with the `switchify-signing` label. The runner is expected to have:
9393

9494
- Windows.
95-
- Node and npm.
95+
- .NET SDK.
9696
- GitHub CLI authentication available to the workflow.
9797
- Windows SDK signing tools available, including `signtool`.
9898
- The Certum SimplySign certificate available in `Cert:\CurrentUser\My`.
@@ -113,8 +113,8 @@ $env:SWITCHIFY_CERTUM_TIMESTAMP_URL = "http://time.certum.pl"
113113
Before creating or pushing a release tag, the maintainer or agent must verify all of the following and stop if any check fails:
114114

115115
- Local `main` is clean and up to date with `origin/main`.
116-
- `package.json` version is the exact version being released.
117-
- The release tag is exactly `vX.Y.Z`, where `X.Y.Z` equals `package.json`.
116+
- The C# app project `<Version>` is the exact version being released.
117+
- The release tag is exactly `vX.Y.Z`, where `X.Y.Z` equals the C# app project `<Version>`.
118118
- The release issue and release PR are assigned to milestone `Release X.Y.Z`.
119119
- The milestone `Release X.Y.Z` exists and has no unrelated open issues.
120120
- The self-hosted runner with label `switchify-signing` is online and not busy.
@@ -124,9 +124,10 @@ Before creating or pushing a release tag, the maintainer or agent must verify al
124124
Use commands like these for preflight checks. Do not print, document, or commit the real certificate thumbprint.
125125

126126
```powershell
127-
$packageVersion = node -p "require('./package.json').version"
128-
$expectedTag = "v$packageVersion"
129-
$expectedMilestone = "Release $packageVersion"
127+
[xml]$project = Get-Content src/SwitchifyPc.App/SwitchifyPc.App.csproj
128+
$projectVersion = $project.Project.PropertyGroup.Version | Select-Object -First 1
129+
$expectedTag = "v$projectVersion"
130+
$expectedMilestone = "Release $projectVersion"
130131
131132
git status --short --branch
132133
git pull --ff-only
@@ -175,22 +176,23 @@ If the thumbprint is available only as a GitHub repository variable, the maintai
175176

176177
The release workflow:
177178

178-
- installs dependencies with `npm ci`
179-
- runs `npm run typecheck`
180-
- runs `npm test`
179+
- restores the C# solution
180+
- builds the C# solution
181+
- runs C# tests
181182
- verifies the Certum signing certificate
182-
- builds native helpers
183-
- packages the Windows x64 NSIS installer with `npm run package:win`
184-
- verifies the tag matches `package.json`
183+
- packages the Windows x64 NSIS installer with `pwsh scripts/Package-Windows.ps1`
184+
- verifies updater metadata
185+
- verifies the tag matches the C# app project `<Version>`
185186
- uploads all top-level `dist` release assets to GitHub Releases, including the signed installer and updater metadata
186187

187-
Local packaging with `npm run package:win` creates artifacts under `dist`. It does not publish a GitHub release.
188+
Local packaging with `pwsh scripts/Package-Windows.ps1` creates artifacts under `dist`. It does not publish a GitHub release.
188189

189190
Before publishing a release, the maintainer should run or confirm the Windows smoke path:
190191

191192
- signed installer verifies with Authenticode
192193
- installer installs per-machine under `C:\Program Files\Switchify PC\`
193-
- `npm run package:win:verify-uiaccess` passes
194+
- `pwsh scripts/Verify-DotnetPackage.ps1` passes
195+
- `pwsh scripts/Verify-UpdaterMetadata.ps1` passes
194196
- app launches and stays running
195197
- tray menu works
196198
- Bluetooth pairing works
@@ -212,7 +214,7 @@ Do not push a release tag until the release PR with the matching version bump ha
212214

213215
Do not tag if:
214216

215-
- `package.json` does not match the intended tag.
217+
- The C# app project `<Version>` does not match the intended tag.
216218
- The release issue or PR milestone does not match `Release X.Y.Z`.
217219
- The signing runner is offline or busy.
218220
- The Certum certificate cannot be verified locally.

0 commit comments

Comments
 (0)