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

grunt-init-phonegap

v0.1.0

Published

A grunt-init template that simplifies the process of setting up a PhoneGap mobile application development environment. It sets up creation of the application and PhoneGap/Cordova plugins managment using PhoneGrunt, and sets up the development environment

Downloads

1

Readme

grunt-init-phonegap

A grunt-init template that simplifies the process of setting up a PhoneGap mobile application development environment.

It configures grunt tasks that creates and manages a PhoneGap mobile application using PhoneGrunt, JavaScript code linting using grunt-contrib-jshint and Jasmine testing using grunt-contrib-jasmine.

Getting Started

If you haven't done so, please install grunt-init. Also install any SDKs and build tools needed for compiling the mobile operating systems you want your PhoneGap application to support.

Once these are installed, place this template in your ~/.grunt-init/ directory (%USERPROFILE%\.grunt-init\ on Windows). It is recommended that you use git to clone this template into that directory, as follows:

$ git clone https://github.com/realog32/grunt-init-phonegap.git ~/.grunt-init/phonegapdev

Installation

At the command line, cd into an empty directory, run the command below and follow the prompts. Your PhoneGap application and dev environment will be created in the directory. Existing files may be overwritten.

$ grunt-init phonegapdev

After the application files are generated, install dependencies via npm (It may take a while to download all packages):

$ npm install

Usage

After all dependencies are downloaded, you are now ready to build your application using grunt. The default task lints task files using jshint, generates and configures the PhoneGap application based on your specifications using PhoneGrunt, and tests the mobile application using Jasmine.

The following command runs all tasks:

$ grunt

Alternatively, the following development tasks may be run individually:

PhoneGrunt build tasks

$ grunt phonegrunt

or to run phonegrunt for a specific target when multiple targets are defined:

$ grunt phonegrunt:hellophonegap

In the above example, hellophonegap is the PhoneGap build target generated for your application by the grunt-init-phonegap template. An example configuration for the PhoneGap build target can be seen in the snippet just below. The init and build properties define how your mobile application should be initialized and configured. The main class for this configuration shown below would be platforms/android/src/com/hellophonegap/app/HelloPhonegap.java. The cordova device, battery-status, and camera plugins will be added to the build while the geolocation plugin will be removed (if it exists) from the build. Please refer to the PhoneGrunt documentation for complete details.

// Project configuration.
grunt.initConfig({

    phonegrunt: {

        options: {

        },
        hellophonegap: {

            init: {
                name: 'HelloPhonegap', // Your mobile application project name
                package: 'com.example.hellophonegap', // Application package namespace
                target_os: ["android"] // Target operating system(s)
            },

            build: {
                local: {
                    plugins: {
                        add: ["device","battery-status","camera"],
                        remove: ["geolocation"]
                    }
                }
            },
        },
        anotherTarget: {
        . // multiple targets
        . // can be 
        . // defined here
    }
    .
    .
    .

Plugins for the configuration above can be added or removed to an existing build by simply running:

$ grunt phonegrunt:hellophonegap:build

Lint task (JSHint)

$ grunt jshint

This will lint files configured in the jshint task in the generated Gruntfile.js. Please refer to the grunt-contrib-jshint plugin for configuration details for this task. Below is an example of the default configuration for an android application:

// Project configuration.
grunt.initConfig({

    jshint: {
        all: [
            'Gruntfile.js', // This gruntfile.
            'tasks/*.js', // Generated PhoneGap build tasks and any user-defined tasks.
            'test/jasmine/**/*.js', // Jasmine test scripts.
            ['platforms/android/assets/www/js/**/*.js',], // PhoneGap application JS files.
        ],
        options: {
            jshintrc: '.jshintrc', // configuartion options for jshint
        },
    },
    .
    .
    .

Jamine test task

$ grunt jasmine

This will run the Jasmine tests in the test/jasmine/specs directory. Please refer to grunt-contrib-jasmine plugin for configuration options.

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.

Acknowledgments

This effort is inspired by the awesome [grunt-init-gruntplugin][https://github.com/gruntjs/grunt-init-gruntplugin]. Many thanks to Ben Alman and his fellow contributors for making it all seem so simple.

Release History

(Initial Release)