Skip to content

Commit bac4fb0

Browse files
committed
Fix linting errors in ios.
1 parent 4d2864d commit bac4fb0

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

src/commands/ios/index.ts

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { prompt } from 'inquirer';
2-
import { Options, SetupConfigs, IosSetupResult } from './interfaces';
3-
import { getPlatformName, iosRealDeviceUDID, symbols } from '../../utils';
4-
import { AVAILABLE_OPTIONS, SETUP_CONFIG_QUES } from './constants';
1+
import {prompt} from 'inquirer';
2+
import {Options, SetupConfigs, IosSetupResult} from './interfaces';
3+
import {getPlatformName, iosRealDeviceUDID, symbols} from '../../utils';
4+
import {AVAILABLE_OPTIONS, SETUP_CONFIG_QUES} from './constants';
55
import colors from 'ansi-colors';
6-
import { execSync } from 'child_process';
6+
import {execSync} from 'child_process';
77
import boxen from 'boxen';
88
import Logger from '../../logger';
99

@@ -81,36 +81,37 @@ export class IosSetup {
8181
Logger.log('\nVerifying the setup requirements for simulators ...');
8282

8383
try {
84-
execSync("/usr/bin/xcodebuild -version", {
84+
execSync('/usr/bin/xcodebuild -version', {
8585
stdio: 'pipe'
8686
});
8787
Logger.log(` ${colors.red(symbols().ok)} Xcode is installed in your machine\n`);
8888

89-
Logger.log(boxen(`Run the following command to get the list of simulators\n` +
89+
Logger.log(boxen('Run the following command to get the list of simulators\n' +
9090
colors.cyan.italic('xcrun simctl list devices') + '\n' +
9191
`\nAnd then update ${colors.cyan('safari:deviceName')} (eg: 'iphone 13') and ${colors.cyan('safari:platformVersion')} (eg: '15.0') in nightwatch configuration for ${colors.gray.italic('ios.simulator.safari')} environment accordingly.`
9292
, {padding: 1}));
9393
} catch (error) {
9494
Logger.log(` ${colors.red(symbols().ok)} Xcode is not installed.`);
95-
missingRequirements.push('Xcode is not installed')
95+
missingRequirements.push('Xcode is not installed');
9696
}
9797
}
9898

9999
if (setupConfigs.mode === 'real' || setupConfigs.mode === 'both') {
100100
Logger.log('\nVerifying the setup requirements for real devices...');
101101

102102
try {
103+
// eslint-disable-next-line
103104
const stdout = execSync("system_profiler SPUSBDataType | sed -n '/iPhone/,/Serial/p' | grep 'Serial Number:' | awk -F ': ' '{print $2}'", {
104105
stdio: 'pipe'
105106
});
106107

107108
if (stdout.toString() !== '') {
108109
Logger.log(boxen(
109110
colors.white(`Update ${colors.cyan('UDID')} in nightwatch configuration for ${colors.gray.italic('ios.real.safari')} environment.`) +
110-
"\nUDID: " +
111+
'\nUDID: ' +
111112
colors.cyan(iosRealDeviceUDID(stdout.toString())), {padding: 1}));
112113
} else {
113-
throw "Device is not connected";
114+
throw 'Device is not connected';
114115
}
115116
} catch (error) {
116117
Logger.log(` ${colors.red(symbols().fail)} Device is either not connected or turned off.`);
@@ -148,36 +149,36 @@ export class IosSetup {
148149
if (missingRequirements.includes('Xcode is not installed')) {
149150
Logger.log('\nSetting up missing requirements for iOS simulator...');
150151

151-
Logger.log(boxen(`${colors.cyan("If Xcode is already installed : ")}` +
152-
`${colors.white("\n 1. Run the following after changing the Xcode app name in the command ")}` +
153-
`\n ${colors.grey.italic("sudo xcode-select -switch /Applications/Xcode_x_x.app")}\n` +
152+
Logger.log(boxen(`${colors.cyan('If Xcode is already installed : ')}` +
153+
`${colors.white('\n 1. Run the following after changing the Xcode app name in the command ')}` +
154+
`\n ${colors.grey.italic('sudo xcode-select -switch /Applications/Xcode_x_x.app')}\n` +
154155

155-
`${colors.cyan("\nIf Xcode is not installed : ")}` +
156-
`${colors.green("\n [Easiest Option] : Download via the App Store for the latest version")}` +
157-
`${colors.white("\n 1. Open the App Store on your mac and Sign in with your Apple credentials")}` +
158-
`${colors.white("\n 2. Search for Xcode & click install or update. That's it!!")}\n` +
159-
`${colors.green("\n [Preferred Option] : Download via the Developer site for a specific version")}` +
160-
`${colors.white(`\n 1. Navigate to this URL ${colors.grey.italic("https://developer.apple.com/download/more/")}`)}` +
161-
`${colors.white("\n 2. Sign in with your Apple credentials")}` +
162-
`${colors.white("\n 3. Type in the version that you like, and download the Xcode_x_x.xip file")}` +
163-
`${colors.white("\n 4. Once the file is downloaded, click on .xip to extract it.")}` +
164-
`${colors.white("\n 5. Now click on that Xcode file complete all the installation process")}` +
165-
`${colors.white("\n 6. After completion drag the Xcode to Applications folder")}`, {padding: 1}));
156+
`${colors.cyan('\nIf Xcode is not installed : ')}` +
157+
`${colors.green('\n [Easiest Option] : Download via the App Store for the latest version')}` +
158+
`${colors.white('\n 1. Open the App Store on your mac and Sign in with your Apple credentials')}` +
159+
`${colors.white('\n 2. Search for Xcode & click install or update. That\'s it!!')}\n` +
160+
`${colors.green('\n [Preferred Option] : Download via the Developer site for a specific version')}` +
161+
`${colors.white(`\n 1. Navigate to this URL ${colors.grey.italic('https://developer.apple.com/download/more/')}`)}` +
162+
`${colors.white('\n 2. Sign in with your Apple credentials')}` +
163+
`${colors.white('\n 3. Type in the version that you like, and download the Xcode_x_x.xip file')}` +
164+
`${colors.white('\n 4. Once the file is downloaded, click on .xip to extract it.')}` +
165+
`${colors.white('\n 5. Now click on that Xcode file complete all the installation process')}` +
166+
`${colors.white('\n 6. After completion drag the Xcode to Applications folder')}`, {padding: 1}));
166167

167-
Logger.log(`\nFollow the guide for more detailed info ${colors.magenta("https://www.freecodecamp.org/news/how-to-download-and-install-xcode/")}\n`);
168+
Logger.log(`\nFollow the guide for more detailed info ${colors.magenta('https://www.freecodecamp.org/news/how-to-download-and-install-xcode/')}\n`);
168169

169170
result.simulator = false;
170171
}
171172
}
172173

173174
if (setupConfigs.mode === 'real' || setupConfigs.mode === 'both') {
174-
Logger.log("\nSetting up missing requirements for real devices...")
175+
Logger.log('\nSetting up missing requirements for real devices...');
175176

176-
let msg = colors.cyan("1. Remote Automation should be turned on your iOS device.") +
177-
colors.grey.italic("\n(turn it on via Settings → Safari → Advanced → Remote Automation.)");
177+
let msg = colors.cyan('1. Remote Automation should be turned on your iOS device.') +
178+
colors.grey.italic('\n(turn it on via Settings → Safari → Advanced → Remote Automation.)');
178179

179180
if (missingRequirements.includes('Device is not connected')) {
180-
msg += colors.cyan(`\n\n2. Device is connected via data cable and turned on properly.`);
181+
msg += colors.cyan('\n\n2. Device is connected via data cable and turned on properly.');
181182
result.real = false;
182183
}
183184
Logger.log(boxen(msg, {padding: 1}));

0 commit comments

Comments
 (0)