Skip to content

Report failure instead of throwing error #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/fix-libraries.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ function updateProject (project) {
// Ok, we need to create our clone of the build configs they've asked for and add it to the config lists.
const sourceConfigs = project.getBuildConfigByName(sourceBuildConfig);

// Handle cases where some configurations are missing, e.g. RCTWebSocket does not have a 'Release' config
let hasError = false;

// There are actually multiple of the same configs spread across multiple lists. Clone them all to the destination build configs.
for (const key of Object.keys(sourceConfigs)) {
const sourceConfig = sourceConfigs[key];
const configList = configListForConfig(configLists, key);

if (!configList) throw new Error(`Unable to find config list for build configuration: ${sourceConfig.name}`);
if (!configList) {
hasError = true;
continue;
}

// Copy that bad boy.
const clone = JSON.parse(JSON.stringify(sourceConfig));
Expand All @@ -58,7 +64,11 @@ function updateProject (project) {
configList.buildConfigurations.push({ value: configurationUuid, comment: destinationBuildConfig });
}

console.log(chalk.gray(` ${chalk.green('✔')} [fix-libraries]: ${chalk.green(sourceBuildConfig + ' -> ' + destinationBuildConfig + ' created')} in ${path.dirname(path.relative(process.cwd(), project.filepath))}`));
if (hasError) {
console.log(chalk.gray(` ${chalk.red('✗')} [fix-libraries]: ${chalk.red(sourceBuildConfig + ' -> ' + destinationBuildConfig + ' failed')} in ${path.dirname(path.relative(process.cwd(), project.filepath))}`));
} else {
console.log(chalk.gray(` ${chalk.green('✔')} [fix-libraries]: ${chalk.green(sourceBuildConfig + ' -> ' + destinationBuildConfig + ' created')} in ${path.dirname(path.relative(process.cwd(), project.filepath))}`));
}

changed = true;
} else {
Expand Down