create-miniapp
Description
Create a new MiniApp in a new directory named after the MiniApp.
The generated MiniApp is a starter "Hello World" app that can be launched as a standalone app on the Android or iOS platforms using our Runner (ern run-android and ern run-ios).
If you have used React Native previously, you'll notice that the generated project looks similar to the React Native default template app as created by react-native init. One of the differences with React Native is that we generate our own native projects which use a locally generated ern container.
The android and ios directories are not created by this command. They will be generated by ern run-android and ern run-ios.
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>
Deprecated: Use
--templateto use custom templates, for example--template react-native-template-typescriptLanguage to use for this MiniApp (either
TypeScriptorJavaScript)Default
JavaScript.
--scope/-s <scope>
Specify the npm package scope to use for the MiniApp.
Add the package scope automatically in the
package.jsonof the generated MiniApp.Default Package will be unscoped.
--packageManager <npm | yarn>
The package manager to be used with this MiniApp (
npmoryarn)This will set
ern.packageManagerin the MiniApppackage.json.This setting will only be used for
ern addandern upgrade-miniappcommands. It won't apply for creating the MiniApp. Electrode Native is internally runningreact-native initcommand 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 removeyarn.lockandnode_modules/in the MiniApp directory after creation, and runnpm 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.jsonof 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.
Default Will use the currently activated platform version.
--skipInstall
Skip the installation of dependencies after project creation.
Default The value defaults to false.
--skipNpmCheck
Skip the check ensuring package does not already exists in npm registry.
Default The value defaults to false.
--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
androidandiosdirectories).
Examples
ern create-miniapp MyAwesomeAppCreates a MiniApp named
MyAwesomeApp.ern create-miniapp MyAwesomeApp --scope MyCompanyCreates a MiniApp named
MyAwesomeAppand useMyCompanyas the scope of the MiniApp npm package.ern create-miniapp MyAwesomeApp --packageName my-awesome-appCreates a MiniApp named
MyAwesomeAppand usemy-awesome-appas the name of the MiniApp npm package.
Remarks
MiniApp names must be alphanumeric, cannot contain special characters, and cannot start with a digit.
Package name should be a valid npm package name.
This command is the
ernequivalent of thereact-native initcommand.
Last updated