Content-Length: 1425421 | pFad | http://github.com/NativeScript/nativescript-cli/commit/9985cca47e2e77945e064e4a1e24baeef018d481

4D Remove fibers · NativeScript/nativescript-cli@9985cca · GitHub
Skip to content

Commit 9985cca

Browse files
Dimitar KerezovTsvetanMilanov
Dimitar Kerezov
authored andcommitted
Remove fibers
This is a combination of 38 commits. Remove IFuture from function signatures - replace with async...Promise<T> Replace future wrapper in class-less functions Replace .wait with await Replace .wait with await vol 2 Replace .wait with await vol 3 Replace IFuture<T> with Promise<T> in .d.ts Replace Future.fromResult with async Mark IFuture functions without access modifiers as async Replace function..IFuture with async Promise ONE occurrence Mark execute functions as async...Promise<T> Mark lambdas as async Replace future.throw with reject Replace future.return with resolve Replace new Future with new Promise(resolve, reject) Revive lib/common Remove fibers from package.json Replace await return/await if with proper language Fix file in root of lib Fix lib/tools Fix lib/commands/plugin Fix lib/commands Fix files in lib/services up to test-execution-service.ts Fix all files in lib/providers Update package.json with required dependencies for testing. Fix tests from android-project-properties-manager to npm-support (inclusive) - all can be run successfully. Fix lib/device-sockets Fix test/platform-commands Fix services up until test-execution-service Fix test/platform-service Fix test/plugin-variables-service Fix test/lugins-service Fix test/project-commands Fix test/project-name-service Fix test/project-service test/project-templates-service Fix the rest of tests/ Fix error-reporting command Update dependencies, tsconfig and tslint rules Update dependencies required for transpilation. Update tsconfig with noUnusedLocals. Fix all files which have unused local variables in constructor. Update tslint rules. Add missing await in before/after prepare plugins Update ios-sim-portable to 2.0.0 Add missing await in doctor service
1 parent cc3580f commit 9985cca

File tree

117 files changed

+5276
-5797
lines changed

Some content is hidden

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

117 files changed

+5276
-5797
lines changed

Diff for: lib/android-tools-info.ts

+179-205
Large diffs are not rendered by default.

Diff for: lib/commands/add-platform.ts

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
export class AddPlatformCommand implements ICommand {
2+
public allowedParameters: ICommandParameter[] = [];
3+
24
constructor(private $platformService: IPlatformService,
35
private $errors: IErrors) { }
46

5-
execute(args: string[]): IFuture<void> {
6-
return (() => {
7-
this.$platformService.addPlatforms(args).wait();
8-
}).future<void>()();
7+
public async execute(args: string[]): Promise<void> {
8+
await this.$platformService.addPlatforms(args);
99
}
1010

11-
allowedParameters: ICommandParameter[] = [];
12-
13-
canExecute(args: string[]): IFuture<boolean> {
14-
return (() => {
15-
if(!args || args.length === 0) {
16-
this.$errors.fail("No platform specified. Please specify a platform to add");
17-
}
11+
public async canExecute(args: string[]): Promise<boolean> {
12+
if (!args || args.length === 0) {
13+
this.$errors.fail("No platform specified. Please specify a platform to add");
14+
}
1815

19-
_.each(args, arg => this.$platformService.validatePlatform(arg));
16+
_.each(args, arg => this.$platformService.validatePlatform(arg));
2017

21-
return true;
22-
}).future<boolean>()();
18+
return true;
2319
}
2420
}
21+
2522
$injector.registerCommand("platform|add", AddPlatformCommand);

Diff for: lib/commands/appstore-list.ts

+22-25
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
11
import { createTable } from "../common/helpers";
2-
import {StringCommandParameter} from "../common/command-params";
2+
import { StringCommandParameter } from "../common/command-params";
33

44
export class ListiOSApps implements ICommand {
5+
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
6+
57
constructor(private $injector: IInjector,
68
private $itmsTransporterService: IITMSTransporterService,
79
private $logger: ILogger,
8-
private $prompter: IPrompter,
9-
private $stringParameterBuilder: IStringParameterBuilder) { }
10-
11-
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
10+
private $prompter: IPrompter) { }
1211

13-
public execute(args: string[]): IFuture<void> {
14-
return (() => {
15-
let username = args[0],
16-
password = args[1];
12+
public async execute(args: string[]): Promise<void> {
13+
let username = args[0],
14+
password = args[1];
1715

18-
if(!username) {
19-
username = this.$prompter.getString("Apple ID", { allowEmpty: false }).wait();
20-
}
16+
if (!username) {
17+
username = await this.$prompter.getString("Apple ID", { allowEmpty: false });
18+
}
2119

22-
if(!password) {
23-
password = this.$prompter.getPassword("Apple ID password").wait();
24-
}
20+
if (!password) {
21+
password = await this.$prompter.getPassword("Apple ID password");
22+
}
2523

26-
let iOSApplications = this.$itmsTransporterService.getiOSApplications({username, password}).wait();
24+
let iOSApplications = await this.$itmsTransporterService.getiOSApplications({ username, password });
2725

28-
if (!iOSApplications || !iOSApplications.length) {
29-
this.$logger.out("Seems you don't have any applications yet.");
30-
} else {
31-
let table: any = createTable(["Application Name", "Bundle Identifier", "Version"], iOSApplications.map(element => {
32-
return [element.name, element.bundleId, element.version];
33-
}));
26+
if (!iOSApplications || !iOSApplications.length) {
27+
this.$logger.out("Seems you don't have any applications yet.");
28+
} else {
29+
let table: any = createTable(["Application Name", "Bundle Identifier", "Version"], iOSApplications.map(element => {
30+
return [element.name, element.bundleId, element.version];
31+
}));
3432

35-
this.$logger.out(table.toString());
36-
}
37-
}).future<void>()();
33+
this.$logger.out(table.toString());
34+
}
3835
}
3936
}
4037

Diff for: lib/commands/appstore-upload.ts

+73-78
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
import {StringCommandParameter} from "../common/command-params";
1+
import { StringCommandParameter } from "../common/command-params";
22
import * as path from "path";
3-
import {IOSProjectService} from "../services/ios-project-service";
3+
import { IOSProjectService } from "../services/ios-project-service";
44

55
export class PublishIOS implements ICommand {
6+
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector),
7+
new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
8+
69
constructor(private $errors: IErrors,
7-
private $fs: IFileSystem,
810
private $hostInfo: IHostInfo,
911
private $injector: IInjector,
1012
private $itmsTransporterService: IITMSTransporterService,
1113
private $logger: ILogger,
1214
private $options: IOptions,
1315
private $prompter: IPrompter,
14-
private $stringParameterBuilder: IStringParameterBuilder,
1516
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants) { }
1617

17-
public allowedParameters: ICommandParameter[] = [new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector),
18-
new StringCommandParameter(this.$injector), new StringCommandParameter(this.$injector)];
19-
2018
private get $platformsData(): IPlatformsData {
2119
return this.$injector.resolve("platformsData");
2220
}
@@ -27,81 +25,78 @@ export class PublishIOS implements ICommand {
2725
return this.$injector.resolve("platformService");
2826
}
2927

30-
public execute(args: string[]): IFuture<void> {
31-
return (() => {
32-
let username = args[0],
33-
password = args[1],
34-
mobileProvisionIdentifier = args[2],
35-
codeSignIdentity = args[3],
36-
teamID = this.$options.teamId,
37-
ipaFilePath = this.$options.ipa ? path.resolve(this.$options.ipa) : null;
38-
39-
if(!username) {
40-
username = this.$prompter.getString("Apple ID", { allowEmpty: false }).wait();
41-
}
42-
43-
if(!password) {
44-
password = this.$prompter.getPassword("Apple ID password").wait();
45-
}
46-
47-
if(!mobileProvisionIdentifier && !ipaFilePath) {
48-
this.$logger.warn("No mobile provision identifier set. A default mobile provision will be used. You can set one in app/App_Resources/iOS/build.xcconfig");
28+
public async execute(args: string[]): Promise<void> {
29+
let username = args[0],
30+
password = args[1],
31+
mobileProvisionIdentifier = args[2],
32+
codeSignIdentity = args[3],
33+
teamID = this.$options.teamId,
34+
ipaFilePath = this.$options.ipa ? path.resolve(this.$options.ipa) : null;
35+
36+
if (!username) {
37+
username = await this.$prompter.getString("Apple ID", { allowEmpty: false });
38+
}
39+
40+
if (!password) {
41+
password = await this.$prompter.getPassword("Apple ID password");
42+
}
43+
44+
if (!mobileProvisionIdentifier && !ipaFilePath) {
45+
this.$logger.warn("No mobile provision identifier set. A default mobile provision will be used. You can set one in app/App_Resources/iOS/build.xcconfig");
46+
}
47+
48+
if (!codeSignIdentity && !ipaFilePath) {
49+
this.$logger.warn("No code sign identity set. A default code sign identity will be used. You can set one in app/App_Resources/iOS/build.xcconfig");
50+
}
51+
52+
this.$options.release = true;
53+
54+
if (!ipaFilePath) {
55+
let platform = this.$devicePlatformsConstants.iOS;
56+
// No .ipa path provided, build .ipa on out own.
57+
if (mobileProvisionIdentifier || codeSignIdentity) {
58+
let iOSBuildConfig: IiOSBuildConfig = {
59+
buildForDevice: true,
60+
mobileProvisionIdentifier,
61+
codeSignIdentity
62+
};
63+
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
64+
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
65+
await this.$platformService.preparePlatform(platform);
66+
await this.$platformService.buildPlatform(platform, iOSBuildConfig);
67+
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice });
68+
} else {
69+
this.$logger.info("No .ipa, mobile provision or certificate set. Perfect! Now we'll build .xcarchive and let Xcode pick the distribution certificate and provisioning profile for you when exporting .ipa for AppStore submission.");
70+
await this.$platformService.preparePlatform(platform);
71+
72+
let platformData = this.$platformsData.getPlatformData(platform);
73+
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;
74+
75+
let archivePath = await iOSProjectService.archive(platformData.projectRoot);
76+
this.$logger.info("Archive at: " + archivePath);
77+
78+
let exportPath = await iOSProjectService.exportArchive({ archivePath, teamID });
79+
this.$logger.info("Export at: " + exportPath);
80+
81+
ipaFilePath = exportPath;
4982
}
50-
51-
if(!codeSignIdentity && !ipaFilePath) {
52-
this.$logger.warn("No code sign identity set. A default code sign identity will be used. You can set one in app/App_Resources/iOS/build.xcconfig");
53-
}
54-
55-
this.$options.release = true;
56-
57-
if (!ipaFilePath) {
58-
let platform = this.$devicePlatformsConstants.iOS;
59-
// No .ipa path provided, build .ipa on out own.
60-
if (mobileProvisionIdentifier || codeSignIdentity) {
61-
let iOSBuildConfig: IiOSBuildConfig = {
62-
buildForDevice: true,
63-
mobileProvisionIdentifier,
64-
codeSignIdentity
65-
};
66-
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
67-
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
68-
this.$platformService.preparePlatform(platform).wait();
69-
this.$platformService.buildPlatform(platform, iOSBuildConfig).wait();
70-
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice });
71-
} else {
72-
this.$logger.info("No .ipa, mobile provision or certificate set. Perfect! Now we'll build .xcarchive and let Xcode pick the distribution certificate and provisioning profile for you when exporting .ipa for AppStore submission.");
73-
this.$platformService.preparePlatform(platform).wait();
74-
75-
let platformData = this.$platformsData.getPlatformData(platform);
76-
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;
77-
78-
let archivePath = iOSProjectService.archive(platformData.projectRoot).wait();
79-
this.$logger.info("Archive at: " + archivePath);
80-
81-
let exportPath = iOSProjectService.exportArchive({ archivePath, teamID }).wait();
82-
this.$logger.info("Export at: " + exportPath);
83-
84-
ipaFilePath = exportPath;
85-
}
86-
}
87-
88-
this.$itmsTransporterService.upload({
89-
username,
90-
password,
91-
ipaFilePath,
92-
verboseLogging: this.$logger.getLevel() === "TRACE"
93-
}).wait();
94-
}).future<void>()();
83+
}
84+
85+
await this.$itmsTransporterService.upload({
86+
username,
87+
password,
88+
ipaFilePath,
89+
verboseLogging: this.$logger.getLevel() === "TRACE"
90+
});
9591
}
9692

97-
public canExecute(args: string[]): IFuture<boolean> {
98-
return (() => {
99-
if (!this.$hostInfo.isDarwin) {
100-
this.$errors.failWithoutHelp("This command is only available on Mac OS X.");
101-
}
93+
public async canExecute(args: string[]): Promise<boolean> {
94+
if (!this.$hostInfo.isDarwin) {
95+
this.$errors.failWithoutHelp("This command is only available on Mac OS X.");
96+
}
10297

103-
return true;
104-
}).future<boolean>()();
98+
return true;
10599
}
106100
}
101+
107102
$injector.registerCommand(["publish|ios", "appstore|upload"], PublishIOS);

Diff for: lib/commands/build.ts

+30-34
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,57 @@ export class BuildCommandBase {
33
protected $platformsData: IPlatformsData,
44
protected $platformService: IPlatformService) { }
55

6-
executeCore(args: string[]): IFuture<void> {
7-
return (() => {
8-
let platform = args[0].toLowerCase();
9-
this.$platformService.preparePlatform(platform).wait();
10-
this.$options.clean = true;
11-
this.$platformService.buildPlatform(platform).wait();
12-
if(this.$options.copyTo) {
13-
this.$platformService.copyLastOutput(platform, this.$options.copyTo, {isForDevice: this.$options.forDevice});
14-
}
15-
}).future<void>()();
6+
public async executeCore(args: string[]): Promise<void> {
7+
let platform = args[0].toLowerCase();
8+
await this.$platformService.preparePlatform(platform);
9+
this.$options.clean = true;
10+
await this.$platformService.buildPlatform(platform);
11+
if (this.$options.copyTo) {
12+
this.$platformService.copyLastOutput(platform, this.$options.copyTo, { isForDevice: this.$options.forDevice });
13+
}
1614
}
1715
}
1816

19-
export class BuildIosCommand extends BuildCommandBase implements ICommand {
17+
export class BuildIosCommand extends BuildCommandBase implements ICommand {
18+
public allowedParameters: ICommandParameter[] = [];
19+
2020
constructor(protected $options: IOptions,
21-
$platformsData: IPlatformsData,
22-
$platformService: IPlatformService) {
21+
$platformsData: IPlatformsData,
22+
$platformService: IPlatformService) {
2323
super($options, $platformsData, $platformService);
2424
}
2525

26-
public allowedParameters: ICommandParameter[] = [];
27-
28-
public execute(args: string[]): IFuture<void> {
26+
public async execute(args: string[]): Promise<void> {
2927
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
3028
}
3129

32-
public canExecute(args: string[]): IFuture<boolean> {
33-
return (() => {
34-
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS).wait();
35-
}).future<boolean>()();
30+
public canExecute(args: string[]): Promise<boolean> {
31+
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.iOS);
3632
}
3733
}
34+
3835
$injector.registerCommand("build|ios", BuildIosCommand);
3936

40-
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
37+
export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
38+
public allowedParameters: ICommandParameter[] = [];
39+
4140
constructor(protected $options: IOptions,
42-
$platformsData: IPlatformsData,
43-
private $errors: IErrors,
44-
$platformService: IPlatformService) {
41+
$platformsData: IPlatformsData,
42+
private $errors: IErrors,
43+
$platformService: IPlatformService) {
4544
super($options, $platformsData, $platformService);
4645
}
4746

48-
public execute(args: string[]): IFuture<void> {
47+
public async execute(args: string[]): Promise<void> {
4948
return this.executeCore([this.$platformsData.availablePlatforms.Android]);
5049
}
5150

52-
public allowedParameters: ICommandParameter[] = [];
53-
54-
public canExecute(args: string[]): IFuture<boolean> {
55-
return (() => {
56-
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
57-
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
58-
}
59-
return args.length === 0 && this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android).wait();
60-
}).future<boolean>()();
51+
public async canExecute(args: string[]): Promise<boolean> {
52+
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
53+
this.$errors.fail("When producing a release build, you need to specify all --key-store-* options.");
54+
}
55+
return args.length === 0 && await this.$platformService.validateOptions(this.$platformsData.availablePlatforms.Android);
6156
}
6257
}
58+
6359
$injector.registerCommand("build|android", BuildAndroidCommand);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/nativescript-cli/commit/9985cca47e2e77945e064e4a1e24baeef018d481

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy