<commit_before>﻿# ManifoldJS

This tool is used to create hosted web applications based on a [W3C Web App manifest](http://www.w3.org/TR/appmanifest/).

## Installation

````
npm install -g manifoldjs
````

## Command Line Interface

### Usage

````
manifoldjs <website-url> [-d <app-directory>] [-s <short-name>] [-p <platforms>] [-l <log-level>] [-b] [-m <manifest-file>]
````

### Parameters

|  **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;** | **Description** |
| ---------------- | --------------- |
| `<website-url>`  | **(required)** URL of the hosted website |
| `-d|--directory` | **(optional)** Path to the generated project files (default value: current directory) |
| `-s|--shortname` | **(optional)** Application short name. When specified, it overrides the short_name value of the manifest |
| `-l|--loglevel`  | **(optional)** Tracing log level options Available log levels: _debug,trace,info,warn,error_ (default value: _warn_) |
| `-p|--platforms` | **(optional)** Platforms to generate. Supported platforms: _windows,windows10,android,ios,chrome_ (default value: all platforms) |
| `-b|--build`     | **(optional)** Forces the building process |
| `-m|--manifest`  | **(optional)** Location of the W3C Web App manifest file (URL or local path). If not specified, the tool looks for a manifest in the site URL. Otherwise, a new manifest will be created pointing to the site URL. |

### Example

````
manifoldjs http://meteorite.azurewebsites.net -d C:\Projects -l info -p windows10,android -b
````

## Client Library

### Manifest Module

````
var manifesTools = require('manifestTools');
````

#### getManifestFromSite(siteUrl, callback)

Retrieves a manifest from a website. It looks for a manifest meta tag in the HTML content of the specified website URL; if no manifest is found, a new W3C manifest is retrieved with default `start_name` and `short_name` values.

`siteUrl` is the URL of the website that hosts the manifest.

`callback(err, manifestInfo)` returns an error or the manifest object in `manifestInfo`.

#### getManifestFromFile(filePath, callback)

Retrieves a manifest from a local path.

`siteUrl` is the path there the manifest file is located.

`callback(err, manifestInfo)` returns an error or the manifest object in `manifestInfo`.


####writeToFile(manifestInfo, filePath, callback)
Writes manifest info to the specified path.
`manifestInfo` Manifest data in JSON format.

`filePath` The path to write to.

`callback(err, validationResults)` returns an error or an array of validation results.

####fetchManifestUrlFromSite(siteUrl, callback)
If found, gets the manifest URL from the specified website URL.

`siteUrl` is the URL of the website.

`callback(err, content)` returns an error or a content object with start_url and short_name members.

####downloadManifestFromUrl(manifestUrl, callback)
Downloads the manifest from the specified URL.

`manifestUrl` is the URL of the manifest.

`callback(err, manifestInfo)` returns an error or the manifest object in `manifestInfo`.

####validateAndNormalizeStartUrl(siteUrl, manifestInfo, callback)
Validates the format of the manifest is a W3C manifest format.

`siteUrl` is the URL of the website.

`manifestInfo` is the manifest's data in JSON format.

`callback` returns an error or the manifest object in `manifestInfo`.

####convertTo(manifestInfo, outputFormat, callback)
Converts the manifest data to the specified output format.

`manifestInfo` is the manifest's data in JSON format.

`outputformat` is the format to which the manifest will be converted.

`callback(err, manifestInfo)` returns an error or the manifest object in `manifestInfo`.

####validateManifest(manifestInfo, targetPlatforms, callback)
Makes sure the manifest is valid for the specified target platforms.

`manifestInfo` is the manifest's data in JSON format.

`targetPlatforms` are the platforms to validate against.

`callback(err, validationResults)` returns an error or an array of validation results.

#### manifestInfo format

`manifestInfo.content` stores the manifest content.

`manifestInfo.format` specifies the type of manifest (possible values: `W3C`, `undefined`).

---

###Builder Module
````
var projectBuilder = require('projectBuilder');
````
####createApps(w3cManifestInfo, rootDir, platforms, build, callback)
Generates the applications for the specified platforms.

`w3cManifestInfo` is the manifest's data in JSON format.

`rootDir` is the root directory where the apps will be generated.

`platforms` are the target platforms.

`build` specifies whether to build the application or not.

`callback(err)` returns an error, if any.

---

###Project Tools module
````
var projectTools = require('projectTools');
````
####runApp(platform, callback)
Execute the app for the chosen platform.

`platform` The app will execute for the selected platform.

`callback` returns an error, if any.

####openVisualStudio(callback)
Opens the Visual Studio project.<commit_msg>Fixed issue with heading elements in readme doc<commit_after>﻿# ManifoldJS

This tool is used to create hosted web applications based on a [W3C Web App manifest](http://www.w3.org/TR/appmanifest/).

## Installation

````
npm install -g manifoldjs
````

## Command Line Interface

### Usage

````
manifoldjs <website-url> [-d <app-directory>] [-s <short-name>] [-p <platforms>] [-l <log-level>] [-b] [-m <manifest-file>]
````

### Parameters

|  **&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parameter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;** | **Description** |
| ---------------- | --------------- |
| `<website-url>`  | **(required)** URL of the hosted website |
| `-d|--directory` | **(optional)** Path to the generated project files (default value: current directory) |
| `-s|--shortname` | **(optional)** Application short name. When specified, it overrides the short_name value of the manifest |
| `-l|--loglevel`  | **(optional)** Tracing log level options Available log levels: _debug,trace,info,warn,error_ (default value: _warn_) |
| `-p|--platforms` | **(optional)** Platforms to generate. Supported platforms: _windows,windows10,android,ios,chrome_ (default value: all platforms) |
| `-b|--build`     | **(optional)** Forces the building process |
| `-m|--manifest`  | **(optional)** Location of the W3C Web App manifest file (URL or local path). If not specified, the tool looks for a manifest in the site URL. Otherwise, a new manifest will be created pointing to the site URL. |

### Example

````
manifoldjs http://meteorite.azurewebsites.net -d C:\Projects -l info -p windows10,android -b
````

## Client Library

### Manifest Module

````
var manifesTools = require('manifestTools');
````

#### getManifestFromSite(siteUrl, callback)

Retrieves a manifest from a website. It looks for a manifest meta tag in the HTML content of the specified website URL; if no manifest is found, a new W3C manifest is retrieved with default `start_name` and `short_name` values.

`siteUrl` is the URL of the website that hosts the manifest.

`callback(err, manifestInfo)` returns an error or the manifest object in `manifestInfo`.

#### getManifestFromFile(filePath, callback)

Retrieves a manifest from a local path.

`siteUrl` is the path there the manifest file is located.

`callback(err, manifestInfo)` returns an error or the manifest object in `manifestInfo`.


#### writeToFile(manifestInfo, filePath, callback)
Writes manifest info to the specified path.
`manifestInfo` Manifest data in JSON format.

`filePath` The path to write to.

`callback(err, validationResults)` returns an error or an array of validation results.

#### fetchManifestUrlFromSite(siteUrl, callback)
If found, gets the manifest URL from the specified website URL.

`siteUrl` is the URL of the website.

`callback(err, content)` returns an error or a content object with start_url and short_name members.

#### downloadManifestFromUrl(manifestUrl, callback)
Downloads the manifest from the specified URL.

`manifestUrl` is the URL of the manifest.

`callback(err, manifestInfo)` returns an error or the manifest object in `manifestInfo`.

#### validateAndNormalizeStartUrl(siteUrl, manifestInfo, callback)
Validates the format of the manifest is a W3C manifest format.

`siteUrl` is the URL of the website.

`manifestInfo` is the manifest's data in JSON format.

`callback` returns an error or the manifest object in `manifestInfo`.

#### convertTo(manifestInfo, outputFormat, callback)
Converts the manifest data to the specified output format.

`manifestInfo` is the manifest's data in JSON format.

`outputformat` is the format to which the manifest will be converted.

`callback(err, manifestInfo)` returns an error or the manifest object in `manifestInfo`.

#### validateManifest(manifestInfo, targetPlatforms, callback)
Makes sure the manifest is valid for the specified target platforms.

`manifestInfo` is the manifest's data in JSON format.

`targetPlatforms` are the platforms to validate against.

`callback(err, validationResults)` returns an error or an array of validation results.

#### manifestInfo format

`manifestInfo.content` stores the manifest content.

`manifestInfo.format` specifies the type of manifest (possible values: `W3C`, `undefined`).

---

### Builder Module
````
var projectBuilder = require('projectBuilder');
````
#### createApps(w3cManifestInfo, rootDir, platforms, build, callback)
Generates the applications for the specified platforms.

`w3cManifestInfo` is the manifest's data in JSON format.

`rootDir` is the root directory where the apps will be generated.

`platforms` are the target platforms.

`build` specifies whether to build the application or not.

`callback(err)` returns an error, if any.

---

### Project Tools module
````
var projectTools = require('projectTools');
````
#### runApp(platform, callback)
Execute the app for the chosen platform.

`platform` The app will execute for the selected platform.

`callback` returns an error, if any.

#### openVisualStudio(callback)
Opens the Visual Studio project.
{'fraction_non_alphanumeric': 0.12087364116884412, 'fraction_numerical': 0.0023935374488880026, 'mean_word_length': 4.937240970988751, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2154968', 'n_tokens_mistral': 2836, 'n_tokens_neox': 2725, 'n_words': 1168}