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

cordova-loader

v0.1.0

Published

Cordova asset compiler and loader

Downloads

2

Readme

Cordova Asset Compiler & Loader

Introduction

Cordova Loader makes it easy to use Cordova with remotely served mobile applications. The compiler interprets the provided Cordova project directory and compiles the assets into minified, platform-specific, versioned JavaScript which is loaded into memory and stored in versioned directories for production use / bundling. When the client loads, it automatically pulls in the platform-specific cordova code for that device. The Cordova API can be used the same as it is in the Cordova documentation. Cordova Loader was built for use in Meteor but will soon be able to be used by any Javascript/Node.js applcation. Enjoy!

demo

Note: Currently tested this package with iOS and Android

Installation / Setup

Requirements

================

NPM Package Installation

Coming soon.

================

Meteor Package Installation
mrt add cordova-loader

Note: I would also suggest adding the appcache-extra package. It will cache the Cordova/platform file after it is loaded once and gives you a way to handle appcache reloads with better UX.

================

Cordova Loader Init (server)
  var cordovaLoader = new CordovaLoader({
    version: '0.0.1',
    mode: 'development',
    logging: true,
    platforms: ['ios', 'android'],
    path: '../cordova'
  });
Options
  • version: Version of the Cordova application. This is used to sync the Cordova client with the loaded Cordova files (required in development mode).
  • mode: Either production or development (default: development)
  • logging: This is optional. Just trying to give some transpency into the package. (default: true)
  • platforms: Array of platforms you are using (required in development mode).
  • cordovaPath: Path to your Cordova project directory (required in development mode).
  • savePath: Path to save the compiled assets (default: private/cordova).
  • loadPath: Path to load the compiled assets in production (default: assets/app/cordova).

Note: If you want to manually rerun the compiler just delete the private/cordova/[version]/[platform].js file you want to recompile.

================

Cordova Project Setup

The basic Cordova project setup is easy. Modify the config.xml file in the root of your Cordova project. Change <content src="index.html" /> to <content src="http://your-url-here?cordova=0.0.1" />. Then run cordova prepare in the Cordova project directory. The cordova get variable is important to let Cordova Loader know that this is a request from a Cordova app and the version is also important in letting Cordova Loader know which version of the Cordova client to serve.

================

Versioning

The compiled Cordova files are saved in private/cordova/[version] directories. As you release new versions of your app some of the older versions of the client may still be installed on devices. Cordova Loader sends the version as a get variable in the request from the client. Cordova Loader uses this version to load the correct version of the compiled assets. Inside your app handling graceful versioning is up to you. The global variable window.cordovaAppVersion is avaialble to determine which version of the Cordova app the client is running and which features you can enable. It is important for you to bump the version as you release changes to the Cordova project to the app stores / production so that you have support for the older versions of your application. It would be a good idea to use an analytics platform to keep track of the version distribution and then in the client alert the users of really old apps to upgrade so that you don't have to maintain really old versions of the application.

================

Offline Support

As this package is just for compiling and loading Cordova assets, I will release an actual Cordova plugin which handles the graceful fallback and transition to offline mode with options. I'm already using it in my apps, but I need to clean it up a bit for release.

================

Meteor Notes

Comparison of Meteor + Cordova methods/packages

Facebook Native SDK

  • accounts-facebook-cordova - Works with the cordova plugin to use facebook single sign on when it exists otherwise use standar oauth package.

Famo.us Integration

  • celestial - Package to make using Famo.us with Meteor easier.

Example Apps

  • Meteor Cordova Todo - Just started working on this. This will eventually be a working app as an example.

================

Contributing

If you want more features than this provides, file an issue. Feature requests/contributions are welcome.