This is a migrated thread and some comments may be shown as answers.

Use NPM to install plugin

4 Answers 72 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stephen
Top achievements
Rank 1
Stephen asked on 21 Dec 2016, 03:15 AM

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

4 Answers, 1 is accepted

Sort by
0
Garo
Telerik team
answered on 22 Dec 2016, 03:12 PM
Hello Stephen,

In the AppBuilder CLI, to add a custom plugin to your application, you could use the 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  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.

 
0
Stephen
Top achievements
Rank 1
answered on 02 Jan 2017, 10:38 PM

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

0
Accepted
Preslav
Telerik team
answered on 05 Jan 2017, 02:58 PM
Hi Stephen,

Straight to your questions:
  1. Telerik AppBuilder Cordova projects do not have a package. 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.

 
0
Stephen
Top achievements
Rank 1
answered on 05 Jan 2017, 10:43 PM

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

Tags
Apache Cordova
Asked by
Stephen
Top achievements
Rank 1
Answers by
Garo
Telerik team
Stephen
Top achievements
Rank 1
Preslav
Telerik team
Share this question
or