Skip to content

Commit 9c41267

Browse files
Dimitar KerezovMitko-Kerezov
Dimitar Kerezov
authored andcommitted
Fix comments
1 parent 0b70f39 commit 9c41267

26 files changed

+137
-117
lines changed

lib/commands/add-platform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class AddPlatformCommand implements ICommand {
99
}
1010

1111
public async execute(args: string[]): Promise<void> {
12-
await this.$platformService.addPlatforms(args, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
12+
await this.$platformService.addPlatforms(args, this.$options.platformTemplate, this.$projectData, this.$options.provision, this.$options.frameworkPath);
1313
}
1414

1515
public async canExecute(args: string[]): Promise<boolean> {

lib/commands/appstore-upload.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export class PublishIOS implements ICommand {
1515
private $options: IOptions,
1616
private $prompter: IPrompter,
1717
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants) {
18-
this.$projectData.initializeProjectData();
19-
}
18+
this.$projectData.initializeProjectData();
19+
}
2020

2121
private get $platformsData(): IPlatformsData {
2222
return this.$injector.resolve("platformsData");
@@ -71,12 +71,12 @@ export class PublishIOS implements ICommand {
7171
};
7272
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
7373
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
74-
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
74+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options);
7575
await this.$platformService.buildPlatform(platform, iOSBuildConfig, this.$projectData);
7676
ipaFilePath = this.$platformService.lastOutputPath(platform, iOSBuildConfig, this.$projectData);
7777
} else {
7878
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.");
79-
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
79+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options);
8080

8181
let platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
8282
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;

lib/commands/build.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class BuildCommandBase {
99
public async executeCore(args: string[]): Promise<void> {
1010
let platform = args[0].toLowerCase();
1111
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
12-
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
12+
await this.$platformService.preparePlatform(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options);
1313
this.$options.clean = true;
1414
const buildConfig: IBuildConfig = {
1515
buildForDevice: this.$options.forDevice,

lib/commands/clean-app.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ export class CleanAppCommandBase {
22
constructor(protected $options: IOptions,
33
protected $projectData: IProjectData,
44
private $platformService: IPlatformService) {
5-
this.$projectData.initializeProjectData();
6-
}
5+
this.$projectData.initializeProjectData();
6+
}
77

88
public async execute(args: string[]): Promise<void> {
99
let platform = args[0].toLowerCase();
1010
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
11-
return this.$platformService.cleanDestinationApp(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
11+
return this.$platformService.cleanDestinationApp(platform, appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options);
1212
}
1313
}
1414

lib/commands/debug.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export abstract class DebugPlatformCommand implements ICommand {
4141

4242
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
4343

44-
await this.$platformService.deployPlatform(this.$devicesService.platform, appFilesUpdaterOptions, deployOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
44+
await this.$platformService.deployPlatform(this.$devicesService.platform, appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options);
4545
this.$config.debugLivesync = true;
4646
let applicationReloadAction = async (deviceAppData: Mobile.IDeviceAppData): Promise<void> => {
4747
let projectData: IProjectData = this.$injector.resolve("projectData");

lib/commands/deploy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class DeployOnDeviceCommand implements ICommand {
2727
keyStorePassword: this.$options.keyStorePassword,
2828
keyStorePath: this.$options.keyStorePath
2929
};
30-
return this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
30+
return this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options);
3131
}
3232

3333
public async canExecute(args: string[]): Promise<boolean> {

lib/commands/emulate.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ export class EmulateCommandBase {
33
private $projectData: IProjectData,
44
private $logger: ILogger,
55
private $platformService: IPlatformService) {
6-
this.$projectData.initializeProjectData();
7-
}
6+
this.$projectData.initializeProjectData();
7+
}
88

99
public async executeCore(args: string[]): Promise<void> {
1010
this.$logger.warn(`Emulate command is deprecated and will soon be removed. Please use "tns run <platform>" instead. All options available for "tns emulate" are present in "tns run" command. To run on all available emulators, use "tns run <platform> --emulator".`);
@@ -27,7 +27,7 @@ export class EmulateCommandBase {
2727
keyStorePassword: this.$options.keyStorePassword,
2828
keyStorePath: this.$options.keyStorePath
2929
};
30-
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
30+
return this.$platformService.emulatePlatform(args[0], appFilesUpdaterOptions, emulateOptions, this.$projectData, this.$options.provision);
3131
}
3232
}
3333

lib/commands/install.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class InstallCommand implements ICommand {
3131
const frameworkPackageData = this.$projectDataService.getNSValue(this.$projectData.projectDir, platformData.frameworkPackageName);
3232
if (frameworkPackageData && frameworkPackageData.version) {
3333
try {
34-
await this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`], this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
34+
await this.$platformService.addPlatforms([`${platform}@${frameworkPackageData.version}`], this.$options.platformTemplate, this.$projectData, this.$options, this.$options.frameworkPath);
3535
} catch (err) {
3636
error = `${error}${EOL}${err}`;
3737
}

lib/commands/platform-clean.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ export class CleanCommand implements ICommand {
55
private $projectData: IProjectData,
66
private $platformService: IPlatformService,
77
private $errors: IErrors) {
8-
this.$projectData.initializeProjectData();
9-
}
8+
this.$projectData.initializeProjectData();
9+
}
1010

1111
public async execute(args: string[]): Promise<void> {
12-
await this.$platformService.cleanPlatforms(args, this.$options.platformTemplate, this.$projectData, {provision: this.$options.provision, sdk: this.$options.sdk });
12+
await this.$platformService.cleanPlatforms(args, this.$options.platformTemplate, this.$projectData, this.$options);
1313
}
1414

1515
public async canExecute(args: string[]): Promise<boolean> {

lib/commands/prepare.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ export class PrepareCommand implements ICommand {
55
private $platformService: IPlatformService,
66
private $projectData: IProjectData,
77
private $platformCommandParameter: ICommandParameter) {
8-
this.$projectData.initializeProjectData();
9-
}
8+
this.$projectData.initializeProjectData();
9+
}
1010

1111
public async execute(args: string[]): Promise<void> {
1212
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = { bundle: this.$options.bundle, release: this.$options.release };
13-
await this.$platformService.preparePlatform(args[0], appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
13+
await this.$platformService.preparePlatform(args[0], appFilesUpdaterOptions, this.$options.platformTemplate, this.$projectData, this.$options);
1414
}
1515

1616
public async canExecute(args: string[]): Promise<boolean> {

lib/commands/run.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export class RunCommandBase {
44
protected $projectData: IProjectData,
55
protected $options: IOptions,
66
protected $emulatorPlatformService: IEmulatorPlatformService) {
7-
this.$projectData.initializeProjectData();
8-
}
7+
this.$projectData.initializeProjectData();
8+
}
99

1010
public async executeCore(args: string[]): Promise<void> {
1111

@@ -25,7 +25,7 @@ export class RunCommandBase {
2525
keyStorePath: this.$options.keyStorePath
2626
};
2727

28-
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
28+
await this.$platformService.deployPlatform(args[0], appFilesUpdaterOptions, deployOptions, this.$projectData, this.$options);
2929

3030
if (this.$options.bundle) {
3131
this.$options.watch = false;

lib/commands/update-platform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class UpdatePlatformCommand implements ICommand {
99
}
1010

1111
public async execute(args: string[]): Promise<void> {
12-
await this.$platformService.updatePlatforms(args, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk });
12+
await this.$platformService.updatePlatforms(args, this.$options.platformTemplate, this.$projectData, this.$options);
1313
}
1414

1515
public async canExecute(args: string[]): Promise<boolean> {

lib/commands/update.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export class UpdateCommand implements ICommand {
1212
private $projectDataService: IProjectDataService,
1313
private $fs: IFileSystem,
1414
private $logger: ILogger) {
15-
this.$projectData.initializeProjectData();
16-
}
15+
this.$projectData.initializeProjectData();
16+
}
1717

1818
public async execute(args: string[]): Promise<void> {
1919
let folders = ["lib", "hooks", "platforms", "node_modules"];
@@ -83,12 +83,12 @@ export class UpdateCommand implements ICommand {
8383
platforms = platforms.concat(packagePlatforms);
8484
if (args.length === 1) {
8585
for (let platform of platforms) {
86-
await this.$platformService.addPlatforms([platform + "@" + args[0]], this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
86+
await this.$platformService.addPlatforms([platform + "@" + args[0]], this.$options.platformTemplate, this.$projectData, this.$options, this.$options.frameworkPath);
8787
}
8888

8989
await this.$pluginsService.add("tns-core-modules@" + args[0], this.$projectData);
9090
} else {
91-
await this.$platformService.addPlatforms(platforms, this.$options.platformTemplate, this.$projectData, { provision: this.$options.provision, sdk: this.$options.sdk }, this.$options.frameworkPath);
91+
await this.$platformService.addPlatforms(platforms, this.$options.platformTemplate, this.$projectData, this.$options, this.$options.frameworkPath);
9292
await this.$pluginsService.add("tns-core-modules", this.$projectData);
9393
}
9494

lib/declarations.d.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,19 @@ interface IAndroidReleaseOptions {
295295
keyStorePath?: string;
296296
}
297297

298-
interface INpmInstallConfigurationOptions {
298+
interface INpmInstallConfigurationOptionsBase {
299299
frameworkPath: string;
300-
disableNpmInstall: boolean;
301300
ignoreScripts: boolean; //npm flag
302301
}
303302

303+
interface INpmInstallConfigurationOptions extends INpmInstallConfigurationOptionsBase {
304+
disableNpmInstall: boolean;
305+
}
306+
307+
interface ICreateProjectOptions extends INpmInstallConfigurationOptionsBase {
308+
pathToTemplate?: string;
309+
}
310+
304311
interface IOptions extends ICommonOptions, IBundle, IPlatformTemplate, IEmulator, IClean, IProvision, ITeamIdentifier, IAndroidReleaseOptions, INpmInstallConfigurationOptions {
305312
all: boolean;
306313
client: boolean;

lib/definitions/platform.d.ts

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interface IPlatformService extends NodeJS.EventEmitter {
2-
cleanPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, framework?: string): Promise<void>;
2+
cleanPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, config: IAddPlatformCoreOptions, framework?: string): Promise<void>;
33

4-
addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, frameworkPath?: string): Promise<void>;
4+
addPlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, config: IAddPlatformCoreOptions, frameworkPath?: string): Promise<void>;
55

66
/**
77
* Gets list of all installed platforms (the ones for which <project dir>/platforms/<platform> exists).
@@ -32,7 +32,7 @@ interface IPlatformService extends NodeJS.EventEmitter {
3232
*/
3333
removePlatforms(platforms: string[], projectData: IProjectData): Promise<void>;
3434

35-
updatePlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;
35+
updatePlatforms(platforms: string[], platformTemplate: string, projectData: IProjectData, config: IAddPlatformCoreOptions): Promise<void>;
3636

3737
/**
3838
* Ensures that the specified platform and its dependencies are installed.
@@ -43,11 +43,11 @@ interface IPlatformService extends NodeJS.EventEmitter {
4343
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
4444
* @param {string} platformTemplate The name of the platform template.
4545
* @param {IProjectData} projectData DTO with information about the project.
46-
* @param {IPlatformSpecificData} platformSpecificData Platform specific data required for project preparation.
46+
* @param {IAddPlatformCoreOptions} config Options required for project preparation/creation.
4747
* @param {Array} filesToSync Files about to be synced to device.
4848
* @returns {boolean} true indicates that the platform was prepared.
4949
*/
50-
preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData, filesToSync?: Array<String>): Promise<boolean>;
50+
preparePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, config: IAddPlatformCoreOptions, filesToSync?: Array<String>): Promise<boolean>;
5151

5252
/**
5353
* Determines whether a build is necessary. A build is necessary when one of the following is true:
@@ -106,10 +106,10 @@ interface IPlatformService extends NodeJS.EventEmitter {
106106
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
107107
* @param {IDeployPlatformOptions} deployOptions Various options that can manage the deploy operation.
108108
* @param {IProjectData} projectData DTO with information about the project.
109-
* @param {any} platformSpecificData Platform specific data required for project preparation.
109+
* @param {IAddPlatformCoreOptions} config Options required for project preparation/creation.
110110
* @returns {void}
111111
*/
112-
deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;
112+
deployPlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, deployOptions: IDeployPlatformOptions, projectData: IProjectData, config: IAddPlatformCoreOptions): Promise<void>;
113113

114114
/**
115115
* Runs the application on specified platform. Assumes that the application is already build and installed. Fails if this is not true.
@@ -126,12 +126,12 @@ interface IPlatformService extends NodeJS.EventEmitter {
126126
* @param {IAppFilesUpdaterOptions} appFilesUpdaterOptions Options needed to instantiate AppFilesUpdater class.
127127
* @param {IEmulatePlatformOptions} emulateOptions Various options that can manage the emulate operation.
128128
* @param {IProjectData} projectData DTO with information about the project.
129-
* @param {any} platformSpecificData Platform specific data required for project preparation.
129+
* @param {IAddPlatformCoreOptions} config Options required for project preparation/creation.
130130
* @returns {void}
131131
*/
132-
emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;
132+
emulatePlatform(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, emulateOptions: IEmulatePlatformOptions, projectData: IProjectData, config: IAddPlatformCoreOptions): Promise<void>;
133133

134-
cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;
134+
cleanDestinationApp(platform: string, appFilesUpdaterOptions: IAppFilesUpdaterOptions, platformTemplate: string, projectData: IProjectData, config: IAddPlatformCoreOptions): Promise<void>;
135135
validatePlatformInstalled(platform: string, projectData: IProjectData): void;
136136

137137
/**
@@ -201,6 +201,8 @@ interface IPlatformService extends NodeJS.EventEmitter {
201201
trackActionForPlatform(actionData: ITrackPlatformAction): Promise<void>;
202202
}
203203

204+
interface IAddPlatformCoreOptions extends IPlatformSpecificData, ICreateProjectOptions { }
205+
204206
/**
205207
* Platform specific data required for project preparation.
206208
*/

lib/definitions/project.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ interface IProjectData {
6969
* @param {string} projectDir Project root directory.
7070
* @returns {void}
7171
*/
72-
initializeProjectData(projectDir? :string): void;
72+
initializeProjectData(projectDir?: string): void;
7373
}
7474

7575
interface IProjectDataService {
@@ -158,7 +158,7 @@ interface IiOSBuildConfig extends IBuildForDevice, IDeviceIdentifier, IProvision
158158
interface IPlatformProjectService extends NodeJS.EventEmitter {
159159
getPlatformData(projectData: IProjectData): IPlatformData;
160160
validate(projectData: IProjectData): Promise<void>;
161-
createProject(frameworkDir: string, frameworkVersion: string, projectData: IProjectData, pathToTemplate?: string): Promise<void>;
161+
createProject(frameworkDir: string, frameworkVersion: string, projectData: IProjectData, config: ICreateProjectOptions): Promise<void>;
162162
interpolateData(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): Promise<void>;
163163
interpolateConfigurationFile(projectData: IProjectData, platformSpecificData: IPlatformSpecificData): void;
164164

lib/npm-installation-manager.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export class NpmInstallationManager implements INpmInstallationManager {
9090
version = version || await this.getLatestCompatibleVersion(packageName);
9191
}
9292

93-
let installedModuleNames = await this.npmInstall(packageName, pathToSave, version, dependencyType);
94-
let installedPackageName = installedModuleNames.name;
93+
let installResultInfo = await this.npmInstall(packageName, pathToSave, version, dependencyType);
94+
let installedPackageName = installResultInfo.name;
9595

9696
let pathToInstalledPackage = path.join(pathToSave, "node_modules", installedPackageName);
9797
return pathToInstalledPackage;

0 commit comments

Comments
 (0)