4.0.1 • Published 7 years ago

xdk-to-cli v4.0.1

Weekly downloads
2
License
BSD-3-Clause
Repository
github
Last release
7 years ago

xdk-to-cli

See LICENSE.md for license terms and conditions.

Intel® XDK to config.xml for Cordova* CLI and Adobe* PhoneGap* Build

This is a Node.js* script that does most of the work necessary to convert your intelxdk.config.{android|ios|windows}.xml files, that are automatically created by the Intel® XDK, into config.{android|ios|windows}.xml files that can be used to then build your Intel XDK project using either Cordova* CLI or Adobe* PhoneGap* Build.

If you have bug fixes for this script, please send a pull request with your recommended fix. Otherwise, if you experience issues with this script, please post an issue in this GitHub repo or leave a post in the Intel XDK forum describing how to reproduce the issue.

Script Overview

This converter is not a general-purpose XML parser. It uses a "brute force" method, akin to an AWK script. It takes advantage of the format and content of the typical Intel XDK project files that are generated by recent releases (2016 or 2017) of the Intel XDK to convert the information contained in your project's intelxdk.config.{android|ios|windows}.xml and <project-name>.xdk files into an equivalent Cordova config.{android|ios|windows}.xml file for use with Adobe PhoneGap Build and Cordova CLI.

Some conditions that might cause this script to fail:

  • Too many XML tags occupying the same line (multi-tag lines).
  • > characters embedded within an XML tag preference string.
  • Using the intelxdk.config.additions.xml file add/remove operations.
  • Complicated comment "tags," especially if they are embedded or recursive.
  • Problems locating or opening the above-mentioned project files.

Keep your intelxdk.config.additions.xml file clean and simple and use only one XML tag per line to insure the optimum results with this conversion script.

Script Requirements

  • This script requires at least Node.js version 4.0 (or higher). It will check the Node.js version at runtime and abort if your copy of Node.js is inadequate. At this time, it has been developed and tested on Node.js v4.4.3 and v6.9.1, and has been "smoke tested" on Node.js v7.1.0.

  • This script is organized into multiple files, which are all required in order to run. It does not require any external Node.js modules.

  • This script will run on Microsoft* Windows* or Apple* OSX or Ubuntu*. Other versions of Linux* have not been tested, but it should work.

Installing the Script

Download and install Node.js 4.0, or greater, onto your development system, if you do not already have at least that version installed.

Install the script directly from the NPM public registry by typing the following at the command-line:

  • npm -g install xdk-to-cli

Or, install the script from a copy in a local folder on your dev system:

  • git clone or download a ZIP file of this repo onto your development system (extract the ZIP file if you chose to "download a ZIP").

  • Goto the folder containing the downloaded copy of this script (cd to the folder that contains the package.json file).

  • From that folder, at the command-line, type: npm -g install

Running the Script

  • Open the Intel XDK to your "project of interest."

  • Using the Test tab in your open project, push the green "PUSH FILES" button. Alternatively, using the Projects tab, switch to a different project and then switch back to your "project of interest."

    This insures that the project files to be read by this script are accurate and up-to-date. This "refresh" should be done whenever you have changed any project settings or added/removed any Cordova plugins to your project.

  • Identify the <project-name>.xdk file in the root folder of your project of interest.

    You can quickly locate the root folder of your project by opening the Develop tab, right-clicking one of the intelxdk.config.*.xml files and selecting "Show in Finder" or "Show in Explorer" from the right-click menu.

  • Start the script from the command-line with a single command-line parameter (the path and name of the <project-name>.xdk file). Errors, warnings and other informational messages are printed to the console (via stderr).

  • If there are no errors, warnings or other messages you should see up to three status messages and a "SUCCESS" message. You may also see warnings and notes with those status messages; it is very important that you read all warnings and notes!

For example:

> xdk-to-cli  path\to\<project-name>.xdk
Creating config.android.xml
Creating config.ios.xml
Creating config.windows.xml
SUCCESS: finished!

As shown above, three config.*.xml files are created in your local Intel XDK project folder. Each is based on the corresponding intelxdk.config.*.xml file and the <project-name>.xdk file you specified. If you compare the three config.*.xml files they will be nearly identical, and can be merged into a single config.xml file for use with Adobe PhoneGap Build or Cordova CLI.

  • If you are building for only a single target (e.g., Android) you can simply rename the config.android.xml file to config.xml and you will have what you need to use with Adobe PhoneGap Build or Cordova CLI.

    NOTE: The config.windows.xml file is based on the intelxdk.config.windows.xml file, which is derived from your Intel XDK Windows 10 UAP project settings. There is no conversion of the older Windows config files by this script.

  • If you are building for multiple targets you can combine the relevant config.*.xml files into a single config.xml file. This step is not done automatically by the script and must be done manually using a code editor or any one of many diff and merge utilities available for this purpose.

To build your app with Adobe PhoneGap Build, create a single config.xml file (using one of the techniques described above) and place it into the root of your project folder (in the same folder as the config.*.xml files). Then ZIP your project folder and submit the ZIP file to Adobe PhoneGap Build.

If your ZIP file is too big for PhoneGap Build, remove the plugins and, if it exists, the platforms folders from the ZIP file. PhoneGap Build does not need these folders to perform a build.

Instructions for using these config.*.xml files to build your app with Cordova CLI will be provided in an update to this README file. In the meantime, this Intel XDK doc page should help (start from the section titled Transferring Signing Certificates to PhoneGap Build).

Script Limitations

  • Does not merge the final output files (config.{android|ios|windows}.xml) into a single config.xml file. You must do that yourself. This limitation might be fixed in a future version.

  • Has not been thoroughly tested on all versions of the Intel XDK config files, so there may be some unknown conversion error problems.

  • The script code is fairly generic, so it should work fine on most versions of Node.js. The primary reason Node.js v4 (or greater) is required is due to known limitations in the standard Node.js readline module in older versions of Node.js.

  • Only converts the Windows 10 UAP config file (intelxdk.config.windows.xml). This limitation will not be removed.

*Other names and brands may be claimed as the property of others.