infinitus-hot-code-push-cli

This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.


License
ISC
Install
npm install infinitus-hot-code-push-cli@1.0.0

Documentation

Infinitus Hot Code Push CLI client

This is a command line utility for Infinitus Hot Code Push. It will help you with development and deploy changes to your Infinitus application via hot code push, without the need to submit your changes to the Apple App Store or Google Play.

Main features are:

  • Automatically generate configuration files, required for Hot Code Push plugin (hcp.json and hcp.manifest).
  • Deploy your web project on the external servers with the single command. For now it only supports deployment on the Amazon servers. More deployment targets will be added later.

Documentation

Installation

You can install CLI client using npm install:

npm install -g infinitus-hot-code-push-cli

It is also possible to install via repo url directly (unstable):

npm install -g https://github.com/myeveryheart/infinitus-hot-code-push-cli.git

How to use

infinitus-hcp <command>

Where <command> can be:

  • init - initialize project parameters, create default infinitus-hcp.json file.
  • build - build project files, generate hcp.json and hcp.manifest files in the www folder. Prepare for deployment.
  • login - create login credentials that are used for deployment of project files on the remote server.
  • deploy - upload project files on the remote server.

All commands should be executed in the root folder of your project. For example, lets assume you have a TestProject with the following structure:

TestProject/
  www/

Then infinitus-hcp commands should be executed in the TestProject folder.

Commands

Init command

infinitus-hcp init

Initialization command for CLI client. Generates default application configuration file (infinitus-hcp.json) in the projects root folder. This file is used later on for build and deploy.

When executed - you will be asked to fill in some project preferences from the command line:

  • Project name - your current project name. Required.
  • Amazon S3 Bucket name - name of the S3 Bucket on the Amazon. Required for deployment, can be skipped in other cases.
  • Amazon S3 region - Amazon S3 region. Required for deployment, can be skipped in other cases.
  • iOS app identifier - applications id on the App Store. Used to redirect user to the applications page on the store.
  • Android app identifier - applications package name by which we reference app on the Google Play.
  • Update method - when to perform the update. Supports three keys:
    • silent - install update silently; used by default;
    • forced - install update forced;

For example, execute init in your project root folder and fill preferences as below:

Running init
Please provide: Enter project name (required):  TestProject
Please provide: Amazon S3 Bucket name (required for infinitus-hcp deploy):  hcp-test
Please provide: Amazon S3 region (required for infinitus-hcp deploy):  (us-east-1) eu-west-1
Please provide: IOS app identifier:  id123456789
Please provide: Android app identifier:  com.example.hcp.testproject
Please provide: Update method (required):  (silent) silent
Project initialized and infinitus-hcp.json file created.
If you wish to exclude files from being published, specify them in .hcpignore
Before you can push updates you need to run "infinitus-hcp login" in project directory

As a result, content of the infinitus-hcp.json file will be:

{
  "name": "TestProject",
  "s3bucket": "hcp-test",
  "s3region": "eu-west-1",
  "ios_identifier": "id123456789",
  "android_identifier": "com.example.hcp.testproject",
  "update": "silent",
  "content_url": "https://s3-eu-west-1.amazonaws.com/hcp-test"
}

Build command

infinitus-hcp build [www_directory]

where:

  • [www_directory] - path to the directory with your web project. If not specified - www is used.

Command is used to prepare project for deployment and to generate plugin specific configuration files inside www folder:

  • hcp.json - holds release related information.
  • hcp.manifest - holds information about web project files: their names (relative paths) and hashes.

When executed - you will see in the terminal window:

Running build
Build 2015.09.07-11.20.55 created in /TestProject/www

As a result, hcp.json and hcp.manifest files are generated in the www folder and project is ready for deployment.

More information about those configs can be found on Infinitus Hot Code Push documentation page.

Login command

infinitus-hcp login

Command requests and saves login credentials, using which deployment on the Amazon servers is performed. You need to run it before doing any deployment. Otherwise, infinitus-hcp won't now how to login to the Amazon.

When executed, you will be asked to enter your Amazon Access Key Id and Access Key Secret:

Running login
Please provide: Amazon Access Key Id:  YOUR_ACCESS_KEY_ID
Please provide: Amazon Secret Access Key:  YOUR_ACCESS_KEY_SECRET

Entered credentials will be placed in the .hcplogin file:

{
  "key": "YOUR_ACCESS_KEY_ID",
  "secret": "YOUR_ACCESS_KEY_SECRET"
}

From this point you are ready to deploy your project on Amazon server.

Advise: don't forget to put .hcplogin file in the ignore list of your version control system, if any is used. For git you can do this by executing:

echo '.hcplogin' >> .gitignore

Deploy command

infinitus-hcp deploy [www_directory]

where:

  • [www_directory] - path to the directory with your web project. If not specified - www is used.

Command uploads your Infinitus's web project files on the Amazon server. Can be executed only after init and login commands.

When executed, you will see the following in the console:

Running deploy
Config { name: 'TestProject',
  s3bucket: 'hcp-test',
  s3region: 'eu-west-1',
  ios_identifier: 'id123456789',
  android_identifier: 'com.example.hcp.testproject',
  update: 'start',
  content_url: 'https://s3-eu-west-1.amazonaws.com/hcp-test',
  release: '2015.09.07-13.02.28' }
Build 2015.09.07-13.02.28 created in /TestProject/www
Deploy started
Deploy done

As a result - all files from your web directory are uploaded to the Amazon server, which was defined on the init step.

Default configuration file

As mentioned in Init command section of the readme - after executing infinitus-hcp init command you will get a default configuration file, called infinitus-hcp.json. It is created in the root folder of your project. When you run infinitus-hcp build - data from that file is used to generate hcp.json file in www folder.

If you want - you can create infinitus-hcp.json manually and put in there any options you want. It's just a JSON object like so:

{
  "update": "start",
  "content_url": "https://mycoolserver.com/mobile_content/"
}

By default, you would probably put in there your content_url. But it can also be any other setting.

Ignored files list

By default, CLI client ignores all hidden files, and files from the following list:

hcp.json
hcp.manifest
package.json
node_modules/*

But if you want - you can extend this list like so:

  1. Create .hcpignore file in the root of your Infinitus Project (for example, /TestProject/.hcpignore).
  2. Add ignored files. For example:
dirty.html
images/*
libs/*

As a result, those files will be excluded from the hcp.manifest.

If you want - you can add comments by using # like this:

# Ignore libraries
libs/*

# Ignore images
images/*

Normal workflow scheme

  1. Initialize:

    infinitus-hcp init
  2. Provide login preferences:

    infinitus-hcp login
  3. Build your project:

    infinitus-hcp build
  4. Upload project on the server:

    infinitus-hcp deploy
  5. When new version is ready - repeat steps 3. and 4..