# create-miniapp

## Description

* Create a new MiniApp in a new directory named after the MiniApp. &#x20;

The generated MiniApp is a starter `HelloWorld MiniApp` that you can use to launch a standalone MiniApp on the iOS or Android platforms in our Runner—using the `ern run-ios` and `ern run-android` commands.

If you used react-native previously, you'll notice that the generated JavaScript react-native MiniApp is exactly the same react-native starter app as the one provided by react-native. A MiniApp is simply a react-native application. One of the differences with react-native is that we generate our own native projects which use a locally-generated `ern` container.

iOS and Android directories are not generated by this command. To generate those directories, run the `ern run-ios` or `ern run-android` commands.

## Syntax

`ern create-miniapp <appName>`

**Arguments**

`<appName>`

* The name to use for the MiniApp. The MiniApp name must follow Electrode Native module name rules.
* We recommend suffixing the name of MiniApp with suffix `App`

**Options**

`--language <TypeScript | JavaScript>`

* Language to use for this MiniApp (either `TypeScript` or `JavaScript`)
* **Default** The command will prompt for language to use.

`--scope/-s <scope>`

* Specify the NPM package scope to use for the MiniApp.
* Add the package scope automatically in the `package.json` of the generated MiniApp.
* **Default** Package will be unscoped.

`--packageManager <'npm' | 'yarn'>`

* The package manager to be used with this MiniApp (`npm` or `yarn`)
* This will set `ern.packageManager` in the MiniApp `package.json`.&#x20;
* This setting will only be used for `ern add` and `ern upgrade-miniapp` commands. It won't apply for creating the MiniApp. Electrode Native is internally running `react-native init` command which uses `yarn` by default, if available on the machine, when creating an app. `react-native` does not offer this to be configured as of now. If you wish to use `npm`, you will have to manually remove the `yarn.lock` / `node_modules` in the MiniApp directory after creation, and run `npm install`.
* **Default** The command will prompt for the package manager to use.

`--packageName/-p <name>`

* Specify the NPM package name to use for the MiniApp.
* Add the package name automatically in the `package.json` of the generated MiniApp.
* **Default** The command will prompt for the package name to use.

`--platformVersion/-v <version>`

* Specify a platform version if different from the currently activated version.
* This option is rarely used. &#x20;
* **Default** Will use the currently activated platform version.

`--skipNpmCheck`

* Skip the check ensuring package does not already exists in NPM registry.
* **Default** The value defaults to false.&#x20;

`--manifestId <manifestId>`

* Id of the override Manifest entry to retrieve dependencies versions from (see \[override Manifest] for more info)

`--template <template>`

* The React Native project template to use.
* Internally, Electrode Native will forward this template to 'react-native init' command.
* Electrode Native will perform same post processing as it does on non templated MiniApps, once MiniApp is created (add 'ern' object to the package.json of the MiniApp and remove android and ios directories).

## Examples

`ern create-miniapp MyAwesomeApp`

Creates a MiniApp named `MyAwesomeApp`.

`ern create-miniapp MyAwesomeApp --scope MyCompany`

Creates a MiniApp named `MyAwesomeApp` and use `MyCompany` as the scope of the MiniApp NPM package.

`ern create-miniapp MyAwesomeApp --packageName my-awesome-app`

Creates a MiniApp named `MyAwesomeAp` and use `my-awesome-app` as the name of the MiniApp NPM package.

## Remarks

* MiniApp name can only consist of upper and lower case characters. No digits nor special characters can be used.
* Package name should be a valid NPM package name.
* This command is the `ern` equivalent of the `react-native init` command.

\[override Manifest]: ../platform-parts/manifest/override.md
