Skip to content

Commit

Permalink
feat: support MacOS Sonoma (#27)
Browse files Browse the repository at this point in the history
* ci: add macos-14 to tests
* feat: add new `--ignore-tcc-db` flag
* docs: sonoma added to readme
* chore: package version bump
  • Loading branch information
jlp-craigmorten authored Jan 31, 2024
1 parent 728a766 commit 5afe5f2
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 11 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ jobs:
name: artifacts
path: |
**/recordings/**/*
test-ignore-tcc-db:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: yarn install --frozen-lockfile
- run: yarn ci:ignore-tcc-db
- uses: actions/upload-artifact@v3
if: always()
with:
name: artifacts
path: |
**/recordings/**/*
test-nvda-install-dir:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[![MacOS Big Sur Support](https://img.shields.io/badge/macos-Big_Sur-blue.svg?logo=apple)](https://apps.apple.com/id/app/macos-big-sur/id1526878132)
[![MacOS Monetary Support](https://img.shields.io/badge/macos-Monetary-blue.svg?logo=apple)](https://apps.apple.com/us/app/macos-monterey/id1576738294)
[![MacOS Ventura Support](https://img.shields.io/badge/macos-Ventura-blue.svg?logo=apple)](https://apps.apple.com/us/app/macos-ventura/id1638787999)
[![MacOS Sonoma Support](https://img.shields.io/badge/macos-Somona-blue.svg?logo=apple)](https://apps.apple.com/us/app/macos-sonoma/id6450717509)
[![Windows 10 Support](https://img.shields.io/badge/windows-10-blue.svg?logo=windows10)](https://www.microsoft.com/en-gb/software-download/windows10ISO)
[![Windows Server 2019 Support](https://img.shields.io/badge/windows_server-2019-blue.svg?logo=windows)](https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2019)
[![Windows Server 2022 Support](https://img.shields.io/badge/windows_server-2022-blue.svg?logo=windows)](https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2022)
Expand Down Expand Up @@ -42,12 +43,26 @@ If you are using GitHub Actions, check out the dedicated [`guidepup/setup-action
If you are running this command locally, you might find it prompts you to pass in credentials so that it can using UI automation to change a checkbox value which enables the automation of VoiceOver. If you are uncomfortable with providing your credentials you can manually achieve these steps by following the [manual VoiceOver setup documentation](https://www.guidepup.dev/docs/guides/manual-voiceover-setup).
#### CI
If you are running this command in CI/CD, it is recommended to add the `--ci` flag to prevent interactive prompts:

```console
npx @guidepup/setup --ci
```

#### Ignore TCC.db Updates

If updating the TCC.db is not possible (due to SIP) or required you can skip the database update step by using the `--ignore-tcc-db` flag:

```console
npx @guidepup/setup --ignore-tcc-db
```

> Note: If the necessary permissions have not been granted by other means, using this flag may result in your environment not being setup for reliable screen reader automation.

#### Recording

If you are encountering errors in CI for MacOS you can pass a `--record` flag to the command which will output a screen-recording of the setup to a `./recordings/` directory:

```console
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@guidepup/setup",
"version": "0.14.0",
"version": "0.15.0",
"description": "Setup your environment for screen-reader automation.",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -28,6 +28,7 @@
"build": "yarn clean && yarn compile",
"ci": "yarn clean && yarn lint && yarn build && yarn resolutionFix && yarn start --ci --record",
"ci:nvda-install-dir": "yarn clean && yarn lint && yarn build && yarn resolutionFix && yarn start --ci --record --nvda-install-dir %userprofile%\\nvda",
"ci:ignore-tcc-db": "yarn clean && yarn lint && yarn build && yarn resolutionFix && yarn start --ci --record --ignore-tcc-db",
"clean": "rimraf lib",
"compile": "tsc",
"dev": "ts-node ./src/index.ts",
Expand Down
22 changes: 22 additions & 0 deletions src/logging.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import chalk from "chalk";

export const logInfo = console.info.bind(console);
export const logWarn = console.warn.bind(console);
export const logError = console.error.bind(console);

export function handleComplete(): never {
Expand All @@ -11,6 +12,27 @@ export function handleComplete(): never {
process.exit(0);
}

export function handleWarning(err: Error): void {
let message = err.message;

if (err.name) {
message = `${err.name}: ${message}`;
}

logWarn("");
logWarn(chalk.bold(chalk.yellow(`[!] ${chalk.bold(message.toString())}`)));
logWarn("");
logWarn("Unable to complete environment setup");
logWarn("");
logWarn(
chalk.dim(
"Please raise new issues at: " +
chalk.underline("https://github.com/guidepup/setup/issues")
)
);
logWarn("");
}

export function handleError(err: Error): never {
let message = err.message;

Expand Down
23 changes: 13 additions & 10 deletions src/macOS/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ import { enableDoNotDisturb } from "./enableDoNotDisturb";
import { enabledDbFile } from "./isAppleScriptControlEnabled/enabledDbFile";

const isCi = process.argv.includes("--ci");
const ignoreTccDb = process.argv.includes("--ignore-tcc-db");
const isRecorded = process.argv.includes("--record");

export async function setup(): Promise<void> {
try {
updateTccDb(USER_PATH);
} catch (e) {
if (isCi) {
throw e;
if (!ignoreTccDb) {
try {
updateTccDb(USER_PATH);
} catch (e) {
if (isCi) {
throw e;
}
}
}

try {
updateTccDb(SYSTEM_PATH);
} catch {
// Swallow error - most CI don't allow system configuration
try {
updateTccDb(SYSTEM_PATH);
} catch {
// Swallow error - most CI don't allow system configuration
}
}

const osName = platform();
Expand Down

0 comments on commit 5afe5f2

Please sign in to comment.