# transform-container

## Description

* This command can be used to transform a local Container using a given Container transformer.

## Currently Available Official Transformers

* [pbxproj](https://github.com/electrode-io/ern-container-transformer-pbxproj)\
  Can be used to patch one or more pbxproj (iOS project file) included in the Container, in specific ways.
* [build-config](https://github.com/electrode-io/ern-container-transformer-build-config)\
  Can be used to update Build Configuration(s) -build settings- of a generated iOS Container.
  * [script](https://github.com/electrode-io/ern-container-transformer-script)\
    This transformer allows for executing an arbitrary script to transform the Container in some custom way. It supports transformation of both iOS and Android Containers.
  * [git-patch](https://github.com/electrode-io/ern-container-transformer-git-patch)\
    Can be used to apply one or more sequential git patches to the Container.

### Syntax

`ern transformer-container`

**Options**

`--containerPath`

* The local file system path to the directory containing the Container to transform.
* **Default**  If this option is not provided, the command will look for a Container in the default platform directory `~/.ern/containergen/out/[platform]`.

`--descriptor`

* A complete native application descriptor
* If this option is set, the `transform-container` command will apply all the transformers defined in the Cauldron for the matched descriptor. In that case, the `--transfomer` and `--platform` options should not be provided.

`--platform/-p`

* Specify the native platform of the target Container to transform.
* This option is required, there is no default (unless `--descriptor` is used)

`--transformer/-t`

* Specify the Container transformer to use (for ex `build-config`).
* Can also include a specific version or a version range (for ex `build-config@1.0.0` or `build-config@^1.0.0`)
* If no version is specified, the latest available version of the publisher will be used at the time of publication (this is a bit risky given that new major publisher versions will contain breaking changes. We **recommend** that you use a specific version or version range allowing minor and patch updates only)
* It is also possible to pass a local file system path to a Container transformer package (only used for transformers development).
* This option is required, there is no default (unles `--descriptor` is used)

`--extra/-e`

* Extra configuration specific to the transformer (as json)
* Some transformers might not need any extra configuration. Check the specific Container transformer documentation for reference.
* There is three different ways to provide the json extra configuration :
  * **As a json string** &#x20;

    For example `--extra '{"configKey": "configValue"}'` &#x20;
  * **As a file path** &#x20;

    For example `--extra /Users/username/my-transformer-config.json` &#x20;

    In that case, the configuration will be read from the file
  * **As a Cauldron file path** &#x20;

    For example `--extra cauldron://config/publishers/my-transformer-config.json` &#x20;

    In that case, the configuration will be read from the file stored in Cauldron.  &#x20;

    For this way to work, the file must exist in Cauldron (you can add a file to the cauldron by using the \[ern cauldron add file] command). &#x20;

### Related commands

[ern create-container](https://native.electrode.io/v0.26/cli-commands/create-container) | Create a new Container (native or JavaScript only) locally to the workstation.\
[ern publish-container](https://native.electrode.io/v0.26/cli-commands/publish-container) | Publish a Container.

\[ern cauldron add file]: ./add/file.md
