Electrode Native container tries to be as agnostic as possible so that it can be added to a client application without requiring any custom modifications.

That being said, in some cases, some tweaking or post-processing of the generated container project might be needed. For example, to update some build settings of the iOS container, or gradle settings of the Android container, or to transform the container in a more radical way (for example transforming an iOS container to a pre-compiled fat binary framework). Because the container is generated by Electrode Native, any manual changes done post generation, would be overwritten by a new generation.

While it is totally possible to write your own transformers without relying on Electrode Native, for example just writing some automation scripts to perform your required transformations, we would recommend using Electrode Native transformers as it better fits in Electrode Native worfklow and can be used part in an Electrode Native pipelines. If you really need to run your own custom transformation script, you can use the [script-transformer] that allows to run any arbitrary custom made script as a transformer.

As for publishers, transformers have their own specific configuration, that can be supplied directly to the transform-container command or inlined in a json configuration file part of a pipeline configuration.

Here is a list of current container transformed offered by Electrode Native :

  • script This transformer can be used to run any arbitrary, custom made, executable script to transform the container.

  • git-patch This transformer can be used to apply a git patch on the generated container project.

  • xcframework This iOS only transformer can be used to transform the container project to an xcframework binary ready for distribution. It will take care of building the container project.

  • build-config This iOS only transformer can be used to alter iOS build configuration settings of the container.

  • pbxproj This iOS only transformer can be used to patch one or more pbxproj (iOS project file) included in the Container, in specific ways.

  • dummy This transformer is just a dummy transformer for illustration and debugging purposes. It won't publish the container anywhere, but will just log the configuration supplied to it.

Using a transformer

There are two ways to use a transformer, either explicitly or implicitly. Based on your needs and your context, you might need one way or the other (or both).

Explicilt transformer use

Electrode Native offers the [transform-container] command that can be used to transform a container. This commands does not require a cauldron. It cam transform any pre-generated container.

It is possible to run the [transform-container] command multiple times for the same container, to chain transformation on the container.

The use of the [create-container] / [transform-container] commands combo, will be mostly useful for development and experimentation with Electrode Native. It can also be used for automation purposes (CI) in some contexts.

Implicit transformer use

A transformer will be implicitly used when executing a container generation pipeline containing a transformer.

Configuring container transformation

When explicilty transforming a container, using the transform-container command, the transformer configuration should be supplied on the command line. Extra configuration, specific to the transformer, can however kept in a separate json configuration file stored locally or in a cauldron. Refer to the transform-container command documentation for more information.

Container transformers can also be added to a container generation pipeline, stored in a cauldron, so that it can be shared across users of the Cauldron and automatically triggered whenever regenerating a container from cauldron, using cauldron subcommands.

Creating a custom container transformer

As previously mentionned, Electrode Native container transformers are standalone node packages (published to npm) and retrieved dynamically _(they are not packaged within Electrode Native itself). In that sense it is quite easy to implement (and eventually distribute) your own container transforrmer if needed.

Check our dummy transforrmer as a reference to get started.

A few things to keep in mind when creating a Container publisher :

  • The package name must include ern-container-transformer. This is a convention for Electrode Native Container transformers, and is enforced by Electrode Native.

  • You should add a keyword ern-container-transformer in the keywords list of the package.json. This is not required, but could be leveraged later on by Electrode Native to facilitate container transformers discovery.

Last updated