From 85a2d6a65d373b0f3cc94d1ad2ca1dc9b7717809 Mon Sep 17 00:00:00 2001 From: Gant Laborde Date: Tue, 23 Aug 2016 07:43:10 -0700 Subject: [PATCH] Add logging level for RNPM previous linking Summary: Sometimes when working with a team of developers, someone adds a library but does not link it. To identify if this required linking, you have to type `react-native link` and then read a wall of text to see if rnpm handled the issue. This can be sped up with a friendly logging level for previously linked messages. **This PR turns this:** ![screen shot 2016-08-21 at 11 49 07 am](https://cloud.githubusercontent.com/assets/997157/17838588/84223264-6796-11e6-81d2-075d30942a69.png) **Into this:** ![screen shot 2016-08-21 at 11 52 31 am](https://cloud.githubusercontent.com/assets/997157/17838592/92c2ce64-6796-11e6-884d-e5af8f4c2b5a.png) Which is a pretty nice experience! This also helps you quickly identify when 1 thing wasn't linked, at a glance, like so! ![image](https://cloud.githubusercontent.com/assets/997157/17838613/22568c8c-6797-11e6-8e12-c73746ec0eff.png) Closes https://github.com/facebook/react-native/pull/9507 Differential Revision: D3757516 fbshipit-source-id: e4c691824e9318d36f4c1d89673b7e747fb972f1 --- local-cli/link/link.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/local-cli/link/link.js b/local-cli/link/link.js index 9361a40a02f3b9..b4a817dda24601 100644 --- a/local-cli/link/link.js +++ b/local-cli/link/link.js @@ -2,6 +2,7 @@ const log = require('npmlog'); const path = require('path'); const uniq = require('lodash').uniq; const flatten = require('lodash').flatten; +const chalk = require('chalk'); const isEmpty = require('lodash').isEmpty; const promiseWaterfall = require('./promiseWaterfall'); @@ -32,7 +33,7 @@ const linkDependencyAndroid = (androidProject, dependency) => { const isInstalled = isInstalledAndroid(androidProject, dependency.name); if (isInstalled) { - log.info(`Android module ${dependency.name} is already linked`); + log.info(chalk.grey(`Android module ${dependency.name} is already linked`)); return null; } @@ -58,7 +59,7 @@ const linkDependencyIOS = (iOSProject, dependency) => { const isInstalled = isInstalledIOS(iOSProject, dependency.config.ios); if (isInstalled) { - log.info(`iOS module ${dependency.name} is already linked`); + log.info(chalk.grey(`iOS module ${dependency.name} is already linked`)); return; }