diff --git a/packages/@ionic/cli-framework/CHANGELOG.md b/packages/@ionic/cli-framework/CHANGELOG.md
index 45b5230a18..35b2c1eb17 100644
--- a/packages/@ionic/cli-framework/CHANGELOG.md
+++ b/packages/@ionic/cli-framework/CHANGELOG.md
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-framework@1.0.4...@ionic/cli-framework@1.0.5) (2018-08-09)
+
+
+### Bug Fixes
+
+* **serve:** fix unclosed connection issue again ([#3500](https://github.com/ionic-team/ionic-cli/issues/3500)) ([1f0ef3b](https://github.com/ionic-team/ionic-cli/commit/1f0ef3b))
+
+
+
+
## [1.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-framework@1.0.3...@ionic/cli-framework@1.0.4) (2018-08-07)
diff --git a/packages/@ionic/cli-framework/package.json b/packages/@ionic/cli-framework/package.json
index 216a352d82..f95a476ee2 100644
--- a/packages/@ionic/cli-framework/package.json
+++ b/packages/@ionic/cli-framework/package.json
@@ -1,6 +1,6 @@
{
"name": "@ionic/cli-framework",
- "version": "1.0.4",
+ "version": "1.0.5",
"description": "The foundation framework of the Ionic CLI",
"homepage": "https://ionicframework.com/",
"author": "Ionic Team (https://ionicframework.com) ",
diff --git a/packages/@ionic/cli-framework/src/definitions.ts b/packages/@ionic/cli-framework/src/definitions.ts
index e6d69abee8..0127f98005 100644
--- a/packages/@ionic/cli-framework/src/definitions.ts
+++ b/packages/@ionic/cli-framework/src/definitions.ts
@@ -2,7 +2,7 @@ import * as os from 'os';
import { Opts as ParseArgsOptions, ParsedArgs } from 'minimist';
-import { AliasedMap } from './utils/object';
+import * as ζobject from './utils/object';
export type NetworkInterface = { device: string; } & os.NetworkInterfaceInfo;
@@ -70,8 +70,8 @@ export interface ICommand, N extends INamespac
export type CommandMapGetter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = () => Promise;
export type NamespaceMapGetter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = () => Promise;
-export type ICommandMap, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = AliasedMap>;
-export type INamespaceMap, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = AliasedMap>;
+export type ICommandMap, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = ζobject.AliasedMap>;
+export type INamespaceMap, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> = ζobject.AliasedMap>;
export interface INamespace, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> {
root: N;
@@ -139,11 +139,3 @@ export interface ValidationError {
message: string;
validator: Validator;
}
-
-export interface OutputStrategy {
- readonly stream: NodeJS.WritableStream;
-}
-
-export interface RedrawLine {
- redrawLine(msg?: string): void;
-}
diff --git a/packages/@ionic/cli-framework/src/guards.ts b/packages/@ionic/cli-framework/src/guards.ts
index 71b4860c43..2926ca497c 100644
--- a/packages/@ionic/cli-framework/src/guards.ts
+++ b/packages/@ionic/cli-framework/src/guards.ts
@@ -1,4 +1,4 @@
-import { CommandMetadata, CommandMetadataInput, CommandMetadataOption, HydratedCommandMetadata, ICommand, INamespace, PackageJson, RedrawLine } from './definitions';
+import { CommandMetadata, CommandMetadataInput, CommandMetadataOption, HydratedCommandMetadata, ICommand, INamespace, PackageJson } from './definitions';
export function isNamespace, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption>(obj: any): obj is N {
return obj &&
@@ -26,7 +26,3 @@ export function isHydratedCommandMetadata, N e
export function isPackageJson(obj: any): obj is PackageJson {
return obj && typeof obj.name === 'string';
}
-
-export function isRedrawLine(obj: any): obj is RedrawLine {
- return obj && typeof obj.redrawLine === 'function';
-}
diff --git a/packages/@ionic/cli-framework/src/lib/__tests__/prompts.ts b/packages/@ionic/cli-framework/src/lib/__tests__/prompts.ts
index d9c6b132f9..1284b24d89 100644
--- a/packages/@ionic/cli-framework/src/lib/__tests__/prompts.ts
+++ b/packages/@ionic/cli-framework/src/lib/__tests__/prompts.ts
@@ -185,61 +185,12 @@ describe('@ionic/cli-framework', () => {
expect(onFallbackSpy).toHaveBeenCalledWith(question);
});
- describe('open', () => {
+ describe('_inquirer', () => {
- it('should call mute', async () => {
+ it('should get _inquirer module from prompt module', async () => {
const prompts = setupPromptMocks({ tty: true });
const prompt = await prompts.createPromptModule();
- prompt.open();
- expect(mockMute).toHaveBeenCalledTimes(1);
- });
-
- it('should call mute once if opened multiple times', async () => {
- const prompts = setupPromptMocks({ tty: true });
- const prompt = await prompts.createPromptModule();
- prompt.open();
- prompt.open();
- prompt.open();
- expect(mockMute).toHaveBeenCalledTimes(1);
- });
-
- });
-
- describe('close', () => {
-
- it('should not close bottomBar if not opened', async () => {
- const prompts = setupPromptMocks({ tty: true });
- const prompt = await prompts.createPromptModule();
- prompt.close();
- expect(mockClose).not.toHaveBeenCalled();
- });
-
- it('should close bottomBar if opened', async () => {
- const prompts = setupPromptMocks({ tty: true });
- const prompt = await prompts.createPromptModule();
- prompt.open();
- prompt.close();
- expect(mockClose).toHaveBeenCalledTimes(1);
- });
-
- it('should close bottomBar once if closed multiple times', async () => {
- const prompts = setupPromptMocks({ tty: true });
- const prompt = await prompts.createPromptModule();
- prompt.open();
- prompt.close();
- prompt.close();
- expect(mockClose).toHaveBeenCalledTimes(1);
- });
-
- });
-
- describe('output', () => {
-
- it('should get output stream from prompt module', async () => {
- const prompts = setupPromptMocks({ tty: true });
- const prompt = await prompts.createPromptModule();
- expect(prompt.output).toBeDefined();
- expect(prompt.output.stream).toBe(mockLogStream);
+ expect(prompt._inquirer).toBeDefined();
});
});
diff --git a/packages/@ionic/cli-framework/src/lib/index.ts b/packages/@ionic/cli-framework/src/lib/index.ts
index cc25de17b9..2dd4533033 100644
--- a/packages/@ionic/cli-framework/src/lib/index.ts
+++ b/packages/@ionic/cli-framework/src/lib/index.ts
@@ -6,6 +6,7 @@ export * from './executor';
export * from './help';
export * from './logger';
export * from './options';
+export * from './output';
export * from './prompts';
export * from './tasks';
export * from './validators';
diff --git a/packages/@ionic/cli-framework/src/lib/output.ts b/packages/@ionic/cli-framework/src/lib/output.ts
new file mode 100644
index 0000000000..2e4346dff8
--- /dev/null
+++ b/packages/@ionic/cli-framework/src/lib/output.ts
@@ -0,0 +1,152 @@
+import * as Debug from 'debug';
+import * as ζinquirer from 'inquirer';
+
+import { Colors, DEFAULT_COLORS } from './colors';
+import { ICON_FAILURE, ICON_SUCCESS, Spinner, TaskChain } from './tasks';
+
+const debug = Debug('ionic:cli-framework:lib:output');
+
+export interface OutputStrategy {
+ readonly stream: NodeJS.WritableStream;
+ createTaskChain(): TaskChain;
+}
+
+export interface RedrawLine {
+ redrawLine(msg?: string): void;
+ open(): void;
+ close(): void;
+}
+
+export interface StreamOutputStrategyOptions {
+ readonly stream: NodeJS.WritableStream;
+ readonly colors?: Colors;
+}
+
+export class StreamOutputStrategy implements OutputStrategy {
+ readonly stream: NodeJS.WritableStream;
+
+ protected readonly colors: Colors;
+
+ constructor({ stream = process.stdout, colors = DEFAULT_COLORS }: StreamOutputStrategyOptions) {
+ this.stream = stream;
+ this.colors = colors;
+ }
+
+ createTaskChain(): TaskChain {
+ const { failure, success } = this.colors;
+ const chain = new TaskChain();
+
+ chain.on('next', task => {
+ task.on('success', () => {
+ this.stream.write(`${success(ICON_SUCCESS)} ${task.msg} - done!`);
+ });
+
+ task.on('failure', () => {
+ this.stream.write(`${failure(ICON_FAILURE)} ${task.msg} - failed!`);
+ });
+ });
+
+ return chain;
+ }
+}
+
+export interface BottomBarOutputStrategyOptions {
+ readonly BottomBar: typeof ζinquirer.ui.BottomBar;
+ readonly input?: NodeJS.ReadableStream;
+ readonly output?: NodeJS.WritableStream;
+ readonly colors?: Colors;
+}
+
+export class BottomBarOutputStrategy implements OutputStrategy, RedrawLine {
+ protected bottomBar?: ζinquirer.ui.BottomBar;
+
+ protected readonly BottomBar: typeof ζinquirer.ui.BottomBar;
+ protected readonly rawinput: NodeJS.ReadableStream;
+ protected readonly rawoutput: NodeJS.WritableStream;
+ protected readonly colors: Colors;
+
+ constructor({ BottomBar, input = process.stdin, output = process.stdout, colors = DEFAULT_COLORS }: BottomBarOutputStrategyOptions) {
+ this.BottomBar = BottomBar;
+ this.rawinput = input;
+ this.rawoutput = output;
+ this.colors = colors;
+ }
+
+ get stream(): NodeJS.WritableStream {
+ const bottomBar = this.get();
+ return bottomBar.log;
+ }
+
+ redrawLine(msg = ''): void {
+ const bottomBar = this.get();
+ bottomBar.updateBottomBar(msg);
+ }
+
+ get(): typeof ζinquirer.ui.BottomBar {
+ if (!this.bottomBar) {
+ this.bottomBar = new this.BottomBar({ input: this.rawinput, output: this.rawoutput } as any);
+
+ try {
+ // the mute() call appears to be necessary, otherwise when answering
+ // inquirer prompts upon pressing enter, a copy of the prompt is
+ // printed to the screen and looks gross
+ (this.bottomBar as any).rl.output.mute();
+ } catch (e) {
+ debug('Error while muting bottomBar output: %o', e);
+ }
+ }
+
+ return this.bottomBar;
+ }
+
+ open(): void {
+ this.get();
+ }
+
+ close(): void {
+ if (this.bottomBar) {
+ // instantiating inquirer.ui.BottomBar hangs, so when close() is called,
+ // close BottomBar streams
+ this.bottomBar.close();
+ this.bottomBar = undefined;
+ }
+ }
+
+ createTaskChain() {
+ const { failure, strong, success } = this.colors;
+ const chain = new TaskChain({ taskOptions: { tickInterval: 50 } });
+
+ this.open();
+
+ chain.on('next', task => {
+ this.open();
+
+ task.on('success', () => {
+ this.stream.write(`${success(ICON_SUCCESS)} ${task.msg} - done!`);
+ });
+
+ task.on('failure', () => {
+ this.stream.write(`${failure(ICON_FAILURE)} ${task.msg} - failed!`);
+ });
+
+ const spinner = new Spinner();
+
+ task.on('tick', () => {
+ const progress = task.progressRatio ? (task.progressRatio * 100).toFixed(2) : '';
+ const frame = spinner.frame();
+
+ this.redrawLine(`${strong(frame)} ${task.msg}${progress ? ' (' + strong(String(progress) + '%') + ')' : ''} `);
+ });
+
+ task.on('clear', () => {
+ this.redrawLine('');
+ });
+ });
+
+ chain.on('end', () => {
+ this.close();
+ });
+
+ return chain;
+ }
+}
diff --git a/packages/@ionic/cli-framework/src/lib/prompts.ts b/packages/@ionic/cli-framework/src/lib/prompts.ts
index de11479367..cf9362f6cc 100644
--- a/packages/@ionic/cli-framework/src/lib/prompts.ts
+++ b/packages/@ionic/cli-framework/src/lib/prompts.ts
@@ -1,7 +1,6 @@
import * as Debug from 'debug';
import * as ζinquirer from 'inquirer';
-import { OutputStrategy, RedrawLine } from '../definitions';
import { TERMINAL_INFO } from '../utils/terminal';
const debug = Debug('ionic:cli-framework:lib:prompts');
@@ -66,14 +65,11 @@ export interface PromptQuestionOther extends PromptQuestionBase {
export type PromptQuestion = PromptQuestionConfirm | PromptQuestionCheckbox | PromptQuestionOther;
export interface PromptModule {
- readonly output: OutputStrategy & RedrawLine;
+ readonly _inquirer: ζinquirer.Inquirer;
(question: PromptQuestionConfirm): Promise;
(question: PromptQuestionCheckbox): Promise;
(question: PromptQuestionOther): Promise;
-
- open(): void;
- close(): void;
}
async function loadInquirer(): Promise<ζinquirer.Inquirer> {
@@ -109,9 +105,9 @@ export interface CreatePromptModuleOptions {
* a 'fallback'.
*/
export async function createPromptModule({ interactive, onFallback }: CreatePromptModuleOptions = {}): Promise {
- const { createPromptModule: createInquirerPromptModule, ui: { BottomBar } } = await loadInquirer();
+ const inquirer = await loadInquirer();
+ const { createPromptModule: createInquirerPromptModule } = inquirer;
const promptModule = createInquirerPromptModule();
- const manager = new BottomBarManager({ BottomBar });
async function createPrompter(question: PromptQuestionConfirm): Promise;
async function createPrompter(question: PromptQuestionCheckbox): Promise;
@@ -161,12 +157,10 @@ export async function createPromptModule({ interactive, onFallback }: CreateProm
}
Object.defineProperties(createPrompter, {
- open: { value: () => manager.open() },
- close: { value: () => manager.close() },
- output: { value: manager },
+ _inquirer: { value: inquirer },
});
- return createPrompter as any;
+ return createPrompter as any as PromptModule;
}
export function createPromptChoiceSeparator(): ζinquirer.objects.Separator {
@@ -176,63 +170,3 @@ export function createPromptChoiceSeparator(): ζinquirer.objects.Separator {
return new _inquirer.Separator();
}
-
-interface BottomBarManagerOptions {
- readonly BottomBar: typeof ζinquirer.ui.BottomBar;
- readonly input?: NodeJS.ReadableStream;
- readonly output?: NodeJS.WritableStream;
-}
-
-class BottomBarManager implements OutputStrategy, RedrawLine {
- protected bottomBar?: ζinquirer.ui.BottomBar;
-
- protected readonly BottomBar: typeof ζinquirer.ui.BottomBar;
- protected readonly rawinput: NodeJS.ReadableStream;
- protected readonly rawoutput: NodeJS.WritableStream;
-
- constructor({ BottomBar, input = process.stdin, output = process.stdout }: BottomBarManagerOptions) {
- this.BottomBar = BottomBar;
- this.rawinput = input;
- this.rawoutput = output;
- }
-
- get stream(): NodeJS.WritableStream {
- const bottomBar = this.get();
- return bottomBar.log;
- }
-
- redrawLine(msg = ''): void {
- const bottomBar = this.get();
- bottomBar.updateBottomBar(msg);
- }
-
- get(): typeof ζinquirer.ui.BottomBar {
- if (!this.bottomBar) {
- this.bottomBar = new this.BottomBar({ input: this.rawinput, output: this.rawoutput } as any);
-
- try {
- // the mute() call appears to be necessary, otherwise when answering
- // inquirer prompts upon pressing enter, a copy of the prompt is
- // printed to the screen and looks gross
- (this.bottomBar as any).rl.output.mute();
- } catch (e) {
- debug('Error while muting bottomBar output: %o', e);
- }
- }
-
- return this.bottomBar;
- }
-
- open(): void {
- this.get();
- }
-
- close(): void {
- if (this.bottomBar) {
- // instantiating inquirer.ui.BottomBar hangs, so when close() is called,
- // close BottomBar streams
- this.bottomBar.close();
- this.bottomBar = undefined;
- }
- }
-}
diff --git a/packages/@ionic/cli-framework/src/lib/tasks.ts b/packages/@ionic/cli-framework/src/lib/tasks.ts
index 68bcd0334b..b255a6c042 100644
--- a/packages/@ionic/cli-framework/src/lib/tasks.ts
+++ b/packages/@ionic/cli-framework/src/lib/tasks.ts
@@ -1,10 +1,5 @@
import { EventEmitter } from 'events';
-import { OutputStrategy } from '../definitions';
-import { isRedrawLine } from '../guards';
-
-import { Colors, DEFAULT_COLORS } from './colors';
-
const isWindows = process.platform === 'win32';
export const ICON_SUCCESS = isWindows ? '√' : '✔';
@@ -211,40 +206,3 @@ export class TaskChain extends EventEmitter {
return this;
}
}
-
-export interface CreateTaskChainOptions {
- readonly output: OutputStrategy;
- readonly colors?: Colors;
-}
-
-export function createTaskChainWithOutput({ output, colors = DEFAULT_COLORS }: CreateTaskChainOptions): TaskChain {
- const { failure, strong, success } = colors;
- const chain = new TaskChain({ taskOptions: { tickInterval: 50 } });
-
- chain.on('next', task => {
- task.on('success', () => {
- output.stream.write(`${success(ICON_SUCCESS)} ${task.msg} - done!`);
- });
-
- task.on('failure', () => {
- output.stream.write(`${failure(ICON_FAILURE)} ${task.msg} - failed!`);
- });
-
- if (isRedrawLine(output)) {
- const spinner = new Spinner();
-
- task.on('tick', () => {
- const progress = task.progressRatio ? (task.progressRatio * 100).toFixed(2) : '';
- const frame = spinner.frame();
-
- output.redrawLine(`${strong(frame)} ${task.msg}${progress ? ' (' + strong(String(progress) + '%') + ')' : ''} `);
- });
-
- task.on('clear', () => {
- output.redrawLine('');
- });
- }
- });
-
- return chain;
-}
diff --git a/packages/@ionic/cli-utils/CHANGELOG.md b/packages/@ionic/cli-utils/CHANGELOG.md
index 278cc7eb2c..ab025d2c7f 100644
--- a/packages/@ionic/cli-utils/CHANGELOG.md
+++ b/packages/@ionic/cli-utils/CHANGELOG.md
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [2.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@2.0.5...@ionic/cli-utils@2.0.6) (2018-08-09)
+
+
+### Bug Fixes
+
+* **serve:** fix unclosed connection issue again ([#3500](https://github.com/ionic-team/ionic-cli/issues/3500)) ([1f0ef3b](https://github.com/ionic-team/ionic-cli/commit/1f0ef3b))
+
+
+
+
## [2.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/cli-utils@2.0.4...@ionic/cli-utils@2.0.5) (2018-08-07)
diff --git a/packages/@ionic/cli-utils/package.json b/packages/@ionic/cli-utils/package.json
index c47b9b2dc2..1d06b69ca5 100644
--- a/packages/@ionic/cli-utils/package.json
+++ b/packages/@ionic/cli-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@ionic/cli-utils",
- "version": "2.0.5",
+ "version": "2.0.6",
"description": "Ionic CLI Utils",
"homepage": "https://ionicframework.com",
"author": "Ionic Team (https://ionicframework.com)",
@@ -46,7 +46,7 @@
},
"license": "MIT",
"dependencies": {
- "@ionic/cli-framework": "1.0.4",
+ "@ionic/cli-framework": "1.0.5",
"@ionic/discover": "1.0.3",
"chalk": "^2.3.0",
"debug": "^3.1.0",
diff --git a/packages/@ionic/cli-utils/src/definitions.ts b/packages/@ionic/cli-utils/src/definitions.ts
index 913e0c26e1..d473106509 100644
--- a/packages/@ionic/cli-utils/src/definitions.ts
+++ b/packages/@ionic/cli-utils/src/definitions.ts
@@ -641,16 +641,13 @@ export interface IonicEnvironment {
readonly ctx: IonicContext;
readonly session: ISession;
readonly shell: IShell;
- readonly tasks: ζframework.TaskChain;
- open(): void;
- close(): void;
getInfo(): Promise;
}
export interface IonicEnvironmentFlags {
- interactive: boolean;
- confirm: boolean;
+ readonly interactive: boolean;
+ readonly confirm: boolean;
}
export type DistTag = 'testing' | 'canary' | 'latest';
diff --git a/packages/@ionic/cli-utils/src/index.ts b/packages/@ionic/cli-utils/src/index.ts
index 656c9ab6e7..d2f7996f66 100644
--- a/packages/@ionic/cli-utils/src/index.ts
+++ b/packages/@ionic/cli-utils/src/index.ts
@@ -1,4 +1,4 @@
-import { LOGGER_LEVELS, createPromptModule, createTaskChainWithOutput } from '@ionic/cli-framework';
+import { LOGGER_LEVELS, createPromptModule } from '@ionic/cli-framework';
import { prettyPath } from '@ionic/cli-framework/utils/format';
import { findBaseDirectory, fsReadJsonFile } from '@ionic/cli-framework/utils/fs';
import { TERMINAL_INFO } from '@ionic/cli-framework/utils/terminal';
@@ -8,7 +8,7 @@ import * as path from 'path';
import { ERROR_VERSION_TOO_OLD } from './bootstrap';
import { PROJECT_FILE } from './constants';
-import { IProject, InfoItem, IonicContext, IonicEnvironment, ProjectType } from './definitions';
+import { IProject, InfoItem, IonicContext, IonicEnvironment, IonicEnvironmentFlags, ProjectType } from './definitions';
import { CONFIG_FILE, Config, DEFAULT_CONFIG_DIRECTORY, parseGlobalOptions } from './lib/config';
import { Environment } from './lib/environment';
import { Client } from './lib/http';
@@ -17,7 +17,7 @@ import { createOnFallback } from './lib/prompts';
import { ProSession } from './lib/session';
import { Shell, prependNodeModulesBinToPath } from './lib/shell';
import { PROXY_ENVIRONMENT_VARIABLES } from './lib/utils/http';
-import { Logger } from './lib/utils/logger';
+import { Logger, createDefaultLoggerHandlers } from './lib/utils/logger';
export * from './definitions';
export * from './constants';
@@ -72,22 +72,19 @@ export async function generateIonicEnvironment(ctx: IonicContext, pargv: string[
argv['interactive'] = false;
}
+ const flags = argv as any as IonicEnvironmentFlags; // TODO
+ debug('CLI global options: %o', flags);
+
const log = new Logger({
level: argv['quiet'] ? LOGGER_LEVELS.WARN : LOGGER_LEVELS.INFO,
- handlers: new Set(),
+ handlers: createDefaultLoggerHandlers(),
});
const prompt = await createPromptModule({
interactive: argv['interactive'],
- onFallback: createOnFallback({ confirm: argv['confirm'], interactive: argv['interactive'], log }),
+ onFallback: createOnFallback({ flags, log }),
});
- const tasks = createTaskChainWithOutput(
- argv['interactive']
- ? { output: prompt.output }
- : { output: { stream: log.createWriteStream(LOGGER_LEVELS.INFO, false) } }
- );
-
const projectDir = await findBaseDirectory(ctx.execPath, PROJECT_FILE);
const proxyVars = PROXY_ENVIRONMENT_VARIABLES.map((e): [string, string | undefined] => [e, env[e]]).filter(([, v]) => !!v);
@@ -119,17 +116,12 @@ export async function generateIonicEnvironment(ctx: IonicContext, pargv: string[
return info;
};
- const flags = argv as any; // TODO
- debug('CLI global options: %o', flags);
-
const shell = new Shell({ log }, { alterPath: p => projectDir ? prependNodeModulesBinToPath(projectDir, p) : p });
const client = new Client(config);
const session = new ProSession({ config, client });
- const deps = { client, config, ctx, log, prompt, session, shell, tasks };
+ const deps = { client, config, ctx, log, prompt, session, shell };
const ienv = new Environment({ flags, getInfo, ...deps });
- ienv.open();
-
if (env['IONIC_CLI_LOCAL_ERROR']) {
if (env['IONIC_CLI_LOCAL_ERROR'] === ERROR_VERSION_TOO_OLD) {
log.warn(`Detected locally installed Ionic CLI, but it's too old--using global CLI.`);
diff --git a/packages/@ionic/cli-utils/src/lib/command.ts b/packages/@ionic/cli-utils/src/lib/command.ts
index d426dd29d6..4aa5b4bb3c 100644
--- a/packages/@ionic/cli-utils/src/lib/command.ts
+++ b/packages/@ionic/cli-utils/src/lib/command.ts
@@ -1,11 +1,14 @@
+import { BaseCommand, BottomBarOutputStrategy, LOGGER_LEVELS, OutputStrategy, StreamHandler, StreamOutputStrategy, TaskChain, generateCommandPath, unparseArgs } from '@ionic/cli-framework';
import chalk from 'chalk';
-import { BaseCommand, generateCommandPath, unparseArgs } from '@ionic/cli-framework';
-
import { CommandInstanceInfo, CommandLineInputs, CommandLineOptions, CommandMetadata, CommandMetadataInput, CommandMetadataOption, ICommand, INamespace, IProject, IonicEnvironment } from '../definitions';
import { isCommandPreRun } from '../guards';
+import { createDefaultLoggerHandlers, createFormatter } from './utils/logger';
+
export abstract class Command extends BaseCommand implements ICommand {
+ protected readonly taskChains: TaskChain[] = [];
+
constructor(public namespace: INamespace) {
super(namespace);
}
@@ -18,6 +21,30 @@ export abstract class Command extends BaseCommand {
+ this.env.log.handlers = createDefaultLoggerHandlers();
+ });
+
+ return chain;
+ }
+
async execute(inputs: CommandLineInputs, options: CommandLineOptions, runinfo: CommandInstanceInfo): Promise {
if (isCommandPreRun(this)) {
await this.preRun(inputs, options, runinfo);
diff --git a/packages/@ionic/cli-utils/src/lib/environment.ts b/packages/@ionic/cli-utils/src/lib/environment.ts
index 485c1669ce..016545c59f 100644
--- a/packages/@ionic/cli-utils/src/lib/environment.ts
+++ b/packages/@ionic/cli-utils/src/lib/environment.ts
@@ -1,13 +1,7 @@
-import * as Debug from 'debug';
-
-import { PromptModule, StreamHandler, TaskChain } from '@ionic/cli-framework';
+import { PromptModule } from '@ionic/cli-framework';
import { IClient, IConfig, ILogger, ISession, IShell, InfoItem, IonicContext, IonicEnvironment, IonicEnvironmentFlags } from '../definitions';
-import { createDefaultLoggerHandlers, createFormatter } from './utils/logger';
-
-const debug = Debug('ionic:cli-utils:lib:environment');
-
export interface EnvironmentDeps {
readonly client: IClient;
readonly config: IConfig; // CLI global config (~/.ionic/config.json)
@@ -18,7 +12,6 @@ export interface EnvironmentDeps {
readonly prompt: PromptModule;
readonly session: ISession;
readonly shell: IShell;
- readonly tasks: TaskChain;
}
export class Environment implements IonicEnvironment {
@@ -30,10 +23,9 @@ export class Environment implements IonicEnvironment {
readonly prompt: PromptModule;
session: ISession;
readonly shell: IShell;
- readonly tasks: TaskChain;
readonly ctx: IonicContext;
- constructor({ client, config, flags, getInfo, log, ctx, prompt, session, shell, tasks }: EnvironmentDeps) {
+ constructor({ client, config, flags, getInfo, log, ctx, prompt, session, shell }: EnvironmentDeps) {
this.client = client;
this.config = config;
this.flags = flags;
@@ -43,28 +35,5 @@ export class Environment implements IonicEnvironment {
this.prompt = prompt;
this.session = session;
this.shell = shell;
- this.tasks = tasks;
- }
-
- open() {
- if (this.flags.interactive) {
- this.prompt.open();
- }
-
- const formatter = createFormatter();
- this.log.handlers = this.flags.interactive
- ? new Set([new StreamHandler({ stream: this.prompt.output.stream, formatter })])
- : createDefaultLoggerHandlers();
-
- debug('Environment open.');
- }
-
- close() {
- this.tasks.cleanup();
-
- this.prompt.close();
- this.log.handlers = createDefaultLoggerHandlers();
-
- debug('Environment closed.');
}
}
diff --git a/packages/@ionic/cli-utils/src/lib/integrations/capacitor/index.ts b/packages/@ionic/cli-utils/src/lib/integrations/capacitor/index.ts
index f0e0051e5d..ce5a82751a 100644
--- a/packages/@ionic/cli-utils/src/lib/integrations/capacitor/index.ts
+++ b/packages/@ionic/cli-utils/src/lib/integrations/capacitor/index.ts
@@ -11,19 +11,19 @@ export class Integration extends BaseIntegration {
await this.installCapacitorCore();
await this.installCapacitorCLI();
- await this.shell.run('capacitor', ['init', this.project.config.get('name'), 'io.ionic.starter'], { cwd: this.project.directory });
+ await this.e.shell.run('capacitor', ['init', this.e.project.config.get('name'), 'io.ionic.starter'], { cwd: this.e.project.directory });
await super.add(options);
}
async installCapacitorCore() {
- const [ manager, ...managerArgs ] = await pkgManagerArgs(this.config.get('npmClient'), { command: 'install', pkg: '@capacitor/core' });
- await this.shell.run(manager, managerArgs, { cwd: this.project.directory });
+ const [ manager, ...managerArgs ] = await pkgManagerArgs(this.e.config.get('npmClient'), { command: 'install', pkg: '@capacitor/core' });
+ await this.e.shell.run(manager, managerArgs, { cwd: this.e.project.directory });
}
async installCapacitorCLI() {
- const [ manager, ...managerArgs ] = await pkgManagerArgs(this.config.get('npmClient'), { command: 'install', pkg: '@capacitor/cli' });
- await this.shell.run(manager, managerArgs, { cwd: this.project.directory });
+ const [ manager, ...managerArgs ] = await pkgManagerArgs(this.e.config.get('npmClient'), { command: 'install', pkg: '@capacitor/cli' });
+ await this.e.shell.run(manager, managerArgs, { cwd: this.e.project.directory });
}
async getInfo(): Promise {
@@ -31,7 +31,7 @@ export class Integration extends BaseIntegration {
[ capacitorCorePkg, capacitorCorePkgPath ],
capacitorCLIVersion,
] = await Promise.all([
- this.project.getPackageJson('@capacitor/core'),
+ this.e.project.getPackageJson('@capacitor/core'),
this.getCapacitorCLIVersion(),
]);
@@ -44,6 +44,6 @@ export class Integration extends BaseIntegration {
}
async getCapacitorCLIVersion(): Promise {
- return this.shell.cmdinfo('capacitor', ['--version'], { cwd: this.project.directory });
+ return this.e.shell.cmdinfo('capacitor', ['--version'], { cwd: this.e.project.directory });
}
}
diff --git a/packages/@ionic/cli-utils/src/lib/integrations/cordova/index.ts b/packages/@ionic/cli-utils/src/lib/integrations/cordova/index.ts
index ff94f0300c..a8e422d249 100644
--- a/packages/@ionic/cli-utils/src/lib/integrations/cordova/index.ts
+++ b/packages/@ionic/cli-utils/src/lib/integrations/cordova/index.ts
@@ -57,7 +57,7 @@ export class Integration extends BaseIntegration {
async personalize({ name, packageId }: ProjectPersonalizationDetails) {
const { loadConfigXml } = await import('./config');
- const conf = await loadConfigXml({ project: this.project });
+ const conf = await loadConfigXml({ project: this.e.project });
conf.setName(name);
if (packageId) {
@@ -68,12 +68,12 @@ export class Integration extends BaseIntegration {
}
async getCordovaVersion(): Promise {
- return this.shell.cmdinfo('cordova', ['-v', '--no-telemetry']);
+ return this.e.shell.cmdinfo('cordova', ['-v', '--no-telemetry']);
}
async getCordovaPlatformVersions(): Promise {
try {
- const output = await this.shell.output('cordova', ['platform', 'ls', '--no-telemetry'], { showCommand: false });
+ const output = await this.e.shell.output('cordova', ['platform', 'ls', '--no-telemetry'], { showCommand: false });
const platforms = output
.replace('Installed platforms:', '')
.replace(/Available platforms[\s\S]+/, '')
@@ -93,14 +93,14 @@ export class Integration extends BaseIntegration {
}
async getXcodebuildVersion(): Promise {
- return this.shell.cmdinfo('xcodebuild', ['-version']);
+ return this.e.shell.cmdinfo('xcodebuild', ['-version']);
}
async getIOSDeployVersion(): Promise {
- return this.shell.cmdinfo('ios-deploy', ['--version']);
+ return this.e.shell.cmdinfo('ios-deploy', ['--version']);
}
async getIOSSimVersion(): Promise {
- return this.shell.cmdinfo('ios-sim', ['--version']);
+ return this.e.shell.cmdinfo('ios-sim', ['--version']);
}
}
diff --git a/packages/@ionic/cli-utils/src/lib/integrations/index.ts b/packages/@ionic/cli-utils/src/lib/integrations/index.ts
index d3baa2e652..d0410c9fb0 100644
--- a/packages/@ionic/cli-utils/src/lib/integrations/index.ts
+++ b/packages/@ionic/cli-utils/src/lib/integrations/index.ts
@@ -5,10 +5,9 @@ import chalk from 'chalk';
import * as Debug from 'debug';
import * as lodash from 'lodash';
-import { TaskChain } from '@ionic/cli-framework';
import { copyDirectory, fsMkdirp, fsStat, pathExists, readDir, removeDirectory } from '@ionic/cli-framework/utils/fs';
-import { IConfig, IIntegration, IIntegrationAddOptions, IProject, IShell, InfoItem, IntegrationName, ProjectPersonalizationDetails } from '../../definitions';
+import { IConfig, IIntegration, IIntegrationAddOptions, ILogger, IProject, IShell, InfoItem, IntegrationName, ProjectPersonalizationDetails } from '../../definitions';
import { IntegrationNotFoundException } from '../errors';
import * as ζcapacitor from './capacitor';
@@ -23,28 +22,18 @@ export interface IntegrationOptions {
}
export interface IntegrationDeps {
- config: IConfig;
- shell: IShell;
- project: IProject;
- tasks: TaskChain;
+ readonly config: IConfig;
+ readonly shell: IShell;
+ readonly project: IProject;
+ readonly log: ILogger;
}
export abstract class BaseIntegration implements IIntegration {
- protected readonly config: IConfig;
- protected readonly project: IProject;
- protected readonly shell: IShell;
- protected readonly tasks: TaskChain;
-
abstract readonly name: IntegrationName;
abstract readonly summary: string;
abstract readonly archiveUrl?: string;
- constructor({ config, project, shell, tasks }: IntegrationDeps) {
- this.config = config;
- this.project = project;
- this.shell = shell;
- this.tasks = tasks;
- }
+ constructor(protected readonly e: IntegrationDeps) {}
static async createFromName(deps: IntegrationDeps, name: 'capacitor'): Promise<ζcapacitor.Integration>;
static async createFromName(deps: IntegrationDeps, name: 'cordova'): Promise<ζcordova.Integration>;
@@ -88,7 +77,7 @@ export abstract class BaseIntegration implements IIntegration {
const { createRequest, download } = await import('../utils/http');
const { tar } = await import('../utils/archive');
- const task = this.tasks.next(`Downloading integration ${chalk.green(this.name)}`);
+ this.e.log.info(`Downloading integration ${chalk.green(this.name)}`);
const tmpdir = path.resolve(os.tmpdir(), `ionic-integration-${this.name}`);
// TODO: etag
@@ -100,9 +89,8 @@ export abstract class BaseIntegration implements IIntegration {
await fsMkdirp(tmpdir, 0o777);
const ws = tar.extract({ cwd: tmpdir });
- const { req } = await createRequest('GET', this.archiveUrl, this.config.getHTTPConfig());
- await download(req, ws, { progress: (loaded, total) => task.progress(loaded, total) });
- this.tasks.end();
+ const { req } = await createRequest('GET', this.archiveUrl, this.e.config.getHTTPConfig());
+ await download(req, ws, {});
const contents = await readDir(tmpdir);
const blacklist: string[] = [];
@@ -110,7 +98,7 @@ export abstract class BaseIntegration implements IIntegration {
debug(`Integration files downloaded to ${chalk.bold(tmpdir)} (files: ${contents.map(f => chalk.bold(f)).join(', ')})`);
for (const f of contents) {
- const projectf = path.resolve(this.project.directory, f);
+ const projectf = path.resolve(this.e.project.directory, f);
try {
const stats = await fsStat(projectf);
@@ -126,10 +114,10 @@ export abstract class BaseIntegration implements IIntegration {
}
}
- this.tasks.next(`Copying integrations files to project`);
+ this.e.log.info(`Copying integrations files to project`);
debug(`Blacklist: ${blacklist.map(f => chalk.bold(f)).join(', ')}`);
- await copyDirectory(tmpdir, this.project.directory, {
+ await copyDirectory(tmpdir, this.e.project.directory, {
filter: f => {
if (f === tmpdir) {
return true;
@@ -153,8 +141,6 @@ export abstract class BaseIntegration implements IIntegration {
},
});
- this.tasks.end();
-
await this.enable();
}
}
diff --git a/packages/@ionic/cli-utils/src/lib/project/index.ts b/packages/@ionic/cli-utils/src/lib/project/index.ts
index bc0d103405..087f8cda00 100644
--- a/packages/@ionic/cli-utils/src/lib/project/index.ts
+++ b/packages/@ionic/cli-utils/src/lib/project/index.ts
@@ -1,4 +1,4 @@
-import { BaseConfig, BaseConfigOptions, PromptModule, TaskChain } from '@ionic/cli-framework';
+import { BaseConfig, BaseConfigOptions, PromptModule } from '@ionic/cli-framework';
import { TTY_WIDTH, prettyPath, wordWrap } from '@ionic/cli-framework/utils/format';
import { ERROR_FILE_INVALID_JSON, fsWriteJsonFile } from '@ionic/cli-framework/utils/fs';
import { ERROR_INVALID_PACKAGE_JSON, compileNodeModulesPaths, readPackageJsonFile, resolve } from '@ionic/cli-framework/utils/node';
@@ -133,7 +133,6 @@ export interface ProjectDeps {
readonly prompt: PromptModule;
readonly session: ISession;
readonly shell: IShell;
- readonly tasks: TaskChain;
readonly ctx: IonicContext;
}
@@ -307,7 +306,7 @@ export abstract class Project implements IProject {
config: this.e.config,
project: this,
shell: this.e.shell,
- tasks: this.e.tasks,
+ log: this.e.log,
}, name);
}
diff --git a/packages/@ionic/cli-utils/src/lib/prompts.ts b/packages/@ionic/cli-utils/src/lib/prompts.ts
index ba56b097f7..a12b72f7a2 100644
--- a/packages/@ionic/cli-utils/src/lib/prompts.ts
+++ b/packages/@ionic/cli-utils/src/lib/prompts.ts
@@ -4,11 +4,12 @@ import { PromptQuestion, PromptValue } from '@ionic/cli-framework';
import { ILogger, IonicEnvironmentFlags } from '../definitions';
-export interface CreateOnFallbackOptions extends IonicEnvironmentFlags {
+export interface CreateOnFallbackOptions {
+ readonly flags: IonicEnvironmentFlags;
readonly log: ILogger;
}
-export function createOnFallback({ confirm, interactive, log }: CreateOnFallbackOptions) {
+export function createOnFallback({ flags: { confirm }, log }: CreateOnFallbackOptions) {
return (question: PromptQuestion): PromptValue | void => {
if (question.type === 'confirm') {
if (confirm) {
diff --git a/packages/@ionic/cli-utils/src/lib/serve.ts b/packages/@ionic/cli-utils/src/lib/serve.ts
index 586391e59a..a5d538888e 100644
--- a/packages/@ionic/cli-utils/src/lib/serve.ts
+++ b/packages/@ionic/cli-utils/src/lib/serve.ts
@@ -530,7 +530,10 @@ export abstract class ServeCLI extends EventEmitter {
p.on('error', errorHandler);
p.on('close', closeHandler);
- onBeforeExit(async () => killProcessTree(p.pid));
+ onBeforeExit(async () => {
+ p.removeListener('close', closeHandler);
+ await killProcessTree(p.pid);
+ });
const ws = this.createLoggerStream();
diff --git a/packages/@ionic/lab/CHANGELOG.md b/packages/@ionic/lab/CHANGELOG.md
index a87018817e..5ec3d1c3a8 100644
--- a/packages/@ionic/lab/CHANGELOG.md
+++ b/packages/@ionic/lab/CHANGELOG.md
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [1.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/lab@1.0.5...@ionic/lab@1.0.6) (2018-08-09)
+
+
+
+
+**Note:** Version bump only for package @ionic/lab
+
## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/lab@1.0.4...@ionic/lab@1.0.5) (2018-08-07)
diff --git a/packages/@ionic/lab/package.json b/packages/@ionic/lab/package.json
index b0b5dc601a..4a1b812834 100644
--- a/packages/@ionic/lab/package.json
+++ b/packages/@ionic/lab/package.json
@@ -1,6 +1,6 @@
{
"name": "@ionic/lab",
- "version": "1.0.5",
+ "version": "1.0.6",
"description": "Ionic Lab utility for developing Ionic apps, used by Ionic CLI",
"bin": {
"ionic-lab": "./bin/ionic-lab"
@@ -47,7 +47,7 @@
]
},
"dependencies": {
- "@ionic/cli-framework": "1.0.4",
+ "@ionic/cli-framework": "1.0.5",
"chalk": "^2.3.0",
"express": "^4.16.2",
"tslib": "^1.9.0"
diff --git a/packages/@ionic/ng-toolkit/CHANGELOG.md b/packages/@ionic/ng-toolkit/CHANGELOG.md
index 9c40373b32..5810d93b13 100644
--- a/packages/@ionic/ng-toolkit/CHANGELOG.md
+++ b/packages/@ionic/ng-toolkit/CHANGELOG.md
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [1.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/ng-toolkit@1.0.5...@ionic/ng-toolkit@1.0.6) (2018-08-09)
+
+
+
+
+**Note:** Version bump only for package @ionic/ng-toolkit
+
## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/ng-toolkit@1.0.4...@ionic/ng-toolkit@1.0.5) (2018-08-07)
diff --git a/packages/@ionic/ng-toolkit/package.json b/packages/@ionic/ng-toolkit/package.json
index 29ac9ba26a..f31b952a3d 100644
--- a/packages/@ionic/ng-toolkit/package.json
+++ b/packages/@ionic/ng-toolkit/package.json
@@ -1,6 +1,6 @@
{
"name": "@ionic/ng-toolkit",
- "version": "1.0.5",
+ "version": "1.0.6",
"description": "Utilities for ionic/angular v4+ apps, used by Ionic CLI",
"bin": {
"ionic-ng": "./bin/ionic-ng"
@@ -42,7 +42,7 @@
]
},
"dependencies": {
- "@ionic/cli-framework": "1.0.4",
+ "@ionic/cli-framework": "1.0.5",
"chalk": "^2.3.0",
"debug": "^3.1.0",
"rxjs": "^6.2.0",
diff --git a/packages/@ionic/v1-toolkit/CHANGELOG.md b/packages/@ionic/v1-toolkit/CHANGELOG.md
index d954801688..b80c3693a5 100644
--- a/packages/@ionic/v1-toolkit/CHANGELOG.md
+++ b/packages/@ionic/v1-toolkit/CHANGELOG.md
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [1.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/v1-toolkit@1.0.4...@ionic/v1-toolkit@1.0.5) (2018-08-09)
+
+
+### Bug Fixes
+
+* **serve:** use configured host for v1 serve ([211906a](https://github.com/ionic-team/ionic-cli/commit/211906a))
+
+
+
+
## [1.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/v1-toolkit@1.0.3...@ionic/v1-toolkit@1.0.4) (2018-08-07)
diff --git a/packages/@ionic/v1-toolkit/package.json b/packages/@ionic/v1-toolkit/package.json
index 960dacec7c..b1790872aa 100644
--- a/packages/@ionic/v1-toolkit/package.json
+++ b/packages/@ionic/v1-toolkit/package.json
@@ -1,6 +1,6 @@
{
"name": "@ionic/v1-toolkit",
- "version": "1.0.4",
+ "version": "1.0.5",
"description": "Utility CLI for Ionic 1.x apps, used by Ionic CLI",
"bin": {
"ionic-v1": "./bin/ionic-v1"
@@ -42,7 +42,7 @@
]
},
"dependencies": {
- "@ionic/cli-framework": "1.0.4",
+ "@ionic/cli-framework": "1.0.5",
"chalk": "^2.3.0",
"chokidar": "^2.0.0",
"debug": "^3.1.0",
diff --git a/packages/@ionic/v1-toolkit/src/lib/dev-server.ts b/packages/@ionic/v1-toolkit/src/lib/dev-server.ts
index d066702b8a..0300a674eb 100644
--- a/packages/@ionic/v1-toolkit/src/lib/dev-server.ts
+++ b/packages/@ionic/v1-toolkit/src/lib/dev-server.ts
@@ -85,10 +85,10 @@ function getDevServerScript() {
`;
}
-export async function createLiveReloadServer({ port, wwwDir }: { port: number; wwwDir: string; }): Promise {
+export async function createLiveReloadServer({ host, port, wwwDir }: { host: string, port: number; wwwDir: string; }): Promise {
const tinylr = await import('tiny-lr');
const lrserver = tinylr();
- lrserver.listen(port);
+ lrserver.listen(port, host);
return changedFiles => {
lrserver.changed({
@@ -128,10 +128,10 @@ function getLiveReloadScript(port: number) {
`;
}
-export async function createDevLoggerServer(port: number): Promise<ζws.Server> {
+export async function createDevLoggerServer(host: string, port: number): Promise<ζws.Server> {
const WebSocket = await import('ws');
- const wss = new WebSocket.Server({ port });
+ const wss = new WebSocket.Server({ host, port });
wss.on('connection', ws => {
ws.on('message', data => {
diff --git a/packages/@ionic/v1-toolkit/src/lib/serve.ts b/packages/@ionic/v1-toolkit/src/lib/serve.ts
index e96cd4811c..f7093ec724 100644
--- a/packages/@ionic/v1-toolkit/src/lib/serve.ts
+++ b/packages/@ionic/v1-toolkit/src/lib/serve.ts
@@ -63,7 +63,7 @@ export async function runServer(options: ServeOptions): Promise {
let reloadfn: LiveReloadFunction | undefined;
if (options.livereload) {
- reloadfn = await createLiveReloadServer({ port: options.livereloadPort, wwwDir: options.wwwDir });
+ reloadfn = await createLiveReloadServer({ host: options.host, port: options.livereloadPort, wwwDir: options.wwwDir });
}
await createHttpServer(options);
@@ -149,7 +149,7 @@ async function createHttpServer(options: ServeOptions): Promise<ζexpress.Applic
app.get(`/${DEV_SERVER_PREFIX}/dev-server.js`, await createDevServerHandler(options));
- const wss = await createDevLoggerServer(options.devPort);
+ const wss = await createDevLoggerServer(options.host, options.devPort);
return new Promise<ζexpress.Application>((resolve, reject) => {
const httpserv = app.listen(options.port, options.host);
diff --git a/packages/cli-scripts/CHANGELOG.md b/packages/cli-scripts/CHANGELOG.md
index b3eb311a9c..8a14bce01b 100644
--- a/packages/cli-scripts/CHANGELOG.md
+++ b/packages/cli-scripts/CHANGELOG.md
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [0.0.15](https://github.com/ionic-team/ionic-cli/compare/cli-scripts@0.0.14...cli-scripts@0.0.15) (2018-08-09)
+
+
+### Bug Fixes
+
+* **serve:** fix unclosed connection issue again ([#3500](https://github.com/ionic-team/ionic-cli/issues/3500)) ([1f0ef3b](https://github.com/ionic-team/ionic-cli/commit/1f0ef3b))
+
+
+
+
## [0.0.14](https://github.com/ionic-team/ionic-cli/compare/cli-scripts@0.0.13...cli-scripts@0.0.14) (2018-08-07)
diff --git a/packages/cli-scripts/package.json b/packages/cli-scripts/package.json
index cf1743e765..9a6ab1a93b 100644
--- a/packages/cli-scripts/package.json
+++ b/packages/cli-scripts/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "cli-scripts",
- "version": "0.0.14",
+ "version": "0.0.15",
"bin": {
"ionic-cli-scripts": "./bin/ionic-cli-scripts"
},
@@ -25,12 +25,12 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"dependencies": {
- "@ionic/cli-framework": "1.0.4",
- "@ionic/cli-utils": "2.0.5",
+ "@ionic/cli-framework": "1.0.5",
+ "@ionic/cli-utils": "2.0.6",
"ansi-styles": "^3.2.0",
"chalk": "^2.3.0",
"escape-string-regexp": "^1.0.5",
- "ionic": "4.0.5",
+ "ionic": "4.0.6",
"strip-ansi": "^4.0.0",
"tslib": "^1.9.0"
},
diff --git a/packages/cli-scripts/src/docs/index.ts b/packages/cli-scripts/src/docs/index.ts
index 72fd0c1aec..fab51b9be0 100644
--- a/packages/cli-scripts/src/docs/index.ts
+++ b/packages/cli-scripts/src/docs/index.ts
@@ -35,7 +35,6 @@ export class DocsCommand extends Command {
// TODO: possible to do this without a physical directory?
const ctx = { ...baseCtx, execPath: path.resolve(PROJECTS_DIRECTORY, projectType) };
const executor = await loadExecutor(ctx, [], {});
- const env = executor.namespace.env;
const location = await executor.namespace.locate([]);
const formatter = new NamespaceSchemaHelpFormatter({ location, namespace: executor.namespace });
@@ -47,8 +46,6 @@ export class DocsCommand extends Command {
projectJson.commands.sort((a, b) => strcmp(a.name, b.name));
await fsWriteFile(path.resolve(STAGING_DIRECTORY, `${projectType}.json`), JSON.stringify(projectJson, undefined, 2), { encoding: 'utf8' });
-
- env.close();
}
process.stdout.write(`${chalk.green('Done.')}\n`);
diff --git a/packages/ionic/CHANGELOG.md b/packages/ionic/CHANGELOG.md
index 8eb8c0df3f..fc0cf01123 100644
--- a/packages/ionic/CHANGELOG.md
+++ b/packages/ionic/CHANGELOG.md
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [4.0.6](https://github.com/ionic-team/ionic-cli/compare/ionic@4.0.5...ionic@4.0.6) (2018-08-09)
+
+
+### Bug Fixes
+
+* **serve:** fix unclosed connection issue again ([#3500](https://github.com/ionic-team/ionic-cli/issues/3500)) ([1f0ef3b](https://github.com/ionic-team/ionic-cli/commit/1f0ef3b))
+
+
+
+
## [4.0.5](https://github.com/ionic-team/ionic-cli/compare/ionic@4.0.4...ionic@4.0.5) (2018-08-07)
diff --git a/packages/ionic/package.json b/packages/ionic/package.json
index 8e60fdb1d9..c6ad5a9ee7 100644
--- a/packages/ionic/package.json
+++ b/packages/ionic/package.json
@@ -1,6 +1,6 @@
{
"name": "ionic",
- "version": "4.0.5",
+ "version": "4.0.6",
"description": "A tool for creating and developing Ionic Framework mobile apps.",
"homepage": "https://ionicframework.com",
"author": "Ionic Team (https://ionicframework.com) ",
@@ -53,8 +53,8 @@
},
"license": "MIT",
"dependencies": {
- "@ionic/cli-framework": "1.0.4",
- "@ionic/cli-utils": "2.0.5",
+ "@ionic/cli-framework": "1.0.5",
+ "@ionic/cli-utils": "2.0.6",
"chalk": "^2.3.0",
"debug": "^3.1.0",
"lodash": "^4.17.5",
diff --git a/packages/ionic/src/commands/capacitor/base.ts b/packages/ionic/src/commands/capacitor/base.ts
index 660f486298..6401c2f79e 100644
--- a/packages/ionic/src/commands/capacitor/base.ts
+++ b/packages/ionic/src/commands/capacitor/base.ts
@@ -29,11 +29,8 @@ export abstract class CapacitorCommand extends Command {
async runCapacitor(argList: string[]): Promise {
try {
- this.env.close();
await this._runCapacitor(argList);
- this.env.open();
} catch (e) {
- this.env.open();
if (e instanceof ShellCommandError && e.code === ERROR_SHELL_COMMAND_NOT_FOUND) {
const pkg = '@capacitor/cli';
const requiredMsg = `The Capacitor CLI is required for Capacitor projects.`;
diff --git a/packages/ionic/src/commands/cordova/base.ts b/packages/ionic/src/commands/cordova/base.ts
index 7d20c154d2..91926aadfb 100644
--- a/packages/ionic/src/commands/cordova/base.ts
+++ b/packages/ionic/src/commands/cordova/base.ts
@@ -96,9 +96,11 @@ export abstract class CordovaCommand extends Command {
const wwwExists = await pathExists(wwwPath); // TODO: hard-coded
if (!wwwExists) {
- this.env.tasks.next(`Creating ${chalk.bold(prettyPath(wwwPath))} directory for you`);
+ const tasks = this.createTaskChain();
+
+ tasks.next(`Creating ${chalk.bold(prettyPath(wwwPath))} directory for you`);
await fsMkdir(wwwPath, 0o777);
- this.env.tasks.end();
+ tasks.end();
}
}
diff --git a/packages/ionic/src/commands/cordova/platform.ts b/packages/ionic/src/commands/cordova/platform.ts
index 78b552e21b..413b25d11b 100644
--- a/packages/ionic/src/commands/cordova/platform.ts
+++ b/packages/ionic/src/commands/cordova/platform.ts
@@ -117,7 +117,5 @@ Like running ${chalk.green('cordova platform')} directly, but adds default Ionic
if (isLoggedIn && action === 'add' && options['resources'] && ['ios', 'android'].includes(platformName)) {
await runCommand(runinfo, ['cordova', 'resources', platformName, '--force']);
}
-
- this.env.tasks.end();
}
}
diff --git a/packages/ionic/src/commands/cordova/resources.ts b/packages/ionic/src/commands/cordova/resources.ts
index 5d4494d61f..499090c4a6 100644
--- a/packages/ionic/src/commands/cordova/resources.ts
+++ b/packages/ionic/src/commands/cordova/resources.ts
@@ -92,13 +92,14 @@ This command uses Ionic servers, so we require you to be logged into your free I
const [ platform ] = inputs;
const { force } = options;
+ const tasks = this.createTaskChain();
const conf = await loadConfigXml({ project: this.project });
// if no resource filters are passed as arguments assume to use all.
let resourceTypes = AVAILABLE_RESOURCE_TYPES.filter((type, index, array) => options[type]);
resourceTypes = resourceTypes.length ? resourceTypes : AVAILABLE_RESOURCE_TYPES;
- this.env.tasks.next(`Collecting resource configuration and source images`);
+ tasks.next(`Collecting resource configuration and source images`);
debug(`resourceJsonStructure=${Object.keys(RESOURCES).length}`);
// check that at least one platform has been installed
@@ -107,7 +108,7 @@ This command uses Ionic servers, so we require you to be logged into your free I
debug(`platforms=${platforms.map(e => chalk.bold(e)).join(', ')}`);
if (platform && !platforms.includes(platform)) {
- this.env.tasks.end();
+ tasks.end();
const confirm = await this.env.prompt({
message: `Platform ${chalk.green(platform)} not detected. Would you like to install it?`,
type: 'confirm',
@@ -127,7 +128,7 @@ This command uses Ionic servers, so we require you to be logged into your free I
const buildPlatforms = Object.keys(RESOURCES).filter(p => platforms.includes(p));
debug(`buildPlatforms=${buildPlatforms.map(v => chalk.bold(v)).join(', ')}`);
if (buildPlatforms.length === 0) {
- this.env.tasks.end();
+ tasks.end();
throw new FatalException(`No platforms detected. Please run: ${chalk.green('ionic cordova platform add')}`);
}
debug(`${chalk.cyan('getProjectPlatforms')} completed: ${buildPlatforms.map(v => chalk.bold(v)).join(', ')}`);
@@ -195,7 +196,7 @@ This command uses Ionic servers, so we require you to be logged into your free I
);
}
- this.env.tasks.next(`Filtering out image resources that do not need regeneration`);
+ tasks.next(`Filtering out image resources that do not need regeneration`);
const cachedSourceIds = srcImagesAvailable
.filter(img => img.imageId && img.cachedId && img.imageId === img.cachedId)
@@ -213,9 +214,9 @@ This command uses Ionic servers, so we require you to be logged into your free I
imgResources = imgResources.filter((img, i) => keepImgResources[i]);
if (imgResources.length === 0) {
- this.env.tasks.end();
+ tasks.end();
this.env.log.nl();
- this.env.log.ok(
+ this.env.log.info(
'No need to regenerate images.\n' +
'This could mean your generated images exist and do not need updating or your source files are unchanged.\n\n' +
`You can force image regeneration with the ${chalk.green('--force')} option.`
@@ -225,7 +226,7 @@ This command uses Ionic servers, so we require you to be logged into your free I
}
}
- const uploadTask = this.env.tasks.next(`Uploading source images to prepare for transformations`);
+ const uploadTask = tasks.next(`Uploading source images to prepare for transformations`);
let count = 0;
// Upload images to service to prepare for resource transformations
@@ -268,14 +269,14 @@ This command uses Ionic servers, so we require you to be logged into your free I
});
if (imgResources.length === 0) {
- this.env.tasks.end();
+ tasks.end();
this.env.log.nl();
- this.env.log.ok('No need to regenerate images--images too large for transformation.'); // TODO: improve messaging
+ this.env.log.info('No need to regenerate images--images too large for transformation.'); // TODO: improve messaging
throw new FatalException('', 0);
}
// Call the transform service and output images to appropriate destination
- const generateTask = this.env.tasks.next(`Generating platform resources`);
+ const generateTask = tasks.next(`Generating platform resources`);
count = 0;
const transforms = imgResources.map(async img => {
@@ -307,7 +308,7 @@ This command uses Ionic servers, so we require you to be logged into your free I
await cacheFileChecksum(img.path, img.imageId);
}));
- this.env.tasks.next(`Modifying config.xml to add new image resources`);
+ tasks.next(`Modifying config.xml to add new image resources`);
const imageResourcesForConfig = imgResources.reduce((rc, img) => {
if (!rc[img.platform]) {
rc[img.platform] = {
@@ -340,7 +341,7 @@ This command uses Ionic servers, so we require you to be logged into your free I
const platformList = Object.keys(imageResourcesForConfig) as KnownPlatform[];
await addResourcesToConfigXml(conf, platformList, imageResourcesForConfig);
- this.env.tasks.end();
+ tasks.end();
// All images that were not processed
if (imagesTooLargeForSource.length > 0) {
diff --git a/packages/ionic/src/commands/doctor/base.ts b/packages/ionic/src/commands/doctor/base.ts
index e33247db2e..2904516355 100644
--- a/packages/ionic/src/commands/doctor/base.ts
+++ b/packages/ionic/src/commands/doctor/base.ts
@@ -27,13 +27,14 @@ export abstract class DoctorCommand extends Command {
const registry = await this.getRegistry();
let count = 0;
+ const tasks = this.createTaskChain();
const isLoggedIn = this.env.session.isLoggedIn();
if (!isLoggedIn) {
this.env.log.warn(`For best results, please make sure you're logged in to Ionic.\nSome issues can't be detected without authentication. Run:\n\n ${chalk.green('ionic login')}`);
}
- const detectTask = this.env.tasks.next('Detecting issues');
+ const detectTask = tasks.next('Detecting issues');
const ailments = registry.ailments.filter(ailment => {
if (this.env.config.get(`doctor.issues.${ailment.id}.ignored` as any)) {
@@ -69,7 +70,7 @@ export abstract class DoctorCommand extends Command {
});
detectTask.msg = `Detecting issues: ${chalk.bold(`${ailments.length} / ${ailments.length}`)} complete`;
- this.env.tasks.end();
+ tasks.end();
return detectedAilments;
}
diff --git a/packages/ionic/src/commands/info.ts b/packages/ionic/src/commands/info.ts
index 9c9263819d..519694fa5f 100644
--- a/packages/ionic/src/commands/info.ts
+++ b/packages/ionic/src/commands/info.ts
@@ -7,6 +7,8 @@ import { strcmp } from '@ionic/cli-framework/utils/string';
import { CommandLineInputs, CommandLineOptions, CommandMetadata, InfoItem, InfoItemGroup } from '@ionic/cli-utils';
import { Command } from '@ionic/cli-utils/lib/command';
+const INFO_GROUPS: ReadonlyArray = ['ionic', 'capacitor', 'cordova', 'system', 'environment'];
+
export class InfoCommand extends Command {
async getMetadata(): Promise {
return {
@@ -32,11 +34,14 @@ This command is an easy way to share information about your setup. If applicable
if (json) {
process.stdout.write(JSON.stringify(await this.env.getInfo()));
} else {
- const task = this.env.tasks.next('Gathering environment info');
+ const tasks = this.createTaskChain();
+ tasks.next('Gathering environment info');
const results = await this.env.getInfo();
+ tasks.end();
- const groups: InfoItemGroup[] = ['ionic', 'capacitor', 'cordova', 'system', 'environment'];
- const groupedInfo: Map = new Map(groups.map((group): [typeof group, InfoItem[]] => [group, results.filter(item => item.group === group)]));
+ const groupedInfo: Map = new Map(
+ INFO_GROUPS.map((group): [typeof group, InfoItem[]] => [group, results.filter(item => item.group === group)])
+ );
const sortInfo = (a: InfoItem, b: InfoItem): number => {
if (a.key[0] === '@' && b.key[0] !== '@') {
@@ -58,8 +63,6 @@ This command is an easy way to share information about your setup. If applicable
const format = (details: [string, string][]) => columnar(details, { vsep: ':' });
- task.end();
-
if (!projectPath) {
this.env.log.warn('You are not in an Ionic project directory. Project context may be missing.');
}
diff --git a/packages/ionic/src/commands/link.ts b/packages/ionic/src/commands/link.ts
index 7002365999..885b1ded05 100644
--- a/packages/ionic/src/commands/link.ts
+++ b/packages/ionic/src/commands/link.ts
@@ -152,7 +152,8 @@ ${chalk.cyan('[2]')}: ${chalk.bold('https://ionicframework.com/support/request')
create = true;
proId = undefined;
} else if (result === CHOICE_LINK_EXISTING_APP) {
- this.env.tasks.next(`Looking up your apps`);
+ const tasks = this.createTaskChain();
+ tasks.next(`Looking up your apps`);
const apps: App[] = [];
const appClient = await this.getAppClient();
@@ -163,7 +164,7 @@ ${chalk.cyan('[2]')}: ${chalk.bold('https://ionicframework.com/support/request')
apps.push(...res.data);
}
- this.env.tasks.end();
+ tasks.end();
if (apps.length === 0) {
const confirm = await this.env.prompt({
@@ -225,12 +226,13 @@ ${chalk.cyan('[2]')}: ${chalk.bold('https://ionicframework.com/support/request')
}
async lookUpApp(proId: string): Promise {
- this.env.tasks.next(`Looking up app ${chalk.green(proId)}`);
+ const tasks = this.createTaskChain();
+ tasks.next(`Looking up app ${chalk.green(proId)}`);
const appClient = await this.getAppClient();
const app = await appClient.load(proId); // Make sure the user has access to the app
- this.env.tasks.end();
+ tasks.end();
return app;
}
@@ -484,7 +486,8 @@ ${chalk.cyan('[2]')}: ${chalk.bold('https://ionicframework.com/support/request')
const user = this.env.session.getUser();
const userClient = await this.getUserClient();
- const task = this.env.tasks.next('Looking up your GitHub repositories');
+ const tasks = this.createTaskChain();
+ const task = tasks.next('Looking up your GitHub repositories');
const paginator = userClient.paginateGithubRepositories(user.id);
const repos: GithubRepo[] = [];
@@ -497,7 +500,7 @@ ${chalk.cyan('[2]')}: ${chalk.bold('https://ionicframework.com/support/request')
task.msg = `Looking up your GitHub repositories: ${chalk.bold(String(repos.length))} found`;
}
} catch (e) {
- this.env.tasks.fail();
+ tasks.fail();
if (isSuperAgentError(e) && e.response.status === 401) {
await this.oAuthProcess(user.id);
@@ -507,7 +510,7 @@ ${chalk.cyan('[2]')}: ${chalk.bold('https://ionicframework.com/support/request')
throw e;
}
- this.env.tasks.end();
+ tasks.end();
const repoId = await this.env.prompt({
type: 'list',
@@ -560,7 +563,8 @@ ${chalk.cyan('[2]')}: ${chalk.bold('https://ionicframework.com/support/request')
const user = this.env.session.getUser();
const userClient = await this.getUserClient();
const paginator = userClient.paginateGithubBranches(user.id, repoId);
- const task = this.env.tasks.next('Looking for available branches');
+ const tasks = this.createTaskChain();
+ const task = tasks.next('Looking for available branches');
const availableBranches: GithubBranch[] = [];
try {
for (const r of paginator) {
@@ -570,10 +574,10 @@ ${chalk.cyan('[2]')}: ${chalk.bold('https://ionicframework.com/support/request')
task.msg = `Looking up the available branches on your GitHub repository: ${chalk.bold(String(availableBranches.length))} found`;
}
} catch (e) {
- this.env.tasks.fail();
+ tasks.fail();
throw e;
}
- this.env.tasks.end();
+ tasks.end();
const choices = availableBranches.map(branch => ({
name: branch.name,
diff --git a/packages/ionic/src/commands/monitoring/syncmaps.ts b/packages/ionic/src/commands/monitoring/syncmaps.ts
index fff60613b5..d363c9e0de 100644
--- a/packages/ionic/src/commands/monitoring/syncmaps.ts
+++ b/packages/ionic/src/commands/monitoring/syncmaps.ts
@@ -78,7 +78,8 @@ By default, ${chalk.green('ionic monitoring syncmaps')} will upload the sourcema
}
let count = 0;
- const syncTask = this.env.tasks.next('Syncing sourcemaps');
+ const tasks = this.createTaskChain();
+ const syncTask = tasks.next('Syncing sourcemaps');
const sourcemapFiles = (await readDir(sourcemapsDir)).filter(f => f.endsWith('.js.map'));
debug(`Found ${sourcemapFiles.length} sourcemap files: ${sourcemapFiles.map(f => chalk.bold(f)).join(', ')}`);
@@ -90,7 +91,7 @@ By default, ${chalk.green('ionic monitoring syncmaps')} will upload the sourcema
}));
syncTask.msg = `Syncing sourcemaps: ${chalk.bold(`${sourcemapFiles.length} / ${sourcemapFiles.length}`)}`;
- this.env.tasks.end();
+ tasks.end();
const details = columnar([
['Pro ID', chalk.bold(proId)],
@@ -128,7 +129,6 @@ By default, ${chalk.green('ionic monitoring syncmaps')} will upload the sourcema
if (e.response.status === 401) {
this.env.log.error('Try logging out and back in again.');
}
- this.env.tasks.fail();
} else {
throw e;
}
diff --git a/packages/ionic/src/commands/ssh/generate.ts b/packages/ionic/src/commands/ssh/generate.ts
index 18a43a81bf..977d2afcf2 100644
--- a/packages/ionic/src/commands/ssh/generate.ts
+++ b/packages/ionic/src/commands/ssh/generate.ts
@@ -95,10 +95,8 @@ export class SSHGenerateCommand extends SSHBaseCommand implements CommandPreRun
`You will be prompted to provide a ${chalk.bold('passphrase')}, which is used to protect your private key should you lose it. (If someone has your private key, they can impersonate you!) Passphrases are recommended, but not required.\n`
);
- this.env.close();
const shellOptions = { stdio: 'inherit', showCommand: false, showError: false };
await this.env.shell.run('ssh-keygen', ['-q', '-t', String(options['type']), '-b', String(bits), '-C', String(annotation), '-f', keyPath], shellOptions);
- this.env.open();
this.env.log.nl();
diff --git a/packages/ionic/src/commands/start.ts b/packages/ionic/src/commands/start.ts
index adcbc5cd82..47d8cd0d24 100644
--- a/packages/ionic/src/commands/start.ts
+++ b/packages/ionic/src/commands/start.ts
@@ -249,10 +249,11 @@ ${chalk.cyan('[1]')}: ${chalk.bold('https://ionicframework.com/docs/cli/starters
const { AppClient } = await import('@ionic/cli-utils/lib/app');
const token = this.env.session.getUserToken();
const appClient = new AppClient({ token, client: this.env.client });
- this.env.tasks.next(`Looking up app ${chalk.green(proId)}`);
+ const tasks = this.createTaskChain();
+ tasks.next(`Looking up app ${chalk.green(proId)}`);
const app = await appClient.load(proId);
// TODO: can ask to clone via repo_url
- this.env.tasks.end();
+ tasks.end();
this.env.log.info(`Using ${chalk.bold(app.name)} for ${chalk.green('name')} and ${chalk.bold(app.slug)} for ${chalk.green('--project-id')}.`);
inputs[0] = app.name;
options['project-id'] = app.slug;
@@ -388,7 +389,8 @@ ${chalk.cyan('[1]')}: ${chalk.bold('https://ionicframework.com/docs/cli/starters
this.env.log.info(`Existing git project found (${chalk.bold(gitTopLevel)}). Git operations are disabled.`);
}
- this.env.tasks.next(`Preparing directory ${chalk.green(prettyPath(projectDir))}`);
+ const tasks = this.createTaskChain();
+ tasks.next(`Preparing directory ${chalk.green(prettyPath(projectDir))}`);
if (this.canRemoveExisting) {
await removeDirectory(projectDir);
@@ -396,7 +398,7 @@ ${chalk.cyan('[1]')}: ${chalk.bold('https://ionicframework.com/docs/cli/starters
await fsMkdir(projectDir, 0o777);
- this.env.tasks.end();
+ tasks.end();
if (this.schema.cloned) {
await this.env.shell.run('git', ['clone', this.schema.url, projectDir, '--progress'], { stdio: 'inherit' });
@@ -549,8 +551,6 @@ ${chalk.cyan('[1]')}: ${chalk.bold('https://ionicframework.com/docs/cli/starters
this.canRemoveExisting = confirm;
}
-
- this.env.tasks.end();
}
async findStarterTemplate(template: string, type: string, tag: string): Promise {
@@ -565,12 +565,15 @@ ${chalk.cyan('[1]')}: ${chalk.bold('https://ionicframework.com/docs/cli/starters
};
}
- this.env.tasks.next('Looking up starter');
+ const tasks = this.createTaskChain();
+ tasks.next('Looking up starter');
const starterList = await getStarterList(this.env.config, tag);
const starter = starterList.starters.find(t => t.type === type && t.name === template);
if (starter) {
+ tasks.end();
+
return {
...starter,
archive: `${STARTER_BASE_URL}/${tag === 'latest' ? '' : `${tag}/`}${starter.id}.tar.gz`,
@@ -629,14 +632,15 @@ ${chalk.cyan('[1]')}: ${chalk.bold('https://ionicframework.com/docs/cli/starters
const { createRequest, download } = await import('@ionic/cli-utils/lib/utils/http');
const { tar } = await import('@ionic/cli-utils/lib/utils/archive');
- const task = this.env.tasks.next(`Downloading and extracting ${chalk.green(starterTemplate.name.toString())} starter`);
+ const tasks = this.createTaskChain();
+ const task = tasks.next(`Downloading and extracting ${chalk.green(starterTemplate.name.toString())} starter`);
debug('Tar extraction created for %s', projectDir);
const ws = tar.extract({ cwd: projectDir });
const { req } = await createRequest('GET', starterTemplate.archive, this.env.config.getHTTPConfig());
await download(req, ws, { progress: (loaded, total) => task.progress(loaded, total) });
- this.env.tasks.end();
+ tasks.end();
}
async showNextSteps(projectDir: string, cloned: boolean, linkConfirmed: boolean) {
diff --git a/packages/ionic/src/index.ts b/packages/ionic/src/index.ts
index 4d263ba63e..79695f2b5a 100644
--- a/packages/ionic/src/index.ts
+++ b/packages/ionic/src/index.ts
@@ -133,7 +133,6 @@ export async function run(pargv: string[], env: NodeJS.ProcessEnv) {
}
if (err) {
- ienv.tasks.fail();
process.exitCode = 1;
if (err instanceof InputValidationError) {
@@ -170,8 +169,6 @@ export async function run(pargv: string[], env: NodeJS.ProcessEnv) {
}
}
}
-
- ienv.close();
}
export async function receive(msg: IPCMessage) {
diff --git a/types/tiny-lr.d.ts b/types/tiny-lr.d.ts
index 914d167581..b1333b9a80 100644
--- a/types/tiny-lr.d.ts
+++ b/types/tiny-lr.d.ts
@@ -4,7 +4,7 @@ declare module "tiny-lr" {
namespace TinyLR {}
interface TinyLRServer {
- listen(port: number, cb?: () => {}): void;
+ listen(port: number, host: string, cb?: () => {}): void;
close(): void;
changed(p: any): void;
}