Skip to content

Commit 18d3135

Browse files
Merge pull request #3216 from NativeScript/vladimirov/release-331
Cherry-pick commits for 3.3.1
2 parents b232fd5 + 7b8685b commit 18d3135

37 files changed

+548
-115
lines changed

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
NativeScript CLI Changelog
22
================
33

4-
3.2.0 - RC.1 (2017, August 29)
4+
3.3.1 (2017, November 17)
5+
### Fixed
6+
* [Fixed #3164](https://github.com/NativeScript/nativescript-cli/issues/3164): `npm run build-*-bundle` gets stuck at nativescript-unit-test-runner hook.
7+
* [Fixed #3182](https://github.com/NativeScript/nativescript-cli/issues/3182): CLI fails when unable to start Analytics Broker process.
8+
9+
3.3.0 (2017, October 26)
10+
==
11+
12+
### New
13+
14+
* [Implemented #3076](https://github.com/NativeScript/nativescript-cli/issues/3076): NativeScript setup scripts should have silent installer mode.
15+
16+
### Fixed
17+
* [Fixed #3141](https://github.com/NativeScript/nativescript-cli/issues/3141): No console.log output Xcode 9 iOS 11.
18+
* [Fixed #3016](https://github.com/NativeScript/nativescript-cli/issues/3016): tns_modules randomly appears in app folder and breaks build.
19+
* [Fixed #2967](https://github.com/NativeScript/nativescript-cli/issues/2967): Create plugin by static static libraries error.
20+
21+
3.2.0 (2017, September 7)
522
==
623

724
### Fixed

PublicAPI.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const tns = require("nativescript");
3535
* [disableDebugging](#disableDebugging)
3636
* [getLiveSyncDeviceDescriptors](#getLiveSyncDeviceDescriptors)
3737
* [events](#events)
38+
* [analyticsSettingsService](#analyticsSettingsService)
39+
* [getClientId](#getClientId)
3840

3941

4042
## Module projectService
@@ -271,7 +273,7 @@ interface ISettingsService {
271273
272274
* Usage:
273275
```JavaScript
274-
tns.settingsService.setSettings({ userAgentName: "myUserAgent" });
276+
tns.settingsService.setSettings({ userAgentName: "myUserAgent", profileDir: "customProfileDir" });
275277
```
276278
277279
## npm
@@ -855,6 +857,44 @@ tns.liveSyncService.on("debuggerDetached", debugInfo => {
855857
console.log(`Detached debugger for device with id ${debugInfo.deviceIdentifier}`);
856858
});
857859
```
860+
## analyticsSettingsService
861+
Provides methods for accessing the analytics settings file data.
862+
863+
### getClientId
864+
The `getClientId` method allows retrieving the clientId used in the analytics tracking
865+
866+
* Definition:
867+
```TypeScript
868+
/**
869+
* Gets the clientId used for analytics tracking
870+
* @returns {Promise<string>} Client identifier in UUIDv4 standard.
871+
*/
872+
getClientId(): Promise<string>;
873+
```
874+
875+
* Usage:
876+
```JavaScript
877+
tns.analyticsSettingsService.getClientId()
878+
.then(clientId => console.log(clientId));
879+
```
880+
881+
### getUserAgentString
882+
The `getUserAgentString` method allows retrieving a user agent string identifying the current system
883+
884+
* Definition:
885+
```TypeScript
886+
/**
887+
* Gets user agent string identifing the current system in the following format: `${identifier} (${systemInfo}) ${osArch}`
888+
* @param {string} identifier The product identifier.
889+
* @returns {string} The user agent string.
890+
*/
891+
getUserAgentString(identifier: string): string;
892+
```
893+
894+
* Usage:
895+
```JavaScript
896+
const userAgentString = tns.analyticsSettingsService.getUserAgentString("tns/3.3.0");
897+
```
858898
859899
## How to add a new method to Public API
860900
CLI is designed as command line tool and when it is used as a library, it does not give you access to all of the methods. This is mainly implementation detail. Most of the CLI's code is created to work in command line, not as a library, so before adding method to public API, most probably it will require some modification.

lib/bootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $injector.require("iOSDebugService", "./services/ios-debug-service");
2929
$injector.require("androidDebugService", "./services/android-debug-service");
3030

3131
$injector.require("userSettingsService", "./services/user-settings-service");
32-
$injector.require("analyticsSettingsService", "./services/analytics-settings-service");
32+
$injector.requirePublic("analyticsSettingsService", "./services/analytics-settings-service");
3333
$injector.require("analyticsService", "./services/analytics/analytics-service");
3434
$injector.require("eqatecAnalyticsProvider", "./services/analytics/eqatec-analytics-provider");
3535
$injector.require("googleAnalyticsProvider", "./services/analytics/google-analytics-provider");

lib/commands/generate-help.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export class GenerateHelpCommand implements ICommand {
22
public allowedParameters: ICommandParameter[] = [];
33

4-
constructor(private $htmlHelpService: IHtmlHelpService) { }
4+
constructor(private $helpService: IHelpService) { }
55

66
public async execute(args: string[]): Promise<void> {
7-
return this.$htmlHelpService.generateHtmlPages();
7+
return this.$helpService.generateHtmlPages();
88
}
99
}
1010

lib/commands/post-install.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ export class PostInstallCliCommand extends PostInstallCommand {
55
private $subscriptionService: ISubscriptionService,
66
$staticConfig: Config.IStaticConfig,
77
$commandsService: ICommandsService,
8-
$htmlHelpService: IHtmlHelpService,
9-
$options: ICommonOptions,
8+
$helpService: IHelpService,
9+
$settingsService: ISettingsService,
1010
$doctorService: IDoctorService,
1111
$analyticsService: IAnalyticsService,
1212
$logger: ILogger) {
13-
super($fs, $staticConfig, $commandsService, $htmlHelpService, $options, $doctorService, $analyticsService, $logger);
13+
super($fs, $staticConfig, $commandsService, $helpService, $settingsService, $doctorService, $analyticsService, $logger);
1414
}
1515

1616
public async execute(args: string[]): Promise<void> {

lib/commands/test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ function RunTestCommandFactory(platform: string) {
44
return function RunTestCommand(
55
$options: IOptions,
66
$testExecutionService: ITestExecutionService,
7-
$projectData: IProjectData) {
7+
$projectData: IProjectData,
8+
$analyticsService: IAnalyticsService) {
89
$projectData.initializeProjectData();
10+
$analyticsService.setShouldDispose($options.justlaunch || !$options.watch);
911
const projectFilesConfig = helpers.getProjectFilesConfig({ isReleaseBuild: $options.release });
1012
this.execute = (args: string[]): Promise<void> => $testExecutionService.startTestRunner(platform, $projectData, projectFilesConfig);
1113
this.allowedParameters = [];
@@ -16,8 +18,9 @@ $injector.registerCommand("dev-test|android", RunTestCommandFactory('android'));
1618
$injector.registerCommand("dev-test|ios", RunTestCommandFactory('iOS'));
1719

1820
function RunKarmaTestCommandFactory(platform: string) {
19-
return function RunKarmaTestCommand($options: IOptions, $testExecutionService: ITestExecutionService, $projectData: IProjectData) {
21+
return function RunKarmaTestCommand($options: IOptions, $testExecutionService: ITestExecutionService, $projectData: IProjectData, $analyticsService: IAnalyticsService) {
2022
$projectData.initializeProjectData();
23+
$analyticsService.setShouldDispose($options.justlaunch || !$options.watch);
2124
const projectFilesConfig = helpers.getProjectFilesConfig({ isReleaseBuild: $options.release });
2225
this.execute = (args: string[]): Promise<void> => $testExecutionService.startKarmaServer(platform, $projectData, projectFilesConfig);
2326
this.allowedParameters = [];

lib/config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export class StaticConfig extends StaticConfigBase implements IStaticConfig {
2828
public ERROR_REPORT_SETTING_NAME = "TrackExceptions";
2929
public ANALYTICS_INSTALLATION_ID_SETTING_NAME = "AnalyticsInstallationID";
3030
public INSTALLATION_SUCCESS_MESSAGE = "Installation successful. You are good to go. Connect with us on `http://twitter.com/NativeScript`.";
31+
public get PROFILE_DIR_NAME(): string {
32+
return ".nativescript-cli";
33+
}
3134

3235
constructor($injector: IInjector) {
3336
super($injector);
@@ -60,10 +63,6 @@ export class StaticConfig extends StaticConfigBase implements IStaticConfig {
6063

6164
public version = require("../package.json").version;
6265

63-
public get helpTextPath(): string {
64-
return path.join(__dirname, "../resources/help.txt");
65-
}
66-
6766
public get HTML_CLI_HELPERS_DIR(): string {
6867
return path.join(__dirname, "../docs/helpers");
6968
}

lib/nativescript-cli-lib-bootstrap.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,4 @@ $injector.requirePublic("companionAppsService", "./common/appbuilder/services/li
99
$injector.requirePublicClass("deviceEmitter", "./common/appbuilder/device-emitter");
1010
$injector.requirePublicClass("deviceLogProvider", "./common/appbuilder/device-log-provider");
1111

12-
// We need this because some services check if (!$options.justlaunch) to start the device log after some operation.
13-
// We don't want this behaviour when the CLI is required as library.
14-
$injector.resolve("options").justlaunch = true;
1512
$injector.resolve<IStaticConfig>("staticConfig").disableAnalytics = true;

lib/node-package-manager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,12 @@ export class NodePackageManager implements INodePackageManager {
156156
});
157157

158158
// Npm 5 return different object after performing `npm install --dry-run`.
159-
// Considering that the dependency is already installed we should
160-
// find it in the `updated` key as a first element of the array.
159+
// We find the correct dependency by searching for the `userSpecifiedPackageName` in the
160+
// `npm5Output.updated` array and as a fallback, considering that the dependency is already installed,
161+
// we find it as the first element.
161162
if (!name && npm5Output.updated) {
162-
const updatedDependency = npm5Output.updated[0];
163+
const packageNameWithoutVersion = userSpecifiedPackageName.split('@')[0];
164+
const updatedDependency = _.find(npm5Output.updated, ['name', packageNameWithoutVersion]) || npm5Output.updated[0];
163165
return {
164166
name: updatedDependency.name,
165167
originalOutput,

0 commit comments

Comments
 (0)