You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/09/21 14:12:00 UTC

[jira] [Commented] (CB-12242) Use yarn js instead of npm when adding plugins

    [ https://issues.apache.org/jira/browse/CB-12242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623668#comment-16623668 ] 

ASF GitHub Bot commented on CB-12242:
-------------------------------------

jayvdb commented on issue #292: CB-12242 : Use yarn instead of npm
URL: https://github.com/apache/cordova-cli/pull/292#issuecomment-423544491
 
 
   fwiw, I was able to get yarn working with cordova@8 and a very basic yarn wrapper (below) and a symlink `npm`.  The wrapper is needed because `npm install foo` needs to invoke `yarn add foo`.
   
   ```bash
   #!/bin/bash
   
   args="$@"
   arg2="$2"
   if [ "$1" = "install" ] && [ -n "$arg2" ] && [ "${arg2/--//}" = "$arg2" ] ; then
       args="${args/install/add}"
   fi
   
   yarn $args
   ```
   A better version of the wrapper is needed to get `--save-exact` working.
   
   And [`pnpm`](https://github.com/pnpm/pnpm) with a symlink `npm` works without any wrapper.
   
   No doubt this wouldnt cover all possible usages, and shouldnt be supportable by the core team, but it seems reasonable that cordova-fetch can use other package managers used by the project (e.g. detected via https://github.com/apache/cordova-fetch/issues/46 , or an explicit and non-friendly option ), and include a warning that only npm is supported.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Use yarn js instead of npm when adding plugins
> ----------------------------------------------
>
>                 Key: CB-12242
>                 URL: https://issues.apache.org/jira/browse/CB-12242
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-fetch
>            Reporter: Jacques de Villiers
>            Priority: Major
>
> Currently it can take quite long to add certain plugins to my project (using cordova plugin add), especially if I need to re-add the plugins. My suggestion is to update the cordova cli to start using yarn js instead of npm directly.
> When I looked at this page, I realised yarn was just a wrapper for npm, and much better at caching packages locally.
> https://shift.infinite.red/npm-vs-yarn-cheat-sheet-8755b092e5cc#.jiz27n1hc
> I would imagine this change would be relatively straightforward, and would be a massive win for the cli.
> I was thinking of creating a fork to do a PR but realised I am not totally sure how to proceed on this.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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