cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject cordova-coho git commit: Add --use-yarn option to npm-link option
Date Sat, 22 Apr 2017 19:56:23 GMT
Repository: cordova-coho
Updated Branches:
  refs/heads/master 5d8347bd0 -> 99b8d31e9


Add --use-yarn option to npm-link option


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/99b8d31e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/99b8d31e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/99b8d31e

Branch: refs/heads/master
Commit: 99b8d31e9f065d9f668d2a06c00d729b154999ad
Parents: 5d8347b
Author: Shazron Abdullah <shazron@gmail.com>
Authored: Sat Apr 22 12:56:19 2017 -0700
Committer: Shazron Abdullah <shazron@gmail.com>
Committed: Sat Apr 22 12:56:19 2017 -0700

----------------------------------------------------------------------
 src/npm-link.js | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/99b8d31e/src/npm-link.js
----------------------------------------------------------------------
diff --git a/src/npm-link.js b/src/npm-link.js
index a6c9566..5a12ea4 100644
--- a/src/npm-link.js
+++ b/src/npm-link.js
@@ -23,12 +23,21 @@ var optimist = require('optimist');
 var shelljs = require('shelljs');
 var flagutil = require('./flagutil');
 
+var packman = 'npm';
+
 function *createLink(argv) {
     var opt = flagutil.registerHelpFlag(optimist);
     argv = opt
         .usage('Does an npm-link of the modules that we publish. Ensures we are testing live
versions of our own dependencies instead of the last published version.\n' +
                '\n' +
-               'Usage: $0 npm-link')
+               'Usage: $0 npm-link' +
+               'Example usage: $0 npm-link --use-yarn\n' 
+               )
+        .options('use-yarn', {
+            desc: 'Use the yarn package manager instead of npm',
+            type: 'bool',
+            default: false
+         })
         .argv;
 
     if (argv.h) {
@@ -36,17 +45,24 @@ function *createLink(argv) {
         process.exit(1);
     }
 
+    if (argv['use-yarn']) {
+        packman = 'yarn';
+        console.log('Using the yarn package manager.');
+    } else {
+        console.log('Using npm');
+    }
+
     function npmLinkIn(linkedModule, installingModule) {
        cdInto(installingModule);
        // 'npm link' will automatically unbuild a non-linked module if it is present,
        // so don't need to explicitly 'rm -r' it first.
-       shelljs.exec("npm link " + linkedModule);
+       shelljs.exec(packman + " link " + linkedModule);
        cdOutOf();
     }
 
     function npmLinkOut(moduleName) {
         cdInto(moduleName);
-        shelljs.exec("npm link");
+        shelljs.exec(packman + " link");
         cdOutOf();
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message