Use NPM to install plugin

5 posts, 1 answers
  1. Stephen
    Stephen avatar
    6 posts
    Member since:
    Aug 2014

    Posted 20 Dec 2016 Link to this post

    Hi

    I would like to use NPM to install custom Cordova plugins. Currently I go to the GitHub page and download as a zip, and copy it into the plugins folder which is very manual. Can I use NPM? I mean, I can use NPM to get the plugins, but how would I get them from the node_modules folder into the correct folder for the AppBuilder build?

     

    Thanks

     

    Stephen

  2. Garo
    Admin
    Garo avatar
    136 posts

    Posted 22 Dec 2016 Link to this post

    Hello Stephen,

    In the AppBuilder CLI, to add a custom plugin to your application, you could use the appbuilder plugin fetch plugin command where "plugin" is a local path to the plugin, a plugin repository or the name/id of the plugin in the npm registry. For example:
    // From Plugin Repository
     
    // From NPM Registry
    appbuilder plugin fetch phonegap-plugin-barcodescanner

    Please, let me know if this is helpful.

    Regards,
    Garo
    Telerik by Progress
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. Stephen
    Stephen avatar
    6 posts
    Member since:
    Aug 2014

    Posted 02 Jan in reply to Garo Link to this post

    Hi Garo

    Does this update a package.json or just copy the files into the plugin folder? Do we then need to commit these files to source control? I'm assuming there is no actual tracking of the packages it just copies them in, just like if I copy them in myself? So another developer wouldn't do a package restore before developing?

    Thanks

     

    Stephen

  4. Answer
    Preslav
    Admin
    Preslav avatar
    233 posts

    Posted 05 Jan Link to this post

    Hi Stephen,

    Straight to your questions:
    1. Telerik AppBuilder Cordova projects do not have a package.json file. The command shared by my colleague just copies the files of a plugin into the "plugins" folder.
    2. You do need to commit the files to the source control as they are already local files.
    3. You are correct, you can copy the files by yourself. Once you start a cloud build, these files will be also uploaded and included in the final executable file.
    4. I am not absolutely sure what do you mean with this question thus, please excuse me if my answer is not on the topic. If you are collaborating with another developer on the same project but he does not use functionality added with a custom plugin by you, he can continue his development without pulling the last committed changes.

    Regards,
    Preslav
    Telerik by Progress
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  5. Stephen
    Stephen avatar
    6 posts
    Member since:
    Aug 2014

    Posted 05 Jan in reply to Preslav Link to this post

    Hi Preslav

    I just mean that usually with NPM the packages aren't in source control (you might have 1Gb of packages...) but each developer does an NPM Install or whatever to download them onto their machine.

     

    I think you have answered all of my questions, thanks. I am a little disappointed that there isn't proper actual package management using a package.json but I can live without it I guess.

     

    Thanks

     

    Stephen

Back to Top