Skip to content

Commit

Permalink
feat: add warning when ignore tcc db updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jlp-craigmorten committed Feb 1, 2024
1 parent fa3066b commit f62278d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ 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.
> 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.
#### Recording

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@guidepup/setup",
"version": "0.15.0",
"version": "0.15.1",
"description": "Setup your environment for screen-reader automation.",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
21 changes: 4 additions & 17 deletions src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,12 @@ 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())}`)));
export function handleWarning(title: string, subtitle: string): void {
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(chalk.bold(chalk.yellow(`[!] Warning: ${chalk.bold(title)}`)));
logWarn("");
logWarn(subtitle);
logError("");
}

export function handleError(err: Error): never {
Expand Down
7 changes: 6 additions & 1 deletion src/macOS/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SYSTEM_PATH, USER_PATH, updateTccDb } from "./updateTccDb";
import { isAppleScriptControlEnabled } from "./isAppleScriptControlEnabled";
import { askUserToControlUi } from "./askUserToControlUi";
import { setVoiceOverEnabledViaUi } from "./setVoiceOverEnabledViaUi";
import { logInfo } from "../logging";
import { handleWarning, logInfo } from "../logging";
import { ERR_MACOS_REQUIRES_MANUAL_USER_INTERACTION } from "../errors";
import { enableDoNotDisturb } from "./enableDoNotDisturb";
import { enabledDbFile } from "./isAppleScriptControlEnabled/enabledDbFile";
Expand All @@ -34,6 +34,11 @@ export async function setup(): Promise<void> {
} catch {
// Swallow error - most CI don't allow system configuration
}
} else {
handleWarning(
"Ignoring TCC.db updates",
"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."
);
}

const osName = platform();
Expand Down

0 comments on commit f62278d

Please sign in to comment.