Skip to content

Commit 58b452f

Browse files
authored
feat: support latest GH action runner (#53)
1 parent ccfb55d commit 58b452f

11 files changed

Lines changed: 81 additions & 39 deletions

.github/workflows/resolutionFix.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { execSync } from "child_process";
33
if (process.platform === "darwin") {
44
try {
55
execSync(
6-
`"/Library/Application Support/VMware Tools/vmware-resolutionSet" 1920 1080`
6+
`"/Library/Application Support/VMware Tools/vmware-resolutionSet" 1920 1080`,
7+
{ encoding: "utf8" }
78
);
89
} catch (_) {
910
// swallow

.github/workflows/test.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
os: [macos-14, macos-15, macos-26, windows-2022, windows-2025]
16+
os:
17+
[
18+
macos-14,
19+
macos-15,
20+
macos-15-intel,
21+
macos-26,
22+
macos-26-intel,
23+
windows-2022,
24+
windows-2025,
25+
windows-11-arm,
26+
]
1727
steps:
1828
- uses: actions/checkout@v5
1929
- uses: actions/setup-node@v6
@@ -31,7 +41,7 @@ jobs:
3141
runs-on: ${{ matrix.os }}
3242
strategy:
3343
matrix:
34-
os: [macos-14]
44+
os: [macos-latest]
3545
steps:
3646
- uses: actions/checkout@v5
3747
- uses: actions/setup-node@v6
@@ -49,7 +59,7 @@ jobs:
4959
runs-on: ${{ matrix.os }}
5060
strategy:
5161
matrix:
52-
os: [windows-2022, windows-2025]
62+
os: [windows-2022, windows-2025, windows-11-arm]
5363
steps:
5464
- uses: actions/checkout@v5
5565
- uses: actions/setup-node@v6

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@guidepup/setup",
3-
"version": "0.21.0",
3+
"version": "0.22.0",
44
"description": "Setup your environment for screen-reader automation.",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
@@ -48,8 +48,10 @@
4848
"ts-node": "^10.9.2",
4949
"typescript": "^5.6.2"
5050
},
51+
"optionalDependencies": {
52+
"@guidepup/record": "^0.1.0"
53+
},
5154
"dependencies": {
52-
"@guidepup/record": "^0.1.0",
5355
"chalk": "^4.0.0",
5456
"decompress": "^4.2.1",
5557
"https-proxy-agent": "^7.0.5",

src/macOS/disableDictationInputAutoEnable.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import { ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS } from "../errors";
44
export function disableDictationInputAutoEnable(): void {
55
try {
66
execSync(
7-
"defaults write com.apple.HIToolbox AppleDictationAutoEnable -bool false"
7+
"defaults write com.apple.HIToolbox AppleDictationAutoEnable -bool false",
8+
{ encoding: "utf8" }
89
);
910
} catch (e) {
10-
throw new Error(`${ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS}\n\n${e.message}`);
11+
throw new Error(
12+
`${ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS}\n\n${e.message}`
13+
);
1114
}
1215
}

src/macOS/disableSplashScreenSystemDefaults.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import { ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS } from "../errors";
44
export function disableSplashScreenSystemDefaults(): void {
55
try {
66
execSync(
7-
"defaults write com.apple.VoiceOverTraining doNotShowSplashScreen -bool true"
7+
"defaults write com.apple.VoiceOverTraining doNotShowSplashScreen -bool true",
8+
{ encoding: "utf8" }
89
);
910
} catch (e) {
10-
throw new Error(`${ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS}\n\n${e.message}`);
11+
throw new Error(
12+
`${ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS}\n\n${e.message}`
13+
);
1114
}
1215
}

src/macOS/enableAppleScriptControlSystemDefaults.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import { ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS } from "../errors";
44
export function enableAppleScriptControlSystemDefaults(): void {
55
try {
66
execSync(
7-
"defaults write com.apple.VoiceOver4/default SCREnableAppleScript -bool true"
7+
"defaults write com.apple.VoiceOver4/default SCREnableAppleScript -bool true",
8+
{ encoding: "utf8" },
89
);
10+
11+
return;
912
} catch (e) {
10-
throw new Error(`${ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS}\n\n${e.message}`);
13+
throw new Error(
14+
`${ERR_MACOS_UNABLE_UPDATE_SYSTEM_DEFAULTS}\n\n${e.message}`,
15+
);
1116
}
1217
}

src/macOS/enableDoNotDisturb.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { exec } from "child_process";
2-
import * as os from "os";
2+
import { promisify } from "util";
33
import { ERR_MACOS_FAILED_TO_ENABLE_DO_NOT_DISTURB } from "../errors";
44
import { runAppleScript } from "./runAppleScript";
5-
import { promisify } from "util";
65
import { retryOnError } from "./retryOnError";
6+
import { getPlatformVersionMajor } from "./getPlatformVersionMajor";
77

88
// REF: https://github.com/sindresorhus/do-not-disturb/issues/9
99
const enableFocusModeShellscript = `defaults write com.apple.ncprefs.plist dnd_prefs -data 62706C6973743030D60102030405060708080A08085B646E644D6972726F7265645F100F646E64446973706C6179536C6565705F101E72657065617465644661636574696D6543616C6C73427265616B73444E445875736572507265665E646E64446973706C61794C6F636B5F10136661636574696D6543616E427265616B444E44090808D30B0C0D070F1057656E61626C6564546461746556726561736F6E093341C2B41C4FC9D3891001080808152133545D6C828384858C9499A0A1AAACAD00000000000001010000000000000013000000000000000000000000000000AE && killall usernoted && killall ControlCenter`;
@@ -39,7 +39,7 @@ my withTimeout(command, timeoutSeconds)
3939

4040
const enableFocusModeVenturaAppleScript = (
4141
locale: string,
42-
platformMajor: number
42+
platformMajor: number,
4343
) => {
4444
// TODO: attempt to rewrite scripts without any locale specific instructions
4545
// so this setup can be used regardless of user locale preferences.
@@ -97,7 +97,7 @@ my withTimeout(command, timeoutSeconds)
9797
};
9898

9999
export async function enableDoNotDisturb() {
100-
const platformMajor = Number(os.version().split("Version ")[1].split(".")[0]);
100+
const platformMajor = getPlatformVersionMajor();
101101

102102
try {
103103
if (platformMajor <= 20) {
@@ -110,12 +110,14 @@ export async function enableDoNotDisturb() {
110110

111111
// From MacOS 13 Ventura (Darwin 22) there is no known way to enable DND via system settings
112112
await retryOnError(() =>
113-
runAppleScript(enableFocusModeVenturaAppleScript(locale, platformMajor))
113+
runAppleScript(
114+
enableFocusModeVenturaAppleScript(locale, platformMajor),
115+
),
114116
);
115117
}
116118
} catch (e) {
117119
throw new Error(
118-
`${ERR_MACOS_FAILED_TO_ENABLE_DO_NOT_DISTURB}\n\n${e.message}`
120+
`${ERR_MACOS_FAILED_TO_ENABLE_DO_NOT_DISTURB}\n\n${e.message}`,
119121
);
120122
}
121123
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { version } from "os";
2+
3+
export const getPlatformVersionMajor = () =>
4+
Number(version().split("Version ")[1].split(".")[0]);
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { exec } from "child_process";
1+
import { execSync } from "child_process";
22

33
const VOICE_OVER_APPLESCRIPT_ENABLED_DEFAULTS =
44
"defaults read com.apple.VoiceOver4/default SCREnableAppleScript";
55

6-
export async function enabledDefaults(): Promise<boolean> {
7-
return await new Promise<boolean>((resolve) => {
8-
exec(VOICE_OVER_APPLESCRIPT_ENABLED_DEFAULTS, (err, stdout) => {
9-
if (err) {
10-
resolve(false);
11-
} else {
12-
resolve(stdout.trim() === "1");
13-
}
6+
export function enabledDefaults(): boolean {
7+
try {
8+
const result = execSync(VOICE_OVER_APPLESCRIPT_ENABLED_DEFAULTS, {
9+
encoding: "utf8",
1410
});
15-
});
11+
12+
return result.trim() === "1";
13+
} catch {
14+
return false;
15+
}
1616
}

src/macOS/setup.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { platform, release } from "os";
2-
import { macOSRecord } from "@guidepup/record";
32
import chalk from "chalk";
43
import { checkVersion } from "./checkVersion";
54
import { enableAppleScriptControlSystemDefaults } from "./enableAppleScriptControlSystemDefaults";
@@ -36,18 +35,29 @@ export async function setup(): Promise<void> {
3635
} else {
3736
handleWarning(
3837
"Ignoring TCC.db updates",
39-
"If the necessary permissions have not been granted by other means, using this flag may result in your environment not being set up for reliable screen reader automation."
38+
"If the necessary permissions have not been granted by other means, using this flag may result in your environment not being set up for reliable screen reader automation.",
4039
);
4140
}
4241

4342
const osName = platform();
4443
const osVersion = release();
4544

46-
const stopRecording = isRecorded
47-
? macOSRecord(
48-
`./recordings/macos-guidepup-setup-${osName}-${osVersion}-${+new Date()}.mov`
49-
)
50-
: () => null;
45+
let stopRecording: () => void = () => null;
46+
47+
if (isRecorded) {
48+
try {
49+
const { macOSRecord } = await import("@guidepup/record");
50+
51+
stopRecording = macOSRecord(
52+
`./recordings/macos-guidepup-setup-${osName}-${osVersion}-${+new Date()}.mov`,
53+
);
54+
} catch {
55+
handleWarning(
56+
"@guidepup/record not available",
57+
"Recording will be skipped. This is expected on platforms without ffmpeg support (e.g., Windows ARM64).",
58+
);
59+
}
60+
}
5161

5262
try {
5363
checkVersion();
@@ -77,9 +87,9 @@ export async function setup(): Promise<void> {
7787
"Please complete remaining setup by following this guide:\n\n--> " +
7888
chalk.underline(
7989
chalk.bold(
80-
"https://www.guidepup.dev/docs/guides/manual-voiceover-setup"
81-
)
82-
)
90+
"https://www.guidepup.dev/docs/guides/manual-voiceover-setup",
91+
),
92+
),
8393
);
8494
} finally {
8595
stopRecording();

0 commit comments

Comments
 (0)