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

appetizer-bundle

v1.0.1

Published

Create/Bundle React-Native apps to on appetize.io

Downloads

45

Readme

appetizer-bundle

Creates an uploadable bundle of your React-Native application so it can run on the appetize.io platform. It currently only supports ios builds. Please note that this module assumes you have a iOS build tool chain installed on your system. As it needs to have access to the following CLI's:

  • zip
  • xcodebuild

Installation

npm install --save appetizer-bundle

Part of the Appetizer suite

This module is part of a larger suite of components that work excellent with each other. If you liked this module we highly suggest checking out:

  • appetizer A Node.js component for interacting with the Appetize.io API.
  • appetizer-bundle Prepares and packs your React-Native application for uploading to Appetize.io.
  • appetizer-component A React Component to embed your uploaded application.

API

The following arguments are required in the Bundle constructor:

  • name The name of your application as you configured it with react-native init
  • dir The root directory of your React-Native app, this contains the ios and android folders.
const Bundle = require('appetizer-bundle');
const bundle = new Bundle('name of your application', 'path to your app dir');

run

This is the method that most people would be using, it chains all other methods in the correct order to generate a new build:

  1. Rewrite the Delegate function so your app uses the offline bundle.
  2. Create a new xcodebuild of the updated manifest.
  3. Create the offline React-Native bundle.
  4. Zip the resulting application.
  5. Rewind all changes made to the app so it's the in the previous state.
bundle.run(function (err, zipfile) {
  if (err) {
    // Handle errors
  }

  //
  // Upload zipfile location using the appetizer library
  //
});

offline

Generates the offline React-Native bundle. The method expects 2 arguments:

  1. The directory in which the resulting offline bundle should be placed
  2. Completion callback
bundle.offline(dir, (err) => {
  if (err) {
    // Handle errors
  }

});

rewrite

Rewrites the AppDelegate.m so it points to new React-Native offline bundle. The rewrite function is a bit special. It receives a restore function as second argument which restores the AppDelegate.m to it's original state.

The restore function accepts the following arguments:

  • err An error that will be passed in the completion argument so you can clean up, and forward it to the callback.
  • next Completion callback.
bundle.rewrite((err, restore) => {
  if (err) {
    // Handle errors
  }

  restore(err, function (err) {
    if (err) {
      // Handle errors
    }

  });
});

zip

Packs the resulting the application in a zip file so it can easily be uploaded to the appetize.io service as it only accepts zip or tar files. The zip callback receives the full path to the generated zip file as result.

bundle.zip(function (err, zipfilelocation) {
  if (err) {
    // Handle errors
  }
  
  //
  // Upload zipfile location using the appetizer library
  //
});

xcodeproj

Read the given project directory and check if we have an xcode project or workspace we're dealing with. It requires the following arguments.

  • dir The location where the project files should be located in.
  • fn Completion callback that receives error and a project object.

The project object contains the following information:

  • name Name of the file
  • file Full file name
  • workspace Boolean indication if its a workspace.
bundle.xcodeproj(dir, function (err, project) {
  if (err) {
    // Handle errors
  }

  console.log(project.file);
});

xcodebuild

Generate a new iphonesimulator compatible xcode build. It expects a single argument which is an error first completion callback.

bundle.xcodebuild(function (err) {
  if (err) {
    // Handle errors
  }

});

License

MIT