Skip to content

Commit b94692c

Browse files
committed
chore: replace pify with util.promisify
1 parent 4e179c6 commit b94692c

File tree

14 files changed

+20
-33
lines changed

14 files changed

+20
-33
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
"open": "^6.0.0",
7070
"ora": "^3.0.0",
7171
"parse-author": "^2.0.0",
72-
"pify": "^4.0.0",
7372
"pretty-ms": "^5.0.0",
7473
"resolve-package": "^1.0.1",
7574
"s3": "^4.4.0",
@@ -113,7 +112,6 @@
113112
"@types/mocha": "^5.2.7",
114113
"@types/node": "^12.0.8",
115114
"@types/node-fetch": "^2.3.6",
116-
"@types/pify": "^3.0.1",
117115
"@types/pretty-ms": "^4.0.0",
118116
"@types/proxyquire": "^1.3.28",
119117
"@types/semver": "^6.0.0",

packages/api/core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"log-symbols": "^3.0.0",
5353
"node-fetch": "^2.6.0",
5454
"nugget": "^2.0.1",
55-
"pify": "^4.0.0",
5655
"resolve-package": "^1.0.1",
5756
"semver": "^6.1.1",
5857
"source-map-support": "^0.5.12",

packages/api/core/src/api/install.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import fetch from 'node-fetch';
66
import fs from 'fs-extra';
77
import os from 'os';
88
import path from 'path';
9-
import pify from 'pify';
9+
import { promisify } from 'util';
1010
import semver from 'semver';
1111

1212
import DMGInstaller from '@electron-forge/installer-dmg';
@@ -158,7 +158,7 @@ export default async ({
158158
resume: true,
159159
strictSSL: true,
160160
};
161-
await pify(nugget)(targetAsset.browser_download_url, nuggetOpts);
161+
await promisify(nugget)(targetAsset.browser_download_url, nuggetOpts);
162162
}
163163

164164
await asyncOra('Installing Application', async (installSpinner) => {

packages/api/core/src/api/package.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import debug from 'debug';
55
import fs from 'fs-extra';
66
import { getHostArch } from '@electron/get';
77
import glob from 'glob';
8-
import path from 'path';
9-
import pify from 'pify';
108
import packager from 'electron-packager';
9+
import path from 'path';
10+
import { promisify } from 'util';
1111

1212
import getForgeConfig from '../util/forge-config';
1313
import { runHook } from '../util/hook';
@@ -53,7 +53,7 @@ function sequentialHooks(hooks: Function[]) {
5353
const done = args[args.length - 1];
5454
const passedArgs = args.splice(0, args.length - 1);
5555
for (const hook of hooks) {
56-
await pify(hook)(...passedArgs);
56+
await promisify(hook)(...passedArgs);
5757
}
5858
done();
5959
}] as [(...args: any[]) => Promise<void>];
@@ -119,7 +119,7 @@ export default async ({
119119
prepareCounter += 1;
120120
prepareSpinner = ora(`Preparing to Package Application for arch: ${(prepareCounter === 2 ? 'armv7l' : 'x64').cyan}`).start();
121121
}
122-
const bins = await pify(glob)(path.join(buildPath, '**/.bin/**/*'));
122+
const bins = await promisify(glob)(path.join(buildPath, '**/.bin/**/*'));
123123
for (const bin of bins) {
124124
await fs.remove(bin);
125125
}

packages/api/core/src/util/linux-installer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { promisify } from 'util';
12
import { spawnSync } from 'child_process';
2-
import pify from 'pify';
33
import sudoPrompt from 'sudo-prompt';
44

55
const which = async (type: string, prog: string, promise: () => Promise<any>) => {
@@ -10,6 +10,6 @@ const which = async (type: string, prog: string, promise: () => Promise<any>) =>
1010
}
1111
};
1212

13-
export const sudo = (type: string, prog: string, args: string) => which(type, prog, () => pify(sudoPrompt.exec)(`${prog} ${args}`, { name: 'Electron Forge' }));
13+
export const sudo = (type: string, prog: string, args: string) => which(type, prog, () => promisify(sudoPrompt.exec)(`${prog} ${args}`, { name: 'Electron Forge' }));
1414

1515
export default which;

packages/installer/darwin/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"@electron-forge/async-ora": "6.0.0-beta.39",
1818
"@electron-forge/installer-base": "6.0.0-beta.39",
1919
"fs-extra": "^7.0.0",
20-
"pify": "^4.0.0",
2120
"sudo-prompt": "^9.0.0"
2221
}
2322
}

packages/installer/darwin/src/InstallerDarwin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import InstallerBase, { InstallerOptions } from '@electron-forge/installer-base'
33

44
import fs from 'fs-extra';
55
import path from 'path';
6-
import pify from 'pify';
6+
import { promisify } from 'util';
77
import sudo from 'sudo-prompt';
88
import { exec } from 'child_process';
99

@@ -30,9 +30,9 @@ export default abstract class InstallerDarwin extends InstallerBase {
3030

3131
const moveCommand = `${copyInstead ? 'cp -r' : 'mv'} "${appPath}" "${targetApplicationPath}"`;
3232
if (writeAccess) {
33-
await pify(exec)(moveCommand);
33+
await promisify(exec)(moveCommand);
3434
} else {
35-
await pify(sudo.exec)(moveCommand, {
35+
await promisify(sudo.exec)(moveCommand, {
3636
name: 'Electron Forge',
3737
});
3838
}

packages/installer/linux/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
},
1616
"dependencies": {
1717
"@electron-forge/installer-base": "6.0.0-beta.39",
18-
"pify": "^4.0.0",
1918
"sudo-prompt": "^9.0.0"
2019
}
2120
}

packages/installer/linux/src/InstallerLinux.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import InstallerBase, { InstallerOptions } from '@electron-forge/installer-base';
22

33
import { spawnSync } from 'child_process';
4-
import pify from 'pify';
4+
import { promisify } from 'util';
55
import sudoPrompt from 'sudo-prompt';
66

77
export { InstallerOptions };
@@ -18,6 +18,6 @@ export default abstract class InstallerLinux extends InstallerBase {
1818
sudo = (type: string, program: string, args: string) => this.which(
1919
type,
2020
program,
21-
() => pify(sudoPrompt.exec)(`${program} ${args}`, { name: 'Electron Forge' }),
21+
() => promisify(sudoPrompt.exec)(`${program} ${args}`, { name: 'Electron Forge' }),
2222
)
2323
}

packages/maker/appx/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
"@electron-forge/shared-types": "6.0.0-beta.39",
2020
"cross-spawn": "^6.0.4",
2121
"fs-extra": "^7.0.0",
22-
"parse-author": "^2.0.0",
23-
"pify": "^4.0.0"
22+
"parse-author": "^2.0.0"
2423
},
2524
"optionalDependencies": {
2625
"electron-windows-store": "^2.1.0"
2726
}
28-
}
27+
}

0 commit comments

Comments
 (0)