Overview

Introduction

Monaca CLI is a local development environment that is used to develop Monaca apps locally. The Monaca CLI provides a command line interface for using Monaca Cloud from your local PC. With the Monaca CLI, you can:

  • Create new local projects and import or clone existing projects from

    Monaca Cloud to your PC.

  • Develop Monaca apps with a local code editor you prefer.

  • Debug your app with inspector integration.

  • Support transpiler options for transpilable projects such as ReactJS

    and Angular2 projects.

  • Remote build your projects without any local setup.

Getting started

Prerequisite

You are required to have Node.js installed on your PC in order to install the Monaca CLI.

Step 1: CLI installation

Use the following command to install the Monaca CLI:

$ npm install -g monaca

On some systems you may have to prefix the command with sudo because of a permission issue:

$ sudo npm install -g monaca

In order to check the currently installed Monaca CLI’s version, use monaca command. Moreover, if you want to update Monaca CLI, just re-install it using the above command.

Step 2: Following the CLI tutorial

After installing the Monaca CLI, please follow our simple and easy tutorial on how to use Monaca CLI.

Transpiling in the Monaca CLI

Some of the modern frameworks have created their own languages in order to interact with their products (like JSX), or have just integrated some extensions that are not natively available in JavaScript (for example TypeScript). The transpiling process transforms the code written in those languages to a native JavaScript code ready to be executed on modern browsers/WebViews. We currently use WebPack to perform the transpiling operations.

Currently, it is available for the Vue, React and Angular2 templates. It can be triggered in two ways:

  1. monaca transpile: runs the transpiler on the current project.

  2. monaca preview: runs the transpiler in watch mode and starts an

    HTTP server to display the app’s content.

Upload/download control

You might sometimes want to exclude specific files and folders from the Monaca Cloud. When using Monaca, the .monacaignore file will be automatically created and placed under the root directory of the React Native projects. You can edit the file to add or remove specific files and folders.

.monacaignore is using the same pattern as .gitignore.

The default .monacaignore file looks like this:

/.monaca/*
!/.monaca/project_info.json
/platforms
.DS_Store
*.swp
.vscode/
typings/
node_modules
.git

See Also:

Last updated