Skip to content

Commit 0b4fdcc

Browse files
committed
remove deprecated options
1 parent 13ede9e commit 0b4fdcc

File tree

5 files changed

+5
-76
lines changed

5 files changed

+5
-76
lines changed

src/artifact-utils.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,7 @@ export async function getArtifactRemoteURL(details: ElectronArtifactDetails): Pr
5151
const opts: MirrorOptions = details.mirrorOptions || {};
5252
let base = mirrorVar('mirror', opts, BASE_URL);
5353
if (details.version.includes('nightly')) {
54-
const nightlyDeprecated = mirrorVar('nightly_mirror', opts, '');
55-
if (nightlyDeprecated) {
56-
base = nightlyDeprecated;
57-
console.warn(`nightly_mirror is deprecated, please use nightlyMirror`);
58-
} else {
59-
base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL);
60-
}
54+
base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL);
6155
}
6256
const path = mirrorVar('customDir', opts, details.version).replace(
6357
'{{ version }}',

src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ async function validateArtifact(
7777
isGeneric: true,
7878
version: artifactDetails.version,
7979
artifactName: 'SHASUMS256.txt',
80-
force: false,
8180
downloadOptions: artifactDetails.downloadOptions,
8281
cacheRoot: artifactDetails.cacheRoot,
8382
downloader: artifactDetails.downloader,

src/types.ts

-14
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ export type DownloadOptions = any;
2828
* ```
2929
*/
3030
export interface MirrorOptions {
31-
/**
32-
* @deprecated
33-
* @see {@link MirrorOptions.nightlyMirror}
34-
*/
35-
nightly_mirror?: string;
3631
/**
3732
* The mirror URL for [`electron-nightly`](https://npmjs.com/package/electron-nightly),
3833
* which lives in a separate npm package.
@@ -108,13 +103,6 @@ export enum ElectronDownloadCacheMode {
108103
* @category Download Electron
109104
*/
110105
export interface ElectronDownloadRequestOptions {
111-
/**
112-
* Whether to download an artifact regardless of whether it's in the cache directory.
113-
*
114-
* @defaultValue `false`
115-
* @deprecated This option is deprecated and directly maps to {@link cacheMode | `cacheMode: ElectronDownloadCacheMode.WriteOnly`}
116-
*/
117-
force?: boolean;
118106
/**
119107
* When set to `true`, disables checking that the artifact download completed successfully
120108
* with the correct payload.
@@ -184,8 +172,6 @@ export interface ElectronDownloadRequestOptions {
184172
* should not move or delete the file path that is returned as the path
185173
* points directly to the disk cache.
186174
*
187-
* This option cannot be used in conjunction with {@link ElectronDownloadRequestOptions.force}.
188-
*
189175
* @defaultValue {@link ElectronDownloadCacheMode.ReadWrite}
190176
*/
191177
cacheMode?: ElectronDownloadCacheMode;

src/utils.ts

-9
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,6 @@ export function setEnv(key: string, value: string | undefined): void {
147147
export function effectiveCacheMode(
148148
artifactDetails: ElectronPlatformArtifactDetailsWithDefaults | ElectronGenericArtifactDetails,
149149
): ElectronDownloadCacheMode {
150-
if (artifactDetails.force) {
151-
if (artifactDetails.cacheMode) {
152-
throw new Error(
153-
'Setting both "force" and "cacheMode" is not supported, please exclusively use "cacheMode"',
154-
);
155-
}
156-
return ElectronDownloadCacheMode.WriteOnly;
157-
}
158-
159150
return artifactDetails.cacheMode || ElectronDownloadCacheMode.ReadWrite;
160151
}
161152

test/index.spec.ts

+4-45
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import crypto from 'node:crypto';
21
import fs from 'node:fs';
32
import os from 'node:os';
43
import path from 'node:path';
@@ -45,46 +44,6 @@ describe('Public API', () => {
4544
expect(path.extname(zipPath)).toEqual('.zip');
4645
});
4746

48-
it('should not redownload when force=false', async () => {
49-
const zipPath = await download('2.0.9', {
50-
cacheRoot,
51-
downloader,
52-
force: false,
53-
});
54-
await fs.promises.writeFile(zipPath, 'bad content');
55-
const zipPath2 = await download('2.0.9', {
56-
cacheRoot,
57-
downloader,
58-
force: false,
59-
});
60-
expect(zipPath).toEqual(zipPath2);
61-
expect(await fs.promises.readFile(zipPath, 'utf8')).toEqual('bad content');
62-
});
63-
64-
it('should redownload when force=true', async () => {
65-
const zipPath = await download('2.0.9', {
66-
cacheRoot,
67-
downloader,
68-
force: true,
69-
});
70-
const hash = crypto
71-
.createHash('sha256')
72-
.update(await fs.promises.readFile(zipPath))
73-
.digest('hex');
74-
await fs.promises.writeFile(zipPath, 'bad content');
75-
const zipPath2 = await download('2.0.9', {
76-
cacheRoot,
77-
downloader,
78-
force: true,
79-
});
80-
expect(zipPath).toEqual(zipPath2);
81-
const hash2 = crypto
82-
.createHash('sha256')
83-
.update(await fs.promises.readFile(zipPath2))
84-
.digest('hex');
85-
expect(hash).toEqual(hash2);
86-
});
87-
8847
it('should accept a custom downloader', async () => {
8948
const zipPath = await download('2.0.3', {
9049
cacheRoot,
@@ -316,13 +275,13 @@ describe('Public API', () => {
316275
await downloadArtifact({
317276
artifactName: 'electron',
318277
downloader,
319-
force: true,
278+
cacheMode: ElectronDownloadCacheMode.WriteOnly,
320279
version: 'v1.3.5',
321280
});
322281
await downloadArtifact({
323282
artifactName: 'electron',
324283
downloader,
325-
force: true,
284+
cacheMode: ElectronDownloadCacheMode.WriteOnly,
326285
version: 'v2.0.3',
327286
});
328287

@@ -334,7 +293,7 @@ describe('Public API', () => {
334293
await downloadArtifact({
335294
artifactName: 'electron',
336295
downloader,
337-
force: true,
296+
cacheMode: ElectronDownloadCacheMode.WriteOnly,
338297
version: 'v1.3.3',
339298
});
340299

@@ -346,7 +305,7 @@ describe('Public API', () => {
346305
await downloadArtifact({
347306
artifactName: 'electron',
348307
downloader,
349-
force: true,
308+
cacheMode: ElectronDownloadCacheMode.WriteOnly,
350309
version: 'v1.0.0',
351310
});
352311

0 commit comments

Comments
 (0)