Skip to content

Commit

Permalink
fix(cli): Make config don't error if iOS is missing (#5212)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Nov 5, 2021
1 parent cb7eacd commit db9f12b
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,18 +343,7 @@ function determineOS(os: NodeJS.Platform): OS {
async function determineXcodeWorkspaceDirAbs(
nativeProjectDirAbs: string,
): Promise<string> {
const xcodeDir = resolve(nativeProjectDirAbs, 'App.xcworkspace');

if (!(await pathExists(xcodeDir))) {
fatal(
'Xcode workspace does not exist.\n' +
`See the docs for adding the ${c.strong('ios')} platform: ${c.strong(
'https://capacitorjs.com/docs/ios#adding-the-ios-platform',
)}`,
);
}

return xcodeDir;
return resolve(nativeProjectDirAbs, 'App.xcworkspace');
}

async function determineIOSWebDirAbs(
Expand All @@ -364,23 +353,27 @@ async function determineIOSWebDirAbs(
): Promise<string> {
const re = /path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/;
const pbxprojPath = resolve(nativeXcodeProjDirAbs, 'project.pbxproj');
const pbxproj = await readFile(pbxprojPath, { encoding: 'utf8' });
try {
const pbxproj = await readFile(pbxprojPath, { encoding: 'utf8' });

const m = pbxproj.match(re);
const m = pbxproj.match(re);

if (m && m[1] === 'SOURCE_ROOT') {
logger.warn(
`Using the iOS project root for the ${c.strong(
'public',
)} directory is deprecated.\n` +
`Please follow the Upgrade Guide to move ${c.strong(
if (m && m[1] === 'SOURCE_ROOT') {
logger.warn(
`Using the iOS project root for the ${c.strong(
'public',
)} inside the iOS target directory: ${c.strong(
'https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory',
)}`,
);
)} directory is deprecated.\n` +
`Please follow the Upgrade Guide to move ${c.strong(
'public',
)} inside the iOS target directory: ${c.strong(
'https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory',
)}`,
);

return resolve(nativeProjectDirAbs, 'public');
return resolve(nativeProjectDirAbs, 'public');
}
} catch (e) {
// ignore
}

return resolve(nativeTargetDirAbs, 'public');
Expand Down

0 comments on commit db9f12b

Please sign in to comment.