Giter Club home page Giter Club logo

automating-cordova-platform-adding-and-plugin-adding's Introduction

Automating-cordova-platform-adding-and-plugin-adding

Automating the process of adding a Cordova platform and plugins for both cordova and ionic based projects.

Standard process of creating a cordova project and adding plugins:

  1. cordova create SampleApp com.example.sampleapp SampleApp
  2. cd SampleApp
  3. cordova platfrom add android
  4. cordova platfrom add ios
  5. cordova plugin add cordova-plugin-camera
  6. cordova plugin add cordova-plugin-device
  1. cordova run android
  2. cordova run ios

The Problem

  1. Mainatining and managaing all the plugins is a cumberson process.
  2. When the plugins are added a specific version of the plugin is added.
  3. If the plugins have to be modified or the project has to be updated then it would be easier to have all the plugins with their respective version.

The Solution

  1. Add all platfrom (with specific version) using a single command.
  2. Add all plugins (with specific version) using a single command.
  3. All the plugins and platforms are mentioned in a file - package.json

The key "platforms" has an array of platforms as value

"platforms": [
    "android",
    "ios"  
  ]

The above snippet will add the latest cordova android platform version.

The version of platform can also be specificed as below:

"platforms": [
    "[email protected]",
    "ios"  
  ]

The above snippet will add cordova android platform version 4.1.1

The key "plugins" has an array of plugins as value

"plugins": [
   "http://github.com/don/cordova-filechooser.git",
   "cordova-plugin-camera",
   "cordova-plugin-device",
   "cordova-plugin-dialogs",
   "cordova-plugin-fcm",
   "cordova-plugin-file",
   "cordova-plugin-file-transfer",
   "cordova-plugin-image-picker",
   "cordova-plugin-inappbrowser",
   "cordova-plugin-network-information",
   "cordova-plugin-spinner-dialog",
   "cordova-plugin-splashscreen"
  ]

The above snippet adds the latest version of each respective plugin.

A specific version of a plugin can be added as specified below:

 "plugins": [
     "[email protected]",
 ]

Automating the process

  1. Platform automation

The platform installation script platforms.js under tasks directory adds each platform

For running the platform script, type:

  node tasks/platfroms.js (This command will add all the platforms mentioned)
  node tasks/platfroms.js remove (This command will remove all the platforms mentioned)
  1. Plugin automation

The plugin installation script plugins.js under tasks directory adds each plugin

For running the plugin script, type:

  node tasks/plugins.js (This command will add all the plugins mentioned)
  node tasks/plugins.js remove (This command will remove all the plugins mentioned)

Note: Place the package.json and tasks folder under the root directory

    This will be same for both ionic and cordova based hybrid projects.  

automating-cordova-platform-adding-and-plugin-adding's People

Contributors

akash-pal avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.