-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.md.orig
301 lines (225 loc) · 11.8 KB
/
README.md.orig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<<<<<<< HEAD
Ionic App Base
=====================
A starting project for Ionic that optionally supports using custom SCSS.
## Using this project
We recommend using the [Ionic CLI](https://github.com/driftyco/ionic-cli) to create new Ionic projects that are based on this project but use a ready-made starter template.
For example, to start a new Ionic project with the default tabs interface, make sure the `ionic` utility is installed:
=======
[![Build Status][circle-badge]][circle-badge-url]
[![npm][npm-badge]][npm-badge-url]
# Ionic CLI
The Ionic command line interface (CLI) is your go-to tool for developing
[Ionic][ionic-homepage] apps.
Use `ionic --help` for more detailed command information.
:mega: **Support/Questions?** Please see our [Support Page][ionic-support] for
general support questions. The issues on GitHub should be reserved for bug
reports and feature requests.
:sparkling_heart: **Want to contribute?** Please see
[CONTRIBUTING.md](https://github.com/ionic-team/ionic-cli/blob/master/CONTRIBUTING.md).
## Table of Contents ##
* [Requirements](#requirements)
* [Install](#install)
* [Getting Started](#getting-started)
* [Using Cordova](#using-cordova)
* [Requirements](#requirements-1)
* [Integrations](#integrations)
* [Environment Variables](#environment-variables)
* [CLI Flags](#cli-flags)
* [CLI Config](#cli-config)
* [CLI Hooks](#cli-hooks)
* [Example](#example)
* [Service Proxies](#service-proxies)
* [Using a Proxy](#using-a-proxy)
* [Legacy Version](#legacy-version)
## Requirements
* Node 6 LTS (latest)
* npm 3+
## Install
>>>>>>> 3a447a5e88ef85cb690251cfe521a0c51a657d19
```bash
$ npm install -g ionic
```
<<<<<<< HEAD
Then run:
```bash
$ ionic start myProject tabs
```
More info on this can be found on the Ionic [Getting Started](http://ionicframework.com/getting-started) page and the [Ionic CLI](https://github.com/driftyco/ionic-cli) repo.
## Issues
Issues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/). Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/submit-issue/) to the main Ionic repository.
=======
:memo: *Note: For a global install `-g ionic`, macOS/Linux users may need to
prefix with `sudo` or can setup [proper file permissions for
npm](https://docs.npmjs.com/getting-started/fixing-npm-permissions).*
:memo: *Note: Running `ionic` will first look to see if you're in an Ionic
project. If you are, it runs the locally installed CLI, if installed.*
<a name="ionic-1"></a>
<a name="ionic-v1"></a>
<a name="ionic-angular"></a>
<a name="starter-templates"></a>
<a name="starter-templates-1"></a>
## Getting Started
New projects are started with the `ionic start` command. For full details and
examples, see:
```bash
ionic start --help
```
Here is a table of project types and links to their respective starter
templates:
| Project Type | Start Command | Starter Templates |
|-----------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [**Ionic Angular**][ionic-angular-docs] | `ionic start myApp` | [blank][ionic-angular-blank], [tabs][ionic-angular-tabs], [sidemenu][ionic-angular-sidemenu], [conference][ionic-angular-conference], [tutorial][ionic-angular-tutorial], [super][ionic-angular-super] |
| [**Ionic 1**][ionic1-docs] | `ionic start myApp --type=ionic1` | [blank][ionic1-blank], [tabs][ionic1-tabs], [sidemenu][ionic1-sidemenu], [maps][ionic1-maps] |
After you start your project, you can `cd` into the directory and serve it in
your browser:
```bash
cd ./myApp
ionic serve
```
## Using Cordova
Integrate Ionic with [Cordova](https://cordova.apache.org/) to bring native
capabilities to your app.
### Requirements
* For iOS development, see the [iOS Platform
Guide](https://cordova.apache.org/docs/en/latest/guide/platforms/ios/index.html).
* For Android development, see the [Android Platform
Guide](https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html).
```bash
$ npm install -g cordova
$ ionic cordova --help
$ ionic cordova run ios
```
## Integrations
As of CLI 3.8, the `@ionic/cli-plugin-cordova` and `@ionic/cli-plugin-gulp`
have been deprecated in favor of *integrations*. Integrations are automatically
detected and enabled, but can be easily disabled.
Integrations hook into CLI events. For example, when the Cordova integration is
enabled, `ionic cordova prepare` will run after `ionic build` runs. See [CLI
Hooks](#cli-hooks).
| integration | enabled when... | disabled with... |
| ------------|-----------------------------------------------------------|-------------------------------------------------------|
| Cordova | `ionic cordova` commands are run | `ionic config set integrations.cordova.enabled false` |
| Gulp | `gulp` exists in `devDependencies` of your `package.json` | `ionic config set integrations.gulp.enabled false` |
## Environment Variables
The CLI will look for the following environment variables:
* `IONIC_CONFIG_DIRECTORY`: Where the CLI config files live. Defaults to
`~/.ionic`. You may prefer `~/.config/ionic`.
* `IONIC_HTTP_PROXY`: Set a URL for proxying all CLI requests through. See
[Using a Proxy](#using-a-proxy). The CLI will also look for `HTTP_PROXY` and
`HTTPS_PROXY`, both of which npm use.
* `IONIC_EMAIL` / `IONIC_PASSWORD`: For automatic login via environment
variables.
## CLI Flags
CLI flags are global options that alter the behavior of a CLI command.
* `--help`: Instead of running the command, view its help page.
* `--verbose`: Show all log messages for debugging purposes.
* `--quiet`: Only show `WARN` and `ERROR` log messages.
* `--no-interactive`: Turn off interactive prompts and fancy outputs. If a CI
server is detected (we use [ci-info](https://www.npmjs.com/package/ci-info)),
the CLI is automatically non-interactive.
* `--confirm`: Turn on auto-confirmation of confirmation prompts. *Careful*:
the CLI prompts before doing something potentially harmful. Auto-confirming
may have unintended results.
## CLI Config
The CLI provides commands for setting and printing config values from project
config files and the global CLI config file. See `ionic config set --help` and
`ionic config get --help` for usage.
## CLI Hooks
CLI hooks are how you can run scripts during CLI events, such as "watch" and
"build". To hook into the CLI, use the following [npm
scripts](https://docs.npmjs.com/misc/scripts) in your `package.json` file:
| npm script | description | commands |
|----------------------|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| `ionic:watch:before` | Runs **before** the file watcher activates during a "watch" event | `ionic serve`, `ionic cordova run -l`, `ionic cordova emulate -l` |
| `ionic:build:before` | Runs **before** the Ionic "build" event starts. | `ionic build`, `ionic upload`, `ionic package build`, `ionic cordova build`, `ionic cordova run`, `ionic cordova emulate` |
| `ionic:build:after` | Runs **after** the Ionic "build" event finishes. | `ionic build`, `ionic upload`, `ionic package build`, `ionic cordova build`, `ionic cordova run`, `ionic cordova emulate` |
### Example
```json
"scripts": {
"ionic:build:before": "cp somefile www/somefile",
}
```
:memo: *Note: If you use [gulp](https://gulpjs.com/), the CLI will run gulp
tasks by the same name as the npm scripts above.*
## Service Proxies
The CLI can add proxies to the HTTP server for "livereload" commands like
`ionic serve`, `ionic cordova run android -lcs`, or similar. 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 an 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](https://nodejs.org/api/http.html#http_class_http_agent)
```json
{
"name": "appname",
"app_id": "",
"type": "ionic-angular",
"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`.
:memo: *Note: Don't forget to change the URLs being requested in your app to
the local URL. Also, the "livereload" command must be restarted for the proxy
configuration to take effect.*
## Using a Proxy
To proxy HTTP requests performed by the CLI, you will need to install the CLI
proxy plugin in the same `node_modules` context as the Ionic CLI:
For CLI installed globally:
```bash
$ npm install -g @ionic/cli-plugin-proxy
```
For CLI installed locally:
```bash
$ cd myProject # cd into your project
$ npm install --save-exact --save-dev @ionic/cli-plugin-proxy
```
Then, set the following environment variables:
```bash
$ export HTTP_PROXY=http://proxy.example.org:8888 # used by npm
$ export HTTPS_PROXY=https://proxy.example.org:8888 # used by npm
$ export IONIC_HTTP_PROXY=http://proxy.example.org:8888
```
For example:
```bash
$ HTTPS_PROXY=https://internal.proxy.com ionic start
```
## Legacy Version
The old version of the CLI can be installed with the `legacy` tag:
```bash
npm install -g ionic@legacy
```
[ionic-homepage]: https://ionicframework.com
[ionic-docs]: https://ionicframework.com/docs
[ionic-support]: https://ionicframework.com/support
[ionic-angular-docs]: https://ionicframework.com/docs
[ionic-angular-blank]: https://github.com/ionic-team/ionic2-starter-blank
[ionic-angular-tabs]: https://github.com/ionic-team/ionic2-starter-tabs
[ionic-angular-sidemenu]: https://github.com/ionic-team/ionic2-starter-sidemenu
[ionic-angular-conference]: https://github.com/ionic-team/ionic-conference-app
[ionic-angular-tutorial]: https://github.com/ionic-team/ionic2-starter-tutorial
[ionic-angular-super]: https://github.com/ionic-team/ionic-starter-super
[ionic1-docs]: https://ionicframework.com/docs/v1
[ionic1-blank]: https://github.com/ionic-team/ionic-starter-blank
[ionic1-tabs]: https://github.com/ionic-team/ionic-starter-tabs
[ionic1-sidemenu]: https://github.com/ionic-team/ionic-starter-sidemenu
[ionic1-maps]: https://github.com/ionic-team/ionic-starter-maps
[circle-badge]: https://circleci.com/gh/ionic-team/ionic-cli.svg?style=shield
[circle-badge-url]: https://circleci.com/gh/ionic-team/ionic-cli
[npm-badge]: https://img.shields.io/npm/v/ionic.svg
[npm-badge-url]: https://www.npmjs.com/package/ionic
>>>>>>> 3a447a5e88ef85cb690251cfe521a0c51a657d19