Giter Site home page Giter Site logo

hu19891110 / ionic-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ionic-team/ionic-cli

0.0 3.0 0.0 4.77 MB

The Ionic command line utility

Home Page: https://www.npmjs.org/package/ionic

License: MIT License

JavaScript 4.64% TypeScript 90.26% HTML 1.31% CSS 3.78%

ionic-cli's Introduction

Build Status npm

Ionic CLI

The Ionic command line interface (CLI) is your go-to tool for developing Ionic apps.

Use the ionic help command for more detailed task information.

๐Ÿ“ฃ Support/Questions?: Please see our Support Page for general support questions. The issues on GitHub should be reserved for bug reports and feature requests.

โค๏ธ Want to contribute?: Please see CONTRIBUTING.md.

Requirements

  • Node 6+
  • npm 3+

Install

$ npm install -g ionic@latest

๐Ÿ“ Note: For a global install of -g ionic, OSX/Linux users may need to prefix the command with sudo or can setup proper file permissions on OSX for npm to install without sudo.

Changes from CLI 2

We have rewritten the CLI from the ground up. Our main focus was to:

  1. Decrease the amount of time to the first start execution
  2. Improve the responsiveness of every CLI command
  3. Make the architecture flexible for future platform support (PWA, electron, etc.)
  4. Provide better help, more guidance, and more feedback when executing commands.

In doing so we decided to take a new approach to the CLI's structure. The base CLI installation now ships with global commands that are common to all Ionic apps.

Cordova commands have been namespaced and put into a CLI plugin, which is installed by default with new Ionic projects and can be installed in existing Ionic projects with npm i --save @ionic/cli-plugin-cordova. For full details, see below.

Here is a brief summary of changes in CLI 3. For more details and reasoning, see CHANGELOG.md.

  • Removed commands: setup, share, lib, io, security, push, config, service, add, remove, list, hooks, state.
  • Added commands: signup.
  • Cordova commands have been namespaced (e.g. ionic cordova build, not ionic build).
  • Many command arguments, options, and flags have changed. Please use ionic help <commands> for command usage.
  • generate command has been overhauled to interactively generate components, pages, etc. Going forward, generators will continue to be improved.

Starter Templates

$ ionic start --list

Ionic Angular

Start a new project

$ npm install -g ionic@latest
$ ionic start myNewProject
$ cd ./myNewProject
$ ionic serve

Existing project

$ npm install -g ionic@latest
$ npm install --save-dev --save-exact @ionic/cli-plugin-ionic-angular@latest @ionic/cli-plugin-cordova@latest
$ ionic help

Ionic 1

Start a new project

$ npm install -g ionic@latest
$ ionic start myNewProject blank --type ionic1
$ cd ./myNewProject
$ ionic serve

Existing project

$ npm install -g ionic@latest
$ npm install --save-dev --save-exact @ionic/cli-plugin-ionic1@latest @ionic/cli-plugin-cordova@latest
$ ionic help

Using Cordova

Integrate Ionic with Cordova to bring native capabilities to your app.

Requirements

$ npm install -g cordova
$ npm install --save-dev --save-exact @ionic/cli-plugin-cordova@latest
$ ionic cordova --help
$ ionic cordova run ios

Service Proxies

The serve command can add some proxies to the http server. These proxies are useful if you are developing in the browser and you need to make calls to an external API. With this feature you can proxy request to the external api through the ionic http server preventing the No 'Access-Control-Allow-Origin' header is present on the requested resource error.

In the ionic.config.json file you can add a property with an array of proxies you want to add. The proxies are object with the following properties:

  • path: string that will be matched against the beginning of the incoming request URL.
  • proxyUrl: a string with the url of where the proxied request should go.
  • proxyNoAgent: (optional) true/false, if true opts out of connection pooling, see HttpAgent
{
  "name": "appname",
  "email": "",
  "app_id": "",
  "proxies": [
    {
      "path": "/v1",
      "proxyUrl": "https://api.instagram.com/v1"
    }
  ]
}

Using the above configuration, you can now make requests to your local server at http://localhost:8100/v1 to have it proxy out requests to https://api.instagram.com/v1

Using a Proxy

To proxy CLI requests, you will first need to install a CLI plugin:

$ npm install --save-dev --save-exact @ionic/cli-plugin-proxy

Then, set any of the following environment variables:

$ export http_proxy=http://internal.proxy.com
$ export HTTP_PROXY=http://internal.proxy.com
$ export PROXY=http://internal.proxy.com
$ export IONIC_HTTP_PROXY=http://internal.proxy.com

For example:

$ HTTP_PROXY=http://internal.proxy.com ionic login

Ionic Docs

To open Ionic documentation from the Ionic CLI, use ionic docs.

Legacy Version

The old version of the CLI can be installed with the legacy tag:

npm install -g ionic@legacy

ionic-cli's People

Contributors

imhoffd avatar jthoms1 avatar jgw96 avatar perrygovier avatar twinj avatar deanmvsg avatar ericb avatar janpio avatar

Watchers

James Cloos avatar hadi avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.