npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

phonegrunt

v0.1.0

Published

A grunt plugin for automating PhoneGap application development tasks.

Downloads

3

Readme

PhoneGrunt

A grunt plugin for automating PhoneGap mobile application development tasks.

Getting Started

This plugin requires Grunt ~0.4.2 and supports PhoneGap API ~3.3.0-0.19.6.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

$ npm install phonegrunt --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('phonegrunt');

The "PhoneGrunt" task

Overview

In your project's Gruntfile, add a section named phonegrunt to the data object passed into grunt.initConfig().

grunt.initConfig({

    phonegrunt: {

        /* Global task options */
        options: {
            // Mobile app install path, PhoneGap, and Cordova binary paths go here.
        },

        /* Global initialization configuration. */
        init: {
            // Mobile application title, package name, and target mobile operating systems are defined here.
        },

        /* Global build configuration. */
        build: {
            local: {
                // Local environment build configuration like plugins to install/uninstall go here.
            }
        },

        /* Targets for multiple application development. (Optional.) If unspecified, application is installed in current directory. */
        your_first_target: {
            /* target-specific options override global options. */
            options: {},
            /* target-specific initialization configuration. */
            init: {},
            /* target-specific build configurations. */
            build: {}
        },

        /* Multiple targets can be defined */
        another_target: {
        }
    },
});

Task Options

options.cordovaBin

Type: String Default value: './node_modules/.bin/cordova'

Path to the Apache cordova binary.

options.installDir

Type: String Default value: './'

Mobile application source installation directory. Caution: Multiple targets will overwrite the same directory unless target-specific options.installDir is defined.

options.phonegapBin

Type: String Default value: './node_modules/.bin/phonegap'

Path to the Adobe PhoneGap binary.

Initialization Configuration

init.name

Type: String Default value: 'HelloPhonegap'

The PhoneGap mobile application's name.

init.pkg

Type: String Default value: 'com.example.hellophonegap'

PhoneGap application package namespace.

init.install_os

Type: Array Default value: []

Mobile operating systems to install support for. Eg: ["android","ios"] See PhoneGap's platform guides documentation for additional information on supported operating systems and required development environment setup.

init.uninstall_os

Type: Array Default value: []

Mobile operating systems to uninstall support for. Eg: ["firefoxos"]

Build Configuration

Currently, only local workflow task options are supported. Remote workflow is planned for a future release.

build.local.plugins

Type: Object

Configuration object for specifying whether cordova plugins should be added or removed from target build environment.

build.local.plugins.add

Type: Array Default value: []

Array of cordova plugins to add to the build. Eg: ["device","battery-status","camera"]

build.local.plugins.remove

Type: Array Default value: []

Array of cordova plugins to remove from the build. Eg: ["geolocation"]

Usage Examples

Single-target build installed in same directory as Gruntfile.

In this example, android and ios support will be enabled for the target PhoneGap application, which will be created in the same directory as the Gruntfile. The native application class file will be namespaced to com.example.hellophonegap. Eg. The android application entry point will be located at ./platforms/android/src/com/example/hellophonegap/HelloPhonegap.java (relative to the gruntfile). The build task will add the device, battery-status, and camera plugins while removing the geolocation plugin from the build.

grunt.initConfig({

    phonegrunt: {
        options: {
            cordovaBin: './node_modules/.bin/cordova',
            installDir: './',
            phonegapBin: './node_modules/.bin/phonegap'
        },
        init: {
            name: 'HelloPhonegap',
            pkg: 'com.example.hellophonegap',
            install_os: ["android", "ios"],
            uninstall_os: []
        },
        build: {
            local: {
                plugins: {
                    add: ["device","battery-status","camera"],
                    remove: ["geolocation"]
                }
            }
        }
    }
});

Multi-target build created in separate directories.

In this example, ios and android support will be enabled for the HelloPhonegap and GoodbyePhonegap targets respectively. IOS and Android mobile applications will be created in the ./hellophonegap and ./goodbyephonegap directories relative to the Gruntfile. No plugins will be installed for the GoodbyePhonegap target.

grunt.initConfig({

    phonegrunt: {
        options: {
            cordovaBin: './node_modules/.bin/cordova',
            phonegapBin: './node_modules/.bin/phonegap'
        },
        HelloPhonegap: {
            options: {
                installDir: './hellophonegap',
            },
            init: {
                name: 'HelloPhonegap',
                pkg: 'com.example.hellophonegap',
                install_os: ["ios"],
                uninstall_os: []
            },
            build: {
                local: {
                    plugins: {
                        add: ["device","battery-status","camera"],
                        remove: ["geolocation"]
                    }
                }
            }
        },
        GoodbyePhonegap: {
            options: {
                installDir: './goodbyephonegap',
            },
            init: {
                name: 'GoodbyePhonegap',
                pkg: 'com.example.goodbyephonegap',
                install_os: ["android"],
                uninstall_os: []
            }
        }
    }
});

To simply update plugin requirements for your application without performing init tasks, using the example above one can run:

$ grunt phonegrunt:HelloPhonegap:build

Support

Please report any issues here and feel absolutely welcome to fork and submit pull requests.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)