Skip to content

Merge release in master #2794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 10, 2017
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
11 changes: 3 additions & 8 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export abstract class DebugPlatformCommand implements ICommand {
constructor(private debugService: IPlatformDebugService,
private $devicesService: Mobile.IDevicesService,
private $injector: IInjector,
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
private $config: IConfiguration,
private $usbLiveSyncService: ILiveSyncService,
private $debugDataService: IDebugDataService,
Expand Down Expand Up @@ -49,11 +48,7 @@ export abstract class DebugPlatformCommand implements ICommand {
await this.debugService.debugStop();

let applicationId = deviceAppData.appIdentifier;
if (deviceAppData.device.isEmulator && deviceAppData.platform.toLowerCase() === this.$devicePlatformsConstants.iOS.toLowerCase()) {
applicationId = projectData.projectName;
}

await deviceAppData.device.applicationManager.stopApplication(applicationId);
await deviceAppData.device.applicationManager.stopApplication(applicationId, projectData.projectName);

const buildConfig: IBuildConfig = _.merge({ buildForDevice: !deviceAppData.device.isEmulator }, deployOptions);
debugData.pathToAppPackage = this.$platformService.lastOutputPath(this.debugService.platform, buildConfig, projectData);
Expand Down Expand Up @@ -102,7 +97,7 @@ export class DebugIOSCommand extends DebugPlatformCommand {
$projectData: IProjectData,
$platformsData: IPlatformsData,
$iosDeviceOperations: IIOSDeviceOperations) {
super($iOSDebugService, $devicesService, $injector, $devicePlatformsConstants, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
super($iOSDebugService, $devicesService, $injector, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
// 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.
// 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.
// That's why the `$ tns debug ios --justlaunch` command will not release the terminal.
Expand Down Expand Up @@ -136,7 +131,7 @@ export class DebugAndroidCommand extends DebugPlatformCommand {
$options: IOptions,
$projectData: IProjectData,
$platformsData: IPlatformsData) {
super($androidDebugService, $devicesService, $injector, $devicePlatformsConstants, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
super($androidDebugService, $devicesService, $injector, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
}

public async canExecute(args: string[]): Promise<boolean> {
Expand Down
2 changes: 1 addition & 1 deletion lib/nativescript-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as shelljs from "shelljs";
shelljs.config.silent = true;
shelljs.config.fatal = true;
import { installUncaughtExceptionListener } from "./common/errors";
installUncaughtExceptionListener(process.exit);
installUncaughtExceptionListener(process.exit.bind(process, ErrorCodes.UNCAUGHT));

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

Expand Down
2 changes: 1 addition & 1 deletion lib/npm-installation-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class NpmInstallationManager implements INpmInstallationManager {

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

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

if (dependencyType) {
npmOptions[dependencyType] = true;
Expand Down
17 changes: 7 additions & 10 deletions lib/services/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export class ProjectService implements IProjectService {
private $projectHelper: IProjectHelper,
private $projectNameService: IProjectNameService,
private $projectTemplatesService: IProjectTemplatesService,
private $staticConfig: IStaticConfig) { }
private $staticConfig: IStaticConfig,
private $npmInstallationManager: INpmInstallationManager) { }

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

await this.ensureAppResourcesExist(projectDir);

let packageName = constants.TNS_CORE_MODULES_NAME;
await this.$npm.install(packageName, projectDir, {
save: true,
"save-exact": true,
disableNpmInstall: false,
frameworkPath: null,
ignoreScripts: projectOptions.ignoreScripts
});

let templatePackageJsonData = this.getDataFromJson(templatePath);

if (!(templatePackageJsonData && templatePackageJsonData.dependencies && templatePackageJsonData.dependencies[constants.TNS_CORE_MODULES_NAME])) {
await this.$npmInstallationManager.install(constants.TNS_CORE_MODULES_NAME, projectDir, { dependencyType: "save" });
}

this.mergeProjectAndTemplateProperties(projectDir, templatePackageJsonData); //merging dependencies from template (dev && prod)
this.removeMergedDependencies(projectDir, templatePackageJsonData);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"inquirer": "0.9.0",
"ios-device-lib": "0.4.1",
"ios-mobileprovision-finder": "1.0.9",
"ios-sim-portable": "~2.0.0",
"ios-sim-portable": "~3.0.0",
"lockfile": "1.0.1",
"lodash": "4.13.1",
"log4js": "1.0.1",
Expand Down
4 changes: 3 additions & 1 deletion test/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ProjectIntegrationTest {
this.testInjector.register("fs", FileSystem);
this.testInjector.register("projectDataService", ProjectDataServiceLib.ProjectDataService);
this.testInjector.register("staticConfig", StaticConfig);
this.testInjector.register("analyticsService", { track: async () => undefined });
this.testInjector.register("analyticsService", { track: async (): Promise<any> => undefined });

this.testInjector.register("npmInstallationManager", NpmInstallationManager);
this.testInjector.register("npm", NpmLib.NodePackageManager);
Expand All @@ -130,6 +130,7 @@ class ProjectIntegrationTest {
return dummyString;
}
});
this.testInjector.register("npmInstallationManager", NpmInstallationManager);
}
}

Expand Down Expand Up @@ -471,6 +472,7 @@ describe("Project Service Tests", () => {
testInjector.register("projectTemplatesService", {});
testInjector.register("staticConfig", {});
testInjector.register("projectHelper", {});
testInjector.register("npmInstallationManager", {});

return testInjector;
};
Expand Down