diff --git a/src/artifact-utils.ts b/src/artifact-utils.ts index bf574a4a..ac00198b 100644 --- a/src/artifact-utils.ts +++ b/src/artifact-utils.ts @@ -51,13 +51,7 @@ export async function getArtifactRemoteURL(details: ElectronArtifactDetails): Pr const opts: MirrorOptions = details.mirrorOptions || {}; let base = mirrorVar('mirror', opts, BASE_URL); if (details.version.includes('nightly')) { - const nightlyDeprecated = mirrorVar('nightly_mirror', opts, ''); - if (nightlyDeprecated) { - base = nightlyDeprecated; - console.warn(`nightly_mirror is deprecated, please use nightlyMirror`); - } else { - base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL); - } + base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL); } const path = mirrorVar('customDir', opts, details.version).replace( '{{ version }}', diff --git a/src/index.ts b/src/index.ts index 0c71a4de..bccdcbab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -77,7 +77,6 @@ async function validateArtifact( isGeneric: true, version: artifactDetails.version, artifactName: 'SHASUMS256.txt', - force: false, downloadOptions: artifactDetails.downloadOptions, cacheRoot: artifactDetails.cacheRoot, downloader: artifactDetails.downloader, diff --git a/src/types.ts b/src/types.ts index c753e188..26762f7b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -28,11 +28,6 @@ export type DownloadOptions = any; * ``` */ export interface MirrorOptions { - /** - * @deprecated - * @see {@link MirrorOptions.nightlyMirror} - */ - nightly_mirror?: string; /** * The mirror URL for [`electron-nightly`](https://npmjs.com/package/electron-nightly), * which lives in a separate npm package. @@ -108,13 +103,6 @@ export enum ElectronDownloadCacheMode { * @category Download Electron */ export interface ElectronDownloadRequestOptions { - /** - * Whether to download an artifact regardless of whether it's in the cache directory. - * - * @defaultValue `false` - * @deprecated This option is deprecated and directly maps to {@link cacheMode | `cacheMode: ElectronDownloadCacheMode.WriteOnly`} - */ - force?: boolean; /** * When set to `true`, disables checking that the artifact download completed successfully * with the correct payload. @@ -184,8 +172,6 @@ export interface ElectronDownloadRequestOptions { * should not move or delete the file path that is returned as the path * points directly to the disk cache. * - * This option cannot be used in conjunction with {@link ElectronDownloadRequestOptions.force}. - * * @defaultValue {@link ElectronDownloadCacheMode.ReadWrite} */ cacheMode?: ElectronDownloadCacheMode; diff --git a/src/utils.ts b/src/utils.ts index d7ba0849..4fdcf18b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -147,15 +147,6 @@ export function setEnv(key: string, value: string | undefined): void { export function effectiveCacheMode( artifactDetails: ElectronPlatformArtifactDetailsWithDefaults | ElectronGenericArtifactDetails, ): ElectronDownloadCacheMode { - if (artifactDetails.force) { - if (artifactDetails.cacheMode) { - throw new Error( - 'Setting both "force" and "cacheMode" is not supported, please exclusively use "cacheMode"', - ); - } - return ElectronDownloadCacheMode.WriteOnly; - } - return artifactDetails.cacheMode || ElectronDownloadCacheMode.ReadWrite; } diff --git a/test/index.spec.ts b/test/index.spec.ts index 47d002cc..7fb8e4a8 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -1,4 +1,3 @@ -import crypto from 'node:crypto'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; @@ -45,46 +44,6 @@ describe('Public API', () => { expect(path.extname(zipPath)).toEqual('.zip'); }); - it('should not redownload when force=false', async () => { - const zipPath = await download('2.0.9', { - cacheRoot, - downloader, - force: false, - }); - await fs.promises.writeFile(zipPath, 'bad content'); - const zipPath2 = await download('2.0.9', { - cacheRoot, - downloader, - force: false, - }); - expect(zipPath).toEqual(zipPath2); - expect(await fs.promises.readFile(zipPath, 'utf8')).toEqual('bad content'); - }); - - it('should redownload when force=true', async () => { - const zipPath = await download('2.0.9', { - cacheRoot, - downloader, - force: true, - }); - const hash = crypto - .createHash('sha256') - .update(await fs.promises.readFile(zipPath)) - .digest('hex'); - await fs.promises.writeFile(zipPath, 'bad content'); - const zipPath2 = await download('2.0.9', { - cacheRoot, - downloader, - force: true, - }); - expect(zipPath).toEqual(zipPath2); - const hash2 = crypto - .createHash('sha256') - .update(await fs.promises.readFile(zipPath2)) - .digest('hex'); - expect(hash).toEqual(hash2); - }); - it('should accept a custom downloader', async () => { const zipPath = await download('2.0.3', { cacheRoot, @@ -316,13 +275,13 @@ describe('Public API', () => { await downloadArtifact({ artifactName: 'electron', downloader, - force: true, + cacheMode: ElectronDownloadCacheMode.WriteOnly, version: 'v1.3.5', }); await downloadArtifact({ artifactName: 'electron', downloader, - force: true, + cacheMode: ElectronDownloadCacheMode.WriteOnly, version: 'v2.0.3', }); @@ -334,7 +293,7 @@ describe('Public API', () => { await downloadArtifact({ artifactName: 'electron', downloader, - force: true, + cacheMode: ElectronDownloadCacheMode.WriteOnly, version: 'v1.3.3', }); @@ -346,7 +305,7 @@ describe('Public API', () => { await downloadArtifact({ artifactName: 'electron', downloader, - force: true, + cacheMode: ElectronDownloadCacheMode.WriteOnly, version: 'v1.0.0', });