Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
"chokidar-cli": "^2.0.0",
"husky": "^4.2.0",
"lerna": "^3.13.3",
"tslint": "^5.9.1",
"tslint-ionic-rules": "0.0.21",
"typescript": "~3.8.2"
"typescript": "~4.0.2"
},
"husky": {
"hooks": {
Expand Down
7 changes: 3 additions & 4 deletions packages/@ionic/cli-framework-output/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"scripts": {
"clean": "rimraf dist",
"lint": "tslint --project tsconfig.json",
"lint": "true",
"build": "npm run clean && tsc",
"watch": "tsc -w --preserveWatchOutput",
"test": "jest --maxWorkers=4",
Expand All @@ -30,7 +30,7 @@
"slice-ansi": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0",
"tslib": "1.11.2",
"tslib": "^2.0.1",
"wrap-ansi": "^7.0.0"
},
"devDependencies": {
Expand All @@ -46,7 +46,6 @@
"jest-cli": "^26.0.1",
"lint-staged": "^10.0.2",
"ts-jest": "~26.3.0",
"tslint": "^5.9.1",
"typescript": "~3.8.2"
"typescript": "~4.0.2"
}
}
3 changes: 0 additions & 3 deletions packages/@ionic/cli-framework-output/tslint.json

This file was deleted.

7 changes: 3 additions & 4 deletions packages/@ionic/cli-framework-prompts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"scripts": {
"clean": "rimraf dist",
"lint": "tslint --project tsconfig.json",
"lint": "true",
"build": "npm run clean && tsc",
"watch": "tsc -w --preserveWatchOutput",
"test": "jest --maxWorkers=4",
Expand All @@ -27,7 +27,7 @@
"@ionic/utils-terminal": "2.2.0",
"debug": "^4.0.0",
"inquirer": "^7.0.0",
"tslib": "1.11.2"
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/debug": "^4.1.1",
Expand All @@ -38,7 +38,6 @@
"jest-cli": "^26.0.1",
"lint-staged": "^10.0.2",
"ts-jest": "~26.3.0",
"tslint": "^5.9.1",
"typescript": "~3.8.2"
"typescript": "~4.0.2"
}
}
3 changes: 0 additions & 3 deletions packages/@ionic/cli-framework-prompts/tslint.json

This file was deleted.

7 changes: 3 additions & 4 deletions packages/@ionic/cli-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"scripts": {
"clean": "rimraf index.* definitions.* errors.* guards.* lib utils",
"lint": "tslint --project tsconfig.json",
"lint": "true",
"build": "npm run clean && tsc",
"watch": "tsc -w --preserveWatchOutput",
"test": "jest --maxWorkers=4",
Expand All @@ -32,7 +32,7 @@
"lodash": "^4.17.5",
"minimist": "^1.2.0",
"rimraf": "^3.0.0",
"tslib": "1.11.2",
"tslib": "^2.0.1",
"untildify": "^4.0.0",
"write-file-atomic": "^3.0.0"
},
Expand All @@ -47,7 +47,6 @@
"jest-cli": "^26.0.1",
"lint-staged": "^10.0.2",
"ts-jest": "~26.3.0",
"tslint": "^5.9.1",
"typescript": "~3.8.2"
"typescript": "~4.0.2"
}
}
2 changes: 0 additions & 2 deletions packages/@ionic/cli-framework/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export interface CommandMetadataOption extends Metadata {
};
}

export type HydratedCommandMetadataOption<O extends CommandMetadataOption> = Readonly<Required<O>>;

export { ParseArgsOptions };

export interface HydratedParseArgsOptions extends ParseArgsOptions {
Expand Down
15 changes: 10 additions & 5 deletions packages/@ionic/cli-framework/src/lib/options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as lodash from 'lodash';
import * as minimist from 'minimist';

import { CommandLineOptions, CommandMetadataOption, HydratedCommandMetadataOption, HydratedParseArgsOptions, ParsedArg } from '../definitions';
import { CommandLineOptions, CommandMetadataOption, HydratedParseArgsOptions, ParsedArg } from '../definitions';

import { Colors, DEFAULT_COLORS } from './colors';

Expand Down Expand Up @@ -56,12 +56,12 @@ export function separateArgv(pargv: readonly string[]): [string[], string[]] {
/**
* Takes a Minimist command option and normalizes its values.
*/
export function hydrateCommandMetadataOption<O extends CommandMetadataOption>(option: O): HydratedCommandMetadataOption<O> {
export function hydrateCommandMetadataOption<O extends CommandMetadataOption>(option: O): O {
const type = option.type ? option.type : String;

return lodash.assign({}, option, {
type,
default: typeof option.default !== 'undefined' ? option.default : null, // tslint:disable-line:no-null-keyword
default: typeof option.default !== 'undefined' ? option.default : null,
aliases: Array.isArray(option.aliases) ? option.aliases : [],
});
}
Expand Down Expand Up @@ -116,8 +116,13 @@ export function metadataOptionsToParseArgsOptions(commandOptions: readonly Comma
options.boolean.push(opt.name);
}

options.default[opt.name] = opt.default;
options.alias[opt.name] = opt.aliases;
if (typeof opt.default !== 'undefined') {
options.default[opt.name] = opt.default;
}

if (typeof opt.aliases !== 'undefined') {
options.alias[opt.name] = opt.aliases;
}
}

return options;
Expand Down
3 changes: 0 additions & 3 deletions packages/@ionic/cli-framework/tslint.json

This file was deleted.

7 changes: 3 additions & 4 deletions packages/@ionic/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"types": "./index.d.ts",
"scripts": {
"clean": "rimraf index.* bootstrap.* constants.* definitions.* guards.* lib commands",
"lint": "tslint --project tsconfig.json",
"lint": "true",
"build": "npm run clean && tsc",
"watch": "tsc -w --preserveWatchOutput",
"test": "jest --maxWorkers=4",
Expand Down Expand Up @@ -65,7 +65,7 @@
"superagent": "^5.2.1",
"superagent-proxy": "^2.0.0",
"tar": "^6.0.1",
"tslib": "1.11.2"
"tslib": "^2.0.1"
},
"devDependencies": {
"@types/debug": "^4.1.1",
Expand All @@ -87,7 +87,6 @@
"rimraf": "^3.0.0",
"source-map": "^0.7.0",
"ts-jest": "~26.3.0",
"tslint": "^5.9.1",
"typescript": "~3.8.2"
"typescript": "~4.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/@ionic/cli/src/commands/config/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export abstract class BaseConfigCommand extends Command {
try {
const serialized = JSON.stringify(v);

if (typeof serialized === 'undefined') { // tslint:disable-line:strict-type-predicates
if (typeof serialized === 'undefined') {
throw new FatalException(`Cannot serialize value: ${strong(v)}`);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@ionic/cli/src/commands/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ If you are having issues linking, please get in touch with our Support[^support-
name: strong('Nevermind'),
id: CHOICE_NEVERMIND,
value: CHOICE_NEVERMIND,
org: null, // tslint:disable-line
org: null,
};

const linkedApp = await this.env.prompt({
Expand Down
2 changes: 1 addition & 1 deletion packages/@ionic/cli/src/commands/ssh/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class SSHGenerateCommand extends SSHBaseCommand implements CommandPreRun
const pubkeyPath = `${keyPath}.pub`;

if (!(await pathExists(keyPathDir))) {
await mkdirp(keyPathDir, 0o700 as any); // tslint:disable-line
await mkdirp(keyPathDir, 0o700 as any);
this.env.log.msg(`Created ${strong(prettyPath(keyPathDir))} directory for you.`);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@ionic/cli/src/commands/ssl/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ The default directory for ${input('--key-path')} and ${input('--cert-path')} is

private async ensureDirectory(p: string) {
if (!(await pathExists(p))) {
await mkdirp(p, 0o700 as any); // tslint:disable-line
await mkdirp(p, 0o700 as any);
this.env.log.msg(`Created ${strong(prettyPath(p))} directory for you.`);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@ionic/cli/src/lib/integrations/capacitor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ export class Integration extends BaseIntegration<ProjectIntegration> {
const [
[ capacitorCorePkg, capacitorCorePkgPath ],
capacitorCLIVersion,
] = await (Promise.all([
] = await (Promise.all<[PackageJson | undefined, string | undefined], string | undefined>([
this.e.project.getPackageJson('@capacitor/core'),
this.getCapacitorCLIVersion(),
]) as Promise<[[PackageJson | undefined, string], string | undefined]>); // TODO: https://github.com/microsoft/TypeScript/issues/33752
]));

const info: InfoItem[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as fsSpy from '@ionic/utils-fs';
import * as fsExtraSpy from 'fs-extra';
import * as fsSafeSpy from '@ionic/utils-fs/dist/safe';
import * as project from '../project';

describe('@ionic/cli', () => {
Expand All @@ -8,21 +9,21 @@ describe('@ionic/cli', () => {
describe('getPlatforms', () => {

it('should filter out files and hidden files/folders', async () => {
const files = [['.DS_Store', false], ['.dir', true], ['android', true], ['ios', true], ['platforms.json', false]];
spyOn(fsSpy, 'readdirSafe').and.callFake(async () => files.map(([f]) => f));
spyOn(fsSpy, 'statSafe').and.callFake(async (p) => ({
const files: [string, boolean][] = [['.DS_Store', false], ['.dir', true], ['android', true], ['ios', true], ['platforms.json', false]];
jest.spyOn(fsSafeSpy, 'readdir').mockImplementation(async () => files.map(([f]) => f));
jest.spyOn(fsSafeSpy, 'stat').mockImplementation(async (p) => ({
isDirectory: () => {
const file = files.find(([f]) => p.endsWith(f));
return typeof file !== 'undefined' && file[1];
},
}));
} as any));

const platforms = await project.getPlatforms('/path/to/proj');
expect(platforms).toEqual(['android', 'ios']);
});

it('should not error if directory empty', async () => {
spyOn(fsSpy, 'readdirSafe').and.callFake(async () => []);
jest.spyOn(fsSafeSpy, 'readdir').mockImplementation(async () => []);
const platforms = await project.getPlatforms('/path/to/proj');
expect(platforms).toEqual([]);
});
Expand All @@ -32,14 +33,14 @@ describe('@ionic/cli', () => {
describe('getAndroidBuildOutputJson', () => {

it('should throw for fs error', () => {
spyOn(fsSpy, 'readJson').and.callFake(async () => { throw new Error('error') });
jest.spyOn(fsExtraSpy, 'readJson').mockImplementation(async () => { throw new Error('error') });

const p = project.getAndroidBuildOutputJson('/path/to/output.json');
expect(p).rejects.toThrowError('Could not parse build output file');
});

it('should throw for unrecognized format', () => {
spyOn(fsSpy, 'readJson').and.callFake(async () => ({ foo: 'bar' }));
jest.spyOn(fsExtraSpy, 'readJson').mockImplementation(async () => ({ foo: 'bar' }));

const p = project.getAndroidBuildOutputJson('/path/to/output.json');
expect(p).rejects.toThrowError('Could not parse build output file');
Expand All @@ -55,7 +56,7 @@ describe('@ionic/cli', () => {
},
];

spyOn(fsSpy, 'readJson').and.callFake(async () => file);
jest.spyOn(fsExtraSpy, 'readJson').mockImplementation(async () => file);

const p = project.getAndroidBuildOutputJson('/path/to/output.json');
expect(p).resolves.toEqual(file);
Expand All @@ -73,7 +74,7 @@ describe('@ionic/cli', () => {
],
};

spyOn(fsSpy, 'readJson').and.callFake(async () => file);
jest.spyOn(fsExtraSpy, 'readJson').mockImplementation(async () => file);

const p = project.getAndroidBuildOutputJson('/path/to/output.json');
expect(p).resolves.toEqual(file);
Expand All @@ -93,7 +94,7 @@ describe('@ionic/cli', () => {
},
];

spyOn(fsSpy, 'readJson').and.callFake(async () => file);
jest.spyOn(fsExtraSpy, 'readJson').mockImplementation(async () => file);

const p = project.getAndroidPackageFilePath('/path/to/proj', { release: false });
expect(p).resolves.toEqual('platforms/android/app/build/outputs/apk/debug/foo-debug.apk');
Expand All @@ -111,7 +112,7 @@ describe('@ionic/cli', () => {
],
};

spyOn(fsSpy, 'readJson').and.callFake(async () => file);
jest.spyOn(fsExtraSpy, 'readJson').mockImplementation(async () => file);

const p = project.getAndroidPackageFilePath('/path/to/proj', { release: false });
expect(p).resolves.toEqual('platforms/android/app/build/outputs/apk/debug/bar-debug.apk');
Expand Down
4 changes: 2 additions & 2 deletions packages/@ionic/cli/src/lib/integrations/cordova/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ export class Integration extends BaseIntegration<ProjectIntegration> {
iosDeploy,
iosSim,
androidSdkToolsVersion,
] = await (Promise.all([
] = await (Promise.all<string | undefined, string, string, string | undefined, string | undefined, string | undefined, string | undefined>([
this.getCordovaVersion(),
this.getCordovaPlatformVersions(),
this.getCordovaPluginVersions(),
this.getXcodebuildVersion(),
this.getIOSDeployVersion(),
this.getIOSSimVersion(),
getAndroidSdkToolsVersion(),
]) as Promise<[string | undefined, string, string, string | undefined, string | undefined, string | undefined, string | undefined]>); // TODO: https://github.com/microsoft/TypeScript/issues/33752
]));

const info: InfoItem[] = [
{ group: 'cordova', name: 'Cordova CLI', key: 'cordova_version', value: cordovaVersion || 'not installed' },
Expand Down
2 changes: 1 addition & 1 deletion packages/@ionic/cli/src/lib/native-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export async function runNativeRun({ config, log, shell }: RunNativeRunDeps, arg
// should also connect the Ionic CLI with the running `native-run` process.
// This will exit the Ionic CLI when `native-run` exits.
if (connect) {
processExit(0); // tslint:disable-line:no-floating-promises
processExit(0);
}
}

Expand Down
5 changes: 2 additions & 3 deletions packages/@ionic/cli/src/lib/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ export class ProjectDetails {
if (isProjectConfig(config)) {
const r = await this.determineSingleApp(config);
errors.push(...r.errors);
return { configPath, errors, ...r };
return { ...r, configPath, errors };
}

if (isMultiProjectConfig(config)) {
const r = await this.determineMultiApp(config);
errors.push(...r.errors);
return { configPath, errors, ...r };
return { ...r, configPath, errors };
}

throw new ProjectDetailsError('Unknown project file structure', 'ERR_INVALID_PROJECT_FILE');
Expand Down Expand Up @@ -596,7 +596,6 @@ export abstract class Project implements IProject {
}

// Empty to avoid sub-classes having to implement
// tslint:disable-next-line:no-empty
async setPrimaryTheme(_themeColor: string): Promise<void> { }

async writeThemeColor(variablesPath: string, themeColor: string): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions packages/@ionic/cli/src/lib/project/ionic1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export class Ionic1Project extends Project {
const [
ionic1Version,
[ v1ToolkitPkg ],
] = await (Promise.all([
] = await (Promise.all<string | undefined, [PackageJson | undefined, string | undefined]>([
this.getFrameworkVersion(),
this.getPackageJson('@ionic/v1-toolkit'),
]) as Promise<[string | undefined, [PackageJson | undefined, string]]>); // TODO: https://github.com/microsoft/TypeScript/issues/33752
]));

return [
...(await super.getInfo()),
Expand Down
4 changes: 2 additions & 2 deletions packages/@ionic/cli/src/lib/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export abstract class ServeCLI<T extends ServeCLIOptions> extends EventEmitter {
};

const closeHandler = (code: number | null) => {
if (code !== null) { // tslint:disable-line:no-null-keyword
if (code !== null) {
debug('received unexpected close for %s (code: %d)', this.resolvedProgram, code);

this.e.log.nl();
Expand All @@ -517,7 +517,7 @@ export abstract class ServeCLI<T extends ServeCLIOptions> extends EventEmitter {
'The Ionic CLI will exit. Please check any output above for error details.'
);

processExit(1); // tslint:disable-line:no-floating-promises
processExit(1);
}
};

Expand Down
Loading