Permalink
Browse files

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 #9507

Differential Revision: D3757516

fbshipit-source-id: e4c691824e9318d36f4c1d89673b7e747fb972f1
  • Loading branch information...
1 parent e63a7ea commit 85a2d6a65d373b0f3cc94d1ad2ca1dc9b7717809 @GantMan GantMan committed with Facebook Github Bot Aug 23, 2016
Showing with 3 additions and 2 deletions.
  1. +3 −2 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;
}

0 comments on commit 85a2d6a

Please sign in to comment.