Skip to content

Commit 36dc2f7

Browse files
committed
feat: ionic pro
1 parent 243f20d commit 36dc2f7

93 files changed

Lines changed: 2398 additions & 648 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ lerna-debug.log
1111

1212
docs
1313
dist
14+
15+
package-lock.json*

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,31 @@ the CHANGELOG files within CLI packages. For specific commit-level changes, see
77

88
## Versions
99

10+
<a name="3.6.0"></a>
11+
### 3.6.0 (PENDING)
12+
13+
* Added `ionic config` commands for getting and setting project
14+
(`ionic.config.json`) and global CLI config (`~/.ionic/config.json`) files.
15+
See
16+
[README.md#cli-config](https://github.com/ionic-team/ionic-cli/blob/master/README.md#cli-config).
17+
* Removed `--no-timeouts`: All CLI timeouts have been removed, so the option is
18+
useless.
19+
* Fixed odd behavior of `--no-interactive` and `--confirm`: the flags now work
20+
per-command and do not persist the mode.
21+
* Added recommendation for local CLI installation. You can use the global
22+
`ionic` binary from `npm i -g ionic` installation and it will use the local
23+
CLI version if installed, similar to gulp or other CLIs. The CLI is installed
24+
locally for new projects by default.
25+
* Moved update checking into an opt-in background process that checks npm for
26+
new versions. The CLI now simply reads a file of latest versions instead of
27+
doing network requests. (The CLI may need to do network requests initially
28+
during commands to fill in version information.)
29+
* Added `ionic logout` command. Hidden for now.
30+
* Using `--no-interactive` will no longer check for CLI updates at all.
31+
* Fixed issue with Ionic 1 not live-reloading in devices.
32+
* Added `--no-build` option to `ionic cordova build` to skip Ionic builds.
33+
* Added check for Android SDK Tools version during `ionic info`.
34+
1035
<a name="3.5.0"></a>
1136
### 3.5.0 (2017-07-11)
1237

@@ -29,7 +54,7 @@ the CHANGELOG files within CLI packages. For specific commit-level changes, see
2954
bullet point below!
3055
* Added CLI hooks that you can use to run code during CLI events using npm
3156
scripts. See
32-
[README.md](https://github.com/ionic-team/ionic-cli/blob/master/README.md#cli-hooks)
57+
[README.md#cli-hooks](https://github.com/ionic-team/ionic-cli/blob/master/README.md#cli-hooks)
3358
for usage.
3459
* :tada: Added
3560
[`@ionic/cli-plugin-gulp`](https://github.com/ionic-team/ionic-cli/tree/master/packages/cli-plugin-gulp)!

CONTRIBUTING.md

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,41 +57,16 @@ published as `ionic`.
5757
1. `npm install` to install the dev tools.
5858
1. `npm run bootstrap` (will install package dependencies and link packages
5959
together)
60+
1. Optionally `npm run link` to make `ionic` point to your dev CLI.
6061
1. `npm run watch` will spin up TS & JS watch scripts for all packages.
6162
1. Typescript source files are in `packages/*/src`.
6263
1. Good luck! :muscle: Please open an issue if you have questions or something
6364
is unclear.
6465

6566
##### Running Dev CLI
6667

67-
###### macOS/Linux
68-
1. Put `alias ionic-local=/path/to/ionic-cli/packages/ionic/bin/ionic` (making
69-
sure to change `/path/to` to your installation directory) in `~/.bashrc` (or
70-
equivalent) and `source ~/.bashrc`.
71-
1. You should now be able to run `ionic-local help` and see your locally
72-
installed version.
73-
74-
###### Windows
75-
1. Create a `ionic-local.cmd` file at `%AppData%\npm\` with the following content:
76-
77-
```batch
78-
@IF EXIST "%~dp0\node.exe" (
79-
"%~dp0\node.exe" "C:\path\to\ionic-cli\packages\ionic\bin\ionic" %*
80-
) ELSE (
81-
@SETLOCAL
82-
@SET PATHEXT=%PATHEXT:;.JS;=;%
83-
node "C:\path\to\ionic-cli\packages\ionic\bin\ionic" %*
84-
)
85-
```
86-
87-
1. You should now be able to run `ionic-local help` and see your locally
88-
installed version without change the existing ionic installation.
89-
90-
**OR**
91-
92-
1. Run `npm link` from `packages/ionic`.
93-
1. You should now be able to run `ionic help` and see your locally
94-
installed version in place of default ionic installation.
68+
You can switch between your dev CLI and stable with `npm run link` and `npm run
69+
unlink && npm i -g ionic`.
9570

9671
##### Code Structure
9772

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ issues on GitHub should be reserved for bug reports and feature requests.
2929
+ [Requirements](#requirements-1)
3030
* [Environment Variables](#environment-variables)
3131
* [CLI Flags](#cli-flags)
32-
+ [Persistent flags](#persistent-flags)
32+
* [CLI Config](#cli-config)
3333
* [CLI Hooks](#cli-hooks)
3434
+ [Example](#example)
3535
* [Service Proxies](#service-proxies)
@@ -122,23 +122,23 @@ The CLI will look for the following environment variables:
122122

123123
## CLI Flags
124124

125-
CLI flags are global options that alter CLI behavior.
125+
CLI flags are global options that alter the behavior of a CLI command.
126126

127127
* `--help`: Instead of running the command, view its help page.
128128
* `--verbose`: Show all log messages for debugging purposes.
129129
* `--quiet`: Only show `WARN` and `ERROR` log messages.
130-
131-
### Persistent flags
132-
133-
The behavior that these flags set is remembered in the CLI config file.
134-
135-
* `--interactive` / `--no-interactive`: Switch between interactive (default)
136-
and non-interactive mode. In non-interactive mode, the spinner and all
137-
prompts are disabled (useful for CI/CD servers).
138-
* `--confirm` / `--no-confirm`: Switch between auto-confirmation and
139-
non-confirmation (default) of confirmation prompts. *Careful*: the CLI
140-
prompts before doing something potentially harmful. Auto-confirming may have
141-
unintended results.
130+
* `--no-interactive`: Turn off interactive prompts and fancy outputs. If a CI
131+
server is detected (we use [ci-info](https://www.npmjs.com/package/ci-info)),
132+
the CLI is automatically non-interactive.
133+
* `--confirm`: Turn on auto-confirmation of confirmation prompts. *Careful*:
134+
the CLI prompts before doing something potentially harmful. Auto-confirming
135+
may have unintended results.
136+
137+
## CLI Config
138+
139+
The CLI provides commands for setting and printing config values from project
140+
config files and the global CLI file. See `ionic config set --help` and `ionic
141+
config get --help` for usage.
142142

143143
## CLI Hooks
144144

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"private": true,
33
"scripts": {
4-
"bootstrap": "lerna bootstrap && npm run build && npm run link",
5-
"link": "lerna exec --scope \"@ionic/cli-*\" -- npm link",
6-
"lint": "tslint -c tslint.json 'packages/*/src/**/*.ts' 'scripts/**/*.ts'",
4+
"bootstrap": "lerna bootstrap && npm run build",
5+
"clean": "lerna run clean",
6+
"link": "lerna exec -- npm link",
7+
"unlink": "lerna exec -- npm unlink",
8+
"lint": "lerna run lint",
79
"test": "lerna run test",
810
"build": "lerna run build",
911
"watch": "lerna run watch --parallel",
1012
"docs": "node ./packages/cli-scripts/docs.js",
1113
"publish:canary": "lerna publish --canary --exact --npm-tag=canary --skip-git",
12-
"publish:pro": "lerna publish --canary=pro --exact --npm-tag=pro --skip-git",
1314
"publish:beta": "lerna publish --exact --npm-tag=beta",
1415
"publish:ci": "npm run publish:canary -- --yes",
1516
"publish": "lerna publish --exact --conventional-commits",

packages/cli-plugin-cordova/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"types": "./dist/main.d.ts",
99
"scripts": {
1010
"clean": "rm -rf ./dist",
11-
"lint": "tslint -c ../../tslint.json \"src/**/*.ts\"",
11+
"lint": "tslint --config ../../tslint.json --project tsconfig.json --type-check",
1212
"build": "npm run clean && npm run build-ts && npm run build-js",
1313
"build-ts": "tsc",
1414
"build-js": "npm run script-prepublish && cp ./resources.json ./dist/resources.json",
@@ -61,6 +61,7 @@
6161
"dependencies": {
6262
"@ionic/cli-utils": "1.5.0",
6363
"chalk": "^2.0.0",
64+
"tslib": "^1.7.1",
6465
"xml2js": "^0.4.17"
6566
},
6667
"devDependencies": {

packages/cli-plugin-cordova/src/commands/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616

1717
import { CORDOVA_INTENT, filterArgumentsForCordova, generateBuildOptions } from '../lib/utils/cordova';
1818
import { resetConfigXmlContentSrc, writeConfigXmlContentSrc } from '../lib/utils/configXmlUtils';
19-
import { getProjectPlatforms, getProjectPlugins, installPlatform } from '../lib/utils/setup';
19+
import { getProjectPlatforms, installPlatform } from '../lib/utils/setup';
2020

2121
export const CORDOVA_RUN_COMMAND_OPTIONS = [
2222
{

packages/cli-plugin-cordova/src/commands/compile.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
CommandLineOptions,
55
CommandMetadata,
66
CommandPreRun,
7-
validators,
87
} from '@ionic/cli-utils';
98

109
import { filterArgumentsForCordova } from '../lib/utils/cordova';

packages/cli-plugin-cordova/src/commands/platform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class PlatformCommand extends CordovaCommand implements CommandPreRun {
8484
const platforms = await getProjectPlatforms(this.env.project.directory);
8585

8686
if (action === 'add' && platforms.includes(platformName)) {
87-
this.env.log.ok(`Platform ${platformName} already exists.`);
87+
this.env.log.info(`Platform ${platformName} already exists.`);
8888
return;
8989
}
9090

packages/cli-plugin-cordova/src/commands/resources.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,12 @@ export class ResourcesCommand extends Command implements CommandPreRun {
110110
// check that config file config.xml exists
111111
const configJson = await parseConfigXmlToJson(this.env.project.directory);
112112

113-
const config = await this.env.config.load();
114-
115113
const resourceJsonStructure = await getResourceConfigJson();
116-
this.env.log.debug(`resourceJsonStructure=${Object.keys(resourceJsonStructure).length}`);
114+
this.env.log.debug(() => `resourceJsonStructure=${Object.keys(resourceJsonStructure).length}`);
117115

118116
// check that at least one platform has been installed
119117
let platformDirContents = await getProjectPlatforms(this.env.project.directory);
120-
this.env.log.debug(`platformDirContents=${platformDirContents}`);
118+
this.env.log.debug(() => `platformDirContents=${platformDirContents}`);
121119

122120
if (platform && !platformDirContents.includes(platform)) {
123121
this.env.tasks.end();
@@ -130,19 +128,19 @@ export class ResourcesCommand extends Command implements CommandPreRun {
130128
if (confirm) {
131129
await installPlatform(this.env, platform);
132130
platformDirContents = await getProjectPlatforms(this.env.project.directory);
133-
this.env.log.debug(`platformDirContents=${platformDirContents}`);
131+
this.env.log.debug(() => `platformDirContents=${platformDirContents}`);
134132
} else {
135133
throw this.exit(`Platform ${chalk.green(platform)} not installed.`);
136134
}
137135
}
138136

139137
const buildPlatforms = Object.keys(resourceJsonStructure).filter(p => platformDirContents.includes(p));
140-
this.env.log.debug(`buildPlatforms=${buildPlatforms}`);
138+
this.env.log.debug(() => `buildPlatforms=${buildPlatforms}`);
141139
if (buildPlatforms.length === 0) {
142140
this.env.tasks.end();
143141
throw this.exit(`No platforms have been added. Please run: ${chalk.green('ionic cordova platform add')}`);
144142
}
145-
this.env.log.debug(`${chalk.green('getProjectPlatforms')} completed - length=${buildPlatforms.length}`);
143+
this.env.log.debug(() => `${chalk.green('getProjectPlatforms')} completed - length=${buildPlatforms.length}`);
146144

147145
const orientation = getOrientationFromConfigJson(configJson) || 'default';
148146

@@ -162,19 +160,19 @@ export class ResourcesCommand extends Command implements CommandPreRun {
162160
imgResources = imgResources.filter((img) => img.platform === platform);
163161
}
164162

165-
this.env.log.debug(`imgResources=${imgResources.length}`);
163+
this.env.log.debug(() => `imgResources=${imgResources.length}`);
166164

167165
// Create the resource directories that are needed for the images we will create
168166
const buildDirResponses = await createImgDestinationDirectories(imgResources);
169-
this.env.log.debug(`${chalk.green('createImgDestinationDirectories')} completed - length=${buildDirResponses.length}`);
167+
this.env.log.debug(() => `${chalk.green('createImgDestinationDirectories')} completed - length=${buildDirResponses.length}`);
170168

171169
// Check /resources and /resources/<platform> directories for src files
172170
// Update imgResources to have their src attributes to equal the most
173171
// specific src img found
174172
let srcImagesAvailable: SourceImage[] = [];
175173
try {
176174
srcImagesAvailable = await getSourceImages(buildPlatforms, resourceTypes, resourceDir);
177-
this.env.log.debug(`${chalk.green('getSourceImages')} completed - ${srcImagesAvailable.length}`);
175+
this.env.log.debug(() => `${chalk.green('getSourceImages')} completed - ${srcImagesAvailable.length}`);
178176
} catch (e) {
179177

180178
}
@@ -214,7 +212,7 @@ export class ResourcesCommand extends Command implements CommandPreRun {
214212
let imageUploadResponses: ImageUploadResponse[];
215213

216214
imageUploadResponses = await uploadSourceImages(srcImagesAvailable);
217-
this.env.log.debug(`${chalk.green('uploadSourceImages')} completed - responses=${JSON.stringify(imageUploadResponses, null, 2)}`);
215+
this.env.log.debug(() => `${chalk.green('uploadSourceImages')} completed - responses=${JSON.stringify(imageUploadResponses, null, 2)}`);
218216

219217
srcImagesAvailable = srcImagesAvailable.map((img: SourceImage, index): SourceImage => {
220218
return {
@@ -254,7 +252,7 @@ export class ResourcesCommand extends Command implements CommandPreRun {
254252

255253
const generateImageResponses = await Promise.all(promiseList);
256254
this.env.tasks.updateMsg(`Generating platform resources: ${chalk.bold(`${imgResources.length} / ${imgResources.length}`)} complete`);
257-
this.env.log.debug(`${chalk.green('generateResourceImage')} completed - responses=${JSON.stringify(generateImageResponses, null, 2)}`);
255+
this.env.log.debug(() => `${chalk.green('generateResourceImage')} completed - responses=${JSON.stringify(generateImageResponses, null, 2)}`);
258256

259257
// TODO: UPDATE CONFIG.XML DATA
260258
this.env.tasks.next(`Modifying config.xml to add new image resources`);

0 commit comments

Comments
 (0)