diff --git a/cli-references.md b/cli-references.md index 71a90bbc..c5c773c9 100644 --- a/cli-references.md +++ b/cli-references.md @@ -60,9 +60,9 @@ List of `heta build` options: | --type | \ | heta | Type of source file. This option allows to select type of module which will be applied for parsing. Available values: heta/xlsx/json/yaml/sbml. | | --debug | | | Working in debugging mode. All parsed files will be saved in JSON files in **meta** directory. | | --units-check | | | If set all records will be checked for units consistency. | -| --dist-dir | \ | | Set export directory path, where to store exported files. | -| --meta-dir | \ | | Set meta directory path. | -| --log-mode | string | error | The rule in which case the log file should be created. Possible values are: never/error/always | +| --dist-dir | \ | | Set export directory path, where to store exported files. Path can be absolute or relative to the project directory. | +| --meta-dir | \ | | Set meta directory path. Path can be absolute or relative to the project directory.| +| --log-mode | string | error | The rule in which case the log file should be created. Possible values are: never/error/always. Path can be absolute or relative to the project directory. | | -d, --declaration | string | platform | The filepath to declaration file (see below) without extension. The command will search the declaration file based on option trying a set of extensions: .json/.yml. | | --log-level | string | error | The level of log information to display. Possible values are: error/warn/info/debug. | | --skip-updates | | | Do not check available new version in npm. | @@ -157,24 +157,6 @@ If we check the content of the created "test" directory we will see the followin **.gitattributes, .gitignore** : templates to help working with [Git](https://git-scm.com/) -## "heta update" command - -*Experimental* - -`heta update` installs the latest version of heta-compiler available on NPM. - -If the additional argument `[version]` is set then it will install the selected version. - -The command is equivalen to `npm install --global heta-compiler`. - -#### Example - -To install the selected version. - -```bash -heta update 0.7.1 -``` - ## "heta help" command To obtain a list of options and command description one can use command help. @@ -218,7 +200,7 @@ There are properties in declaration file which do not change compilation process | options.metaDir | string | --meta-dir | meta | If `options.debug` is set as `true` this option changes the target directory for meta files. | | export | object[] | -e, --export | `[]` | List of export formats to run divided by colon. Each component includes `format` option and optional settings. see more details in [export-formats](./export-formats.md). | -Using neither declaration file nor CLI options is equivalent to the following declaration: +Using neither declaration file nor CLI options is equivalent to the following declaration file: ```json { "builderVersion": "", diff --git a/export-formats.md b/export-formats.md index ad3be5e4..d6cfa308 100644 --- a/export-formats.md +++ b/export-formats.md @@ -45,7 +45,12 @@ See [migrate to v0.9](./migrate-to-v0.9.md) and [CLI references](./cli-reference There are two recommended ways to export models in Heta compiler: using [`export` property](./cli-references.md#declaration-file-format) in declaration file or using CLI [`--export` property](./cli-references.md#running-build-with CLI-options). If no --export option is set, the compiler will use the `export` property from the declaration file. -The `export` property is an array of objects with `format` property and other format-specific properties. +The `export` property is an array of objects with the `format` and `filepath` properties and other format-specific properties. + +- `format` is a case-sensitive string with the name of the format. The list of supported formats is below. +- `filepath` is an *optional* property, which is a string with the path to the output directory. The path is relative to the output (`dist`) directory. + +**Example** ```yaml { @@ -61,11 +66,22 @@ The `export` property is an array of objects with `format` property and other fo format: SBML, version: L2V4, filepath: model + }, + { + format: Table } ] } ``` +Instead of `export` property in the declaration file, one can use CLI `--export` option. The option is an comma-separated list of format names. The list ai also supports structures in JSON format. If the `--export` option is set, the compiler will ignore the `export` property in the declaration file. + +**Example** + +```bash +heta build --export '{format: JSON, filepath: output, omit: ["aux.wiki"], spaceFilter: "nameless|another"}, {format: SBML, version: L2V4, filepath: model}, Table' +``` + ## JSON Export to [JSON structure](https://www.json.org/) (array) storing the content of whole platform or selected namespaces (see spaceFilter option). diff --git a/src/builder/index.js b/src/builder/index.js index 85b66a16..043ac7c5 100644 --- a/src/builder/index.js +++ b/src/builder/index.js @@ -105,6 +105,12 @@ class Builder { this.exportArray = []; // create "export" instances declaration.export.forEach((exportItem) => { + // check the filepath + if (!!exportItem.filepath && path.isAbsolute(exportItem.filepath)) { + logger.error(`Export item property "filepath" must be relative, got ${JSON.stringify(exportItem)}.`, {type: 'BuilderError'}); + } + + // check if format is supported let ExportClass = this.exportClasses.hasOwnProperty(exportItem.format) && this.exportClasses[exportItem.format]; if (ExportClass) {