Skip to content

Commit

Permalink
code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdisaster committed Feb 20, 2020
1 parent e80ca2f commit 19ec865
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
1 change: 0 additions & 1 deletion __mocks__/exe-icon-extractor.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

export const extractIcon = jest.fn();
9 changes: 4 additions & 5 deletions __tests__/mocks/mock-fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ fs.readdirSync(staticDir)
});

fs.readdirSync(vendorDir)
.forEach((file) => {
vendorContent[vendorDir][file] = '';
});
.forEach((file) => {
vendorContent[vendorDir][file] = '';
});


export function getMockFileSystem() {
Expand Down Expand Up @@ -73,6 +73,5 @@ export function getMockFileSystem() {
system[root] = mockFiles;
system[tmp] = {};
// Add files needed by this module:
return {...vendorContent, ...system, ...staticContent };
return { ...vendorContent, ...system, ...staticContent };
}

12 changes: 3 additions & 9 deletions src/utils/rc-edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ interface RcInfo {

function getFileInfo(exePath: string): Promise<any> {
const promise = new Promise<any>((resolve, reject) => {
rcinfo(exePath, (error: Error, info: any) => {
if (error) {
reject(error);
} else {
resolve(info);
}
});
rcinfo(exePath, (error: Error, info: any) => error ? reject(error) : resolve(info));
});

return promise;
Expand All @@ -37,7 +31,7 @@ async function extractIconFromApp(exePath: string, tempFolder: string): Promise<
await fs.writeFile(iconPath, buffer);
return iconPath;
} catch (error) {
console.log('Unable to extract icon from exe. Please provide an explicit icon via parameter.', error);
console.error('Unable to extract icon from exe. Please provide an explicit icon via parameter.', error);
return '';
}
}
Expand Down Expand Up @@ -69,7 +63,7 @@ export async function createStubExe(appDirectory: string,
try {
rcInfo = await getFileInfo(appExe);
} catch (error) {
console.log('Failed to read version info from exe', error);
console.warn('Unable to read file info from exe. Falling back to packaging description.', error);
}

rcOptions = {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/version-util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as semver from 'semver';
import { isNumber } from 'util';

function isWindowsComplaint(version: string): boolean {
function isWindowsCompliant(version: string): boolean {
const versionArray = version.split('.');
if (versionArray.length !== 4) {
return false;
Expand All @@ -24,7 +24,7 @@ function isWindowsComplaint(version: string): boolean {
* @returns {string}
*/
export function getWindowsCompliantVersion(input: string): string {
if (isWindowsComplaint(input)) {
if (isWindowsCompliant(input)) {
return input;
}

Expand Down

0 comments on commit 19ec865

Please sign in to comment.