From ea92f47d901e260983a3e28e209a764a0d8b567b Mon Sep 17 00:00:00 2001 From: Artem Egorov Date: Tue, 20 Mar 2018 14:41:26 -0700 Subject: [PATCH] While linking plugin ask for params only once Summary: Resolve #18333 CLI should ask users for params only once and waiting for response while linking plugin Ran the `link` commands for iOS and Android and confirmed that params requested only once. [CLI][FEATURE][local-cli/link/link.js] - Requesting link params only once for all platforms Closes https://github.com/facebook/react-native/pull/18349 Differential Revision: D7342181 Pulled By: hramos fbshipit-source-id: a10f0f7f2170f067d78b30e5a5221634b77da577 --- local-cli/link/link.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/local-cli/link/link.js b/local-cli/link/link.js index b77c135f9..66e9efbf5 100644 --- a/local-cli/link/link.js +++ b/local-cli/link/link.js @@ -37,7 +37,9 @@ log.heading = 'rnpm-link'; const dedupeAssets = (assets) => uniqBy(assets, asset => path.basename(asset)); -const linkDependency = (platforms, project, dependency) => { +const linkDependency = async (platforms, project, dependency) => { + const params = await pollParams(dependency.config.params); + Object.keys(platforms || {}) .forEach(platform => { if (!project[platform] || !dependency.config[platform]) { @@ -56,18 +58,16 @@ const linkDependency = (platforms, project, dependency) => { return null; } - return pollParams(dependency.config.params).then(params => { - log.info(`Linking ${dependency.name} ${platform} dependency`); + log.info(`Linking ${dependency.name} ${platform} dependency`); - linkConfig.register( - dependency.name, - dependency.config[platform], - params, - project[platform] - ); + linkConfig.register( + dependency.name, + dependency.config[platform], + params, + project[platform] + ); - log.info(`Platform '${platform}' module ${dependency.name} has been successfully linked`); - }); + log.info(`Platform '${platform}' module ${dependency.name} has been successfully linked`); }); };