Skip to content

Commit

Permalink
feat: fetch NVDA from it's own repo releases
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorten committed Jan 28, 2023
1 parent 433ab96 commit 285d669
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Binary file removed downloads/guidepup_nvda.zip
Binary file not shown.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@guidepup/setup",
"version": "0.10.0",
"version": "0.11.0",
"description": "Setup your environment for screen-reader automation.",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -52,5 +52,6 @@
"inquirer": "^8.2.0",
"regedit": "5.0.1",
"semver": "^7.3.8"
}
},
"guidepupNvdaVersion": "0.1.0-2021.3.1"
}
5 changes: 3 additions & 2 deletions src/windows/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version } = require("../../package.json");
const { guidepupNvdaVersion } = require("../../package.json");

export const GUIDEPUP_NVDA_VERSION = guidepupNvdaVersion;
export const SUB_KEY_GUIDEPUP_NVDA = "HKCU\\Software\\Guidepup\\Nvda";
export const VERSIONED_KEY = `guidepup_nvda_${version}`;
export const VERSIONED_KEY = `guidepup_nvda_${GUIDEPUP_NVDA_VERSION}`;

export const SUB_KEY_CONTROL_PANEL_DESKTOP = "HKCU\\Control Panel\\Desktop";
export const FOREGROUND_LOCK_TIMEOUT_KEY = "ForegroundLockTimeout";
Expand Down
10 changes: 7 additions & 3 deletions src/windows/installNvda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { createWriteStream, mkdtempSync, rmSync } from "fs";
import { join } from "path";
import { tmpdir } from "os";
import { ERR_WINDOWS_FAILED_TO_INSTALL_NVDA } from "../errors";
import { GUIDEPUP_NVDA_VERSION } from "./constants";

const appName = "guidepup_nvda";
const sourceUrl = `https://raw.githubusercontent.com/guidepup/setup/main/downloads/${appName}.zip`;
const sourceUrl = `https://codeload.github.com/guidepup/nvda/zip/refs/tags/${GUIDEPUP_NVDA_VERSION}`;

export async function installNvda(): Promise<string> {
const destinationBaseDirectory = mkdtempSync(join(tmpdir(), `${appName}_`));
const destinationDirectory = join(destinationBaseDirectory, appName);
const destinationZip = join(destinationBaseDirectory, `${appName}.zip`);
const fileZip = createWriteStream(destinationZip);

Expand Down Expand Up @@ -57,5 +57,9 @@ export async function installNvda(): Promise<string> {
throw new Error(`${ERR_WINDOWS_FAILED_TO_INSTALL_NVDA}\n\n${e.message}`);
}

return destinationDirectory;
return join(
destinationBaseDirectory,
`nvda-${GUIDEPUP_NVDA_VERSION}`,
"nvda"
);
}

0 comments on commit 285d669

Please sign in to comment.