Skip to content
Permalink
Browse files

chore: replace pify with util.promisify

  • Loading branch information
malept committed Jun 15, 2019
1 parent 4e179c6 commit b94692c4a8ae0f72241abbfc7a10392712c789a9
@@ -69,7 +69,6 @@
"open": "^6.0.0",
"ora": "^3.0.0",
"parse-author": "^2.0.0",
"pify": "^4.0.0",
"pretty-ms": "^5.0.0",
"resolve-package": "^1.0.1",
"s3": "^4.4.0",
@@ -113,7 +112,6 @@
"@types/mocha": "^5.2.7",
"@types/node": "^12.0.8",
"@types/node-fetch": "^2.3.6",
"@types/pify": "^3.0.1",
"@types/pretty-ms": "^4.0.0",
"@types/proxyquire": "^1.3.28",
"@types/semver": "^6.0.0",
@@ -52,7 +52,6 @@
"log-symbols": "^3.0.0",
"node-fetch": "^2.6.0",
"nugget": "^2.0.1",
"pify": "^4.0.0",
"resolve-package": "^1.0.1",
"semver": "^6.1.1",
"source-map-support": "^0.5.12",
@@ -6,7 +6,7 @@ import fetch from 'node-fetch';
import fs from 'fs-extra';
import os from 'os';
import path from 'path';
import pify from 'pify';
import { promisify } from 'util';
import semver from 'semver';

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

await asyncOra('Installing Application', async (installSpinner) => {
@@ -5,9 +5,9 @@ import debug from 'debug';
import fs from 'fs-extra';
import { getHostArch } from '@electron/get';
import glob from 'glob';
import path from 'path';
import pify from 'pify';
import packager from 'electron-packager';
import path from 'path';
import { promisify } from 'util';

import getForgeConfig from '../util/forge-config';
import { runHook } from '../util/hook';
@@ -53,7 +53,7 @@ function sequentialHooks(hooks: Function[]) {
const done = args[args.length - 1];
const passedArgs = args.splice(0, args.length - 1);
for (const hook of hooks) {
await pify(hook)(...passedArgs);
await promisify(hook)(...passedArgs);
}
done();
}] as [(...args: any[]) => Promise<void>];
@@ -119,7 +119,7 @@ export default async ({
prepareCounter += 1;
prepareSpinner = ora(`Preparing to Package Application for arch: ${(prepareCounter === 2 ? 'armv7l' : 'x64').cyan}`).start();
}
const bins = await pify(glob)(path.join(buildPath, '**/.bin/**/*'));
const bins = await promisify(glob)(path.join(buildPath, '**/.bin/**/*'));
for (const bin of bins) {
await fs.remove(bin);
}
@@ -1,5 +1,5 @@
import { promisify } from 'util';
import { spawnSync } from 'child_process';
import pify from 'pify';
import sudoPrompt from 'sudo-prompt';

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

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

export default which;
@@ -17,7 +17,6 @@
"@electron-forge/async-ora": "6.0.0-beta.39",
"@electron-forge/installer-base": "6.0.0-beta.39",
"fs-extra": "^7.0.0",
"pify": "^4.0.0",
"sudo-prompt": "^9.0.0"
}
}
@@ -3,7 +3,7 @@ import InstallerBase, { InstallerOptions } from '@electron-forge/installer-base'

import fs from 'fs-extra';
import path from 'path';
import pify from 'pify';
import { promisify } from 'util';
import sudo from 'sudo-prompt';
import { exec } from 'child_process';

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

const moveCommand = `${copyInstead ? 'cp -r' : 'mv'} "${appPath}" "${targetApplicationPath}"`;
if (writeAccess) {
await pify(exec)(moveCommand);
await promisify(exec)(moveCommand);
} else {
await pify(sudo.exec)(moveCommand, {
await promisify(sudo.exec)(moveCommand, {
name: 'Electron Forge',
});
}
@@ -15,7 +15,6 @@
},
"dependencies": {
"@electron-forge/installer-base": "6.0.0-beta.39",
"pify": "^4.0.0",
"sudo-prompt": "^9.0.0"
}
}
@@ -1,7 +1,7 @@
import InstallerBase, { InstallerOptions } from '@electron-forge/installer-base';

import { spawnSync } from 'child_process';
import pify from 'pify';
import { promisify } from 'util';
import sudoPrompt from 'sudo-prompt';

export { InstallerOptions };
@@ -18,6 +18,6 @@ export default abstract class InstallerLinux extends InstallerBase {
sudo = (type: string, program: string, args: string) => this.which(
type,
program,
() => pify(sudoPrompt.exec)(`${program} ${args}`, { name: 'Electron Forge' }),
() => promisify(sudoPrompt.exec)(`${program} ${args}`, { name: 'Electron Forge' }),
)
}
@@ -19,10 +19,9 @@
"@electron-forge/shared-types": "6.0.0-beta.39",
"cross-spawn": "^6.0.4",
"fs-extra": "^7.0.0",
"parse-author": "^2.0.0",
"pify": "^4.0.0"
"parse-author": "^2.0.0"
},
"optionalDependencies": {
"electron-windows-store": "^2.1.0"
}
}
}
@@ -20,8 +20,7 @@
"dependencies": {
"@electron-forge/maker-base": "6.0.0-beta.39",
"@electron-forge/shared-types": "6.0.0-beta.39",
"fs-extra": "^7.0.0",
"pify": "^4.0.0"
"fs-extra": "^7.0.0"
},
"optionalDependencies": {
"@malept/electron-installer-flatpak": "^0.10.0"
@@ -18,7 +18,6 @@
"@electron-forge/maker-base": "6.0.0-beta.39",
"@electron-forge/shared-types": "6.0.0-beta.39",
"cross-zip": "^2.1.5",
"fs-extra": "^7.0.0",
"pify": "^4.0.0"
"fs-extra": "^7.0.0"
}
}
}
@@ -2,7 +2,7 @@ import MakerBase, { MakerOptions } from '@electron-forge/maker-base';
import { ForgePlatform } from '@electron-forge/shared-types';

import path from 'path';
import pify from 'pify';
import { promisify } from 'util';

export type MakerZIPConfig = {};

@@ -30,7 +30,7 @@ export default class MakerZIP extends MakerBase<MakerZIPConfig> {
const zipPath = path.resolve(makeDir, `${path.basename(dir)}-${packageJSON.version}.zip`);

await this.ensureFile(zipPath);
await pify(zip)(zipDir, zipPath);
await promisify(zip)(zipDir, zipPath);

return [zipPath];
}
@@ -1123,11 +1123,6 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.8.tgz#551466be11b2adc3f3d47156758f610bd9f6b1d8"
integrity sha512-b8bbUOTwzIY3V5vDTY1fIJ+ePKDUBqt2hC2woVGotdQQhG/2Sh62HOKHrT7ab+VerXAcPyAiTEipPu/FsreUtg==

"@types/pify@^3.0.1":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@types/pify/-/pify-3.0.2.tgz#1bc75dac43e31dba981c37e0a08edddc1b49cd39"
integrity sha512-a5AKF1/9pCU3HGMkesgY6LsBdXHUY3WU+I2qgpU0J+I8XuJA1aFr59eS84/HP0+dxsyBSNbt+4yGI2adUpHwSg==

"@types/pretty-ms@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/pretty-ms/-/pretty-ms-4.0.0.tgz#5e5177b9e447fbc8446e6fd2b09aea045971f11d"

0 comments on commit b94692c

Please sign in to comment.
You can’t perform that action at this time.