Skip to content

Commit 1e23be6

Browse files
Merge remote-tracking branch 'origin/release' into vladimirov/merge-rel-master
2 parents c0be28f + 6ab0cfe commit 1e23be6

File tree

7 files changed

+17
-23
lines changed

7 files changed

+17
-23
lines changed

lib/commands/debug.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export abstract class DebugPlatformCommand implements ICommand {
66
constructor(private debugService: IPlatformDebugService,
77
private $devicesService: Mobile.IDevicesService,
88
private $injector: IInjector,
9-
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
109
private $config: IConfiguration,
1110
private $usbLiveSyncService: ILiveSyncService,
1211
private $debugDataService: IDebugDataService,
@@ -49,11 +48,7 @@ export abstract class DebugPlatformCommand implements ICommand {
4948
await this.debugService.debugStop();
5049

5150
let applicationId = deviceAppData.appIdentifier;
52-
if (deviceAppData.device.isEmulator && deviceAppData.platform.toLowerCase() === this.$devicePlatformsConstants.iOS.toLowerCase()) {
53-
applicationId = projectData.projectName;
54-
}
55-
56-
await deviceAppData.device.applicationManager.stopApplication(applicationId);
51+
await deviceAppData.device.applicationManager.stopApplication(applicationId, projectData.projectName);
5752

5853
const buildConfig: IBuildConfig = _.merge({ buildForDevice: !deviceAppData.device.isEmulator }, deployOptions);
5954
debugData.pathToAppPackage = this.$platformService.lastOutputPath(this.debugService.platform, buildConfig, projectData);
@@ -102,7 +97,7 @@ export class DebugIOSCommand extends DebugPlatformCommand {
10297
$projectData: IProjectData,
10398
$platformsData: IPlatformsData,
10499
$iosDeviceOperations: IIOSDeviceOperations) {
105-
super($iOSDebugService, $devicesService, $injector, $devicePlatformsConstants, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
100+
super($iOSDebugService, $devicesService, $injector, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
106101
// Do not dispose ios-device-lib, so the process will remain alive and the debug application (NativeScript Inspector or Chrome DevTools) will be able to connect to the socket.
107102
// In case we dispose ios-device-lib, the socket will be closed and the code will fail when the debug application tries to read/send data to device socket.
108103
// That's why the `$ tns debug ios --justlaunch` command will not release the terminal.
@@ -136,7 +131,7 @@ export class DebugAndroidCommand extends DebugPlatformCommand {
136131
$options: IOptions,
137132
$projectData: IProjectData,
138133
$platformsData: IPlatformsData) {
139-
super($androidDebugService, $devicesService, $injector, $devicePlatformsConstants, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
134+
super($androidDebugService, $devicesService, $injector, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
140135
}
141136

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

lib/nativescript-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as shelljs from "shelljs";
33
shelljs.config.silent = true;
44
shelljs.config.fatal = true;
55
import { installUncaughtExceptionListener } from "./common/errors";
6-
installUncaughtExceptionListener(process.exit);
6+
installUncaughtExceptionListener(process.exit.bind(process, ErrorCodes.UNCAUGHT));
77

88
import { settlePromises } from "./common/helpers";
99

lib/npm-installation-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class NpmInstallationManager implements INpmInstallationManager {
108108

109109
packageName = packageName + (version ? `@${version}` : "");
110110

111-
let npmOptions: any = { silent: true };
111+
let npmOptions: any = { silent: true, "save-exact": true };
112112

113113
if (dependencyType) {
114114
npmOptions[dependencyType] = true;

lib/services/project-service.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export class ProjectService implements IProjectService {
1414
private $projectHelper: IProjectHelper,
1515
private $projectNameService: IProjectNameService,
1616
private $projectTemplatesService: IProjectTemplatesService,
17-
private $staticConfig: IStaticConfig) { }
17+
private $staticConfig: IStaticConfig,
18+
private $npmInstallationManager: INpmInstallationManager) { }
1819

1920
@exported("projectService")
2021
public async createProject(projectOptions: IProjectSettings): Promise<void> {
@@ -50,16 +51,12 @@ export class ProjectService implements IProjectService {
5051

5152
await this.ensureAppResourcesExist(projectDir);
5253

53-
let packageName = constants.TNS_CORE_MODULES_NAME;
54-
await this.$npm.install(packageName, projectDir, {
55-
save: true,
56-
"save-exact": true,
57-
disableNpmInstall: false,
58-
frameworkPath: null,
59-
ignoreScripts: projectOptions.ignoreScripts
60-
});
61-
6254
let templatePackageJsonData = this.getDataFromJson(templatePath);
55+
56+
if (!(templatePackageJsonData && templatePackageJsonData.dependencies && templatePackageJsonData.dependencies[constants.TNS_CORE_MODULES_NAME])) {
57+
await this.$npmInstallationManager.install(constants.TNS_CORE_MODULES_NAME, projectDir, { dependencyType: "save" });
58+
}
59+
6360
this.mergeProjectAndTemplateProperties(projectDir, templatePackageJsonData); //merging dependencies from template (dev && prod)
6461
this.removeMergedDependencies(projectDir, templatePackageJsonData);
6562

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"inquirer": "0.9.0",
4545
"ios-device-lib": "0.4.1",
4646
"ios-mobileprovision-finder": "1.0.9",
47-
"ios-sim-portable": "~2.0.0",
47+
"ios-sim-portable": "~3.0.0",
4848
"lockfile": "1.0.1",
4949
"lodash": "4.13.1",
5050
"log4js": "1.0.1",

test/project-service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class ProjectIntegrationTest {
114114
this.testInjector.register("fs", FileSystem);
115115
this.testInjector.register("projectDataService", ProjectDataServiceLib.ProjectDataService);
116116
this.testInjector.register("staticConfig", StaticConfig);
117-
this.testInjector.register("analyticsService", { track: async () => undefined });
117+
this.testInjector.register("analyticsService", { track: async (): Promise<any> => undefined });
118118

119119
this.testInjector.register("npmInstallationManager", NpmInstallationManager);
120120
this.testInjector.register("npm", NpmLib.NodePackageManager);
@@ -130,6 +130,7 @@ class ProjectIntegrationTest {
130130
return dummyString;
131131
}
132132
});
133+
this.testInjector.register("npmInstallationManager", NpmInstallationManager);
133134
}
134135
}
135136

@@ -471,6 +472,7 @@ describe("Project Service Tests", () => {
471472
testInjector.register("projectTemplatesService", {});
472473
testInjector.register("staticConfig", {});
473474
testInjector.register("projectHelper", {});
475+
testInjector.register("npmInstallationManager", {});
474476

475477
return testInjector;
476478
};

0 commit comments

Comments
 (0)