Skip to content

Commit 8cd21b8

Browse files
author
Fatme
authored
Merge pull request #3520 from NativeScript/vladimirov/merge-rel-master
chore: Merge release in master
2 parents 0954b48 + 432d05d commit 8cd21b8

38 files changed

+582
-680
lines changed

CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
NativeScript CLI Changelog
22
================
33

4+
4.0.0rc (2018, March 23)
5+
==
6+
7+
### New
8+
* [Implemented #3243](https://github.com/NativeScript/nativescript-cli/issues/3243) 'Scss' file changes trigger app refresh instead reloading the view and apply generated 'css'
9+
* [Implemented #3248](https://github.com/NativeScript/nativescript-cli/issues/3248) Support JDK_HOME and JAVA_HOME
10+
* [Implemented #3257](https://github.com/NativeScript/nativescript-cli/issues/3257) Make {N} project structure configurable
11+
* [Implemented #3317](https://github.com/NativeScript/nativescript-cli/issues/3317) Support livesync with webpack
12+
* [Implemented #3449](https://github.com/NativeScript/nativescript-cli/pull/3449) Track Vue.js project type
13+
* [Implemented #3496](https://github.com/NativeScript/nativescript-cli/issues/3496) Generate assets for the mobile application
14+
* [Implemented #3497](https://github.com/NativeScript/nativescript-cli/issues/3497) Command to migrate Android resources to 4.0.0 structure
15+
16+
### Fixed
17+
* [Fixed #3151](https://github.com/NativeScript/nativescript-cli/issues/3151): Install fails if user setting file is not valid json
18+
* [Fixed #3324](https://github.com/NativeScript/nativescript-cli/issues/3324): Error when iOS simulator's window is closed
19+
* [Fixed #3442](https://github.com/NativeScript/nativescript-cli/issues/3442): Unnecessary second build upon `tns run android`
20+
* [Fixed #3451](https://github.com/NativeScript/nativescript-cli/issues/3451): `tns plugin remove` fails with : Cannot convert undefined or null to object
21+
22+
423
3.4.3 (2018, March 02)
524
==
625

docs/man_pages/project/configuration/resources/resources-generate-splashes.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ position: 12
66

77
Usage | Synopsis
88
------|-------
9-
`$ tns resources generate splashes <Path to image> [<background>]` | Generate all splashscreens for Android and iOS based on the specified image.
9+
`$ tns resources generate splashes <Path to image> [--background <Color>]` | Generate all splashscreens for Android and iOS based on the specified image.
1010

11-
Generates all icons for Android and iOS platforms and places the generated images in the correct directories under `App_Resources/<platform>` directory.
11+
Generates all splashscreens for Android and iOS platforms and places the generated images in the correct directories under `App_Resources/<platform>` directory.
12+
13+
### Options
14+
* `--background` Sets the background color of the splashscreen. Defaults to white in case it is not specified.
1215

1316
### Attributes
1417
* `<Path to image>` is a valid path to an image that will be used to generate all splashscreens.
15-
* `<background>` is a valid path to an image that will be used as a background of the splashscreen. Defaults to white in case it is not specified.
18+
* `<Color>` is a valid color. It can be represented with string, like `white`, `black`, `blue`, etc. or its HEX representation, for example `#FFFFFF`, `#000000`, `#0000FF`. NOTE: As the `#` is special symbol in some terminals, make sure to place the value in quotes, for example `$ tns resources generate splashes ../myImage.png --background "#FF00FF"`.
1619

1720
<% if(isHtml) { %>
1821
### Related Commands

lib/bootstrap.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ $injector.require("terminalSpinnerService", "./services/terminal-spinner-service
160160

161161
$injector.require('playgroundService', './services/playground-service');
162162
$injector.require("platformEnvironmentRequirements", "./services/platform-environment-requirements");
163-
$injector.require("nativescriptCloudExtensionService", "./services/nativescript-cloud-extension-service");
163+
$injector.require("nativeScriptCloudExtensionService", "./services/nativescript-cloud-extension-service");
164164

165165
$injector.requireCommand("resources|generate|icons", "./commands/generate-assets");
166166
$injector.requireCommand("resources|generate|splashes", "./commands/generate-assets");

lib/commands/create-project.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import * as constants from "../constants";
2+
import * as path from "path";
23

34
export class CreateProjectCommand implements ICommand {
45
public enableHooks = false;
56
public allowedParameters: ICommandParameter[] = [this.$stringParameterBuilder.createMandatoryParameter("Project name cannot be empty.")];
67

8+
private createdProjecData: ICreateProjectData;
9+
710
constructor(private $projectService: IProjectService,
11+
private $logger: ILogger,
812
private $errors: IErrors,
913
private $options: IOptions,
1014
private $stringParameterBuilder: IStringParameterBuilder) { }
@@ -23,7 +27,7 @@ export class CreateProjectCommand implements ICommand {
2327
selectedTemplate = this.$options.template;
2428
}
2529

26-
await this.$projectService.createProject({
30+
this.createdProjecData = await this.$projectService.createProject({
2731
projectName: args[0],
2832
template: selectedTemplate,
2933
appId: this.$options.appid,
@@ -32,6 +36,13 @@ export class CreateProjectCommand implements ICommand {
3236
ignoreScripts: this.$options.ignoreScripts
3337
});
3438
}
39+
40+
public async postCommandAction(args: string[]): Promise<void> {
41+
const { projectDir } = this.createdProjecData;
42+
const relativePath = path.relative(process.cwd(), projectDir);
43+
this.$logger.printMarkdown(`Now you can navigate to your project with \`$ cd ${relativePath}\``);
44+
this.$logger.printMarkdown(`After that you can run it on device/emulator by executing \`$ tns run <platform>\``);
45+
}
3546
}
3647

3748
$injector.registerCommand("create", CreateProjectCommand);

lib/commands/post-install.ts

+21
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,27 @@ export class PostInstallCliCommand extends PostInstallCommand {
1818

1919
await this.$subscriptionService.subscribeForNewsletter();
2020
}
21+
22+
public async postCommandAction(args: string[]): Promise<void> {
23+
this.$logger.info("You have successfully installed NativeScript CLI.");
24+
this.$logger.info("In order to create a new project, you can use:".green);
25+
this.$logger.printMarkdown("`tns create <app name>`");
26+
this.$logger.info("To build your project locally you can use:".green);
27+
this.$logger.printMarkdown("`tns build <platform>`");
28+
this.$logger.printMarkdown("NOTE: Local builds require additional setup of your environment. You can find more information here: `https://docs.nativescript.org/start/quick-setup`");
29+
30+
// Add a new line just to ensure separation between local builds and cloud builds info.
31+
this.$logger.info("");
32+
this.$logger.info("To build your project in the cloud you can use:".green);
33+
this.$logger.printMarkdown("`tns cloud build <platform>`");
34+
this.$logger.printMarkdown("NOTE: Cloud builds require Telerik account. You can find more information here: `https://docs.nativescript.org/sidekick/intro/requirements`");
35+
36+
this.$logger.info("");
37+
this.$logger.printMarkdown("In case you want to experiment quickly with NativeScript, you can try the Playground: `https://play.nativescript.org`");
38+
39+
this.$logger.info("");
40+
this.$logger.printMarkdown("In case you have any questions, you can check our forum: `https://forum.nativescript.org` and our public Slack channel: `https://nativescriptcommunity.slack.com/`");
41+
}
2142
}
2243

2344
$injector.registerCommand("post-install-cli", PostInstallCliCommand);

lib/commands/run.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class RunCommandBase implements ICommand {
2828
this.platform = this.$devicePlatformsConstants.Android;
2929
}
3030

31-
this.$liveSyncCommandHelper.validatePlatform(this.platform);
31+
await this.$liveSyncCommandHelper.validatePlatform(this.platform);
3232

3333
return true;
3434
}

lib/commands/setup.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ $injector.registerCommand("setup|*", SetupCommand);
1212
export class CloudSetupCommand implements ICommand {
1313
public allowedParameters: ICommandParameter[] = [];
1414

15-
constructor(private $nativescriptCloudExtensionService: INativescriptCloudExtensionService) { }
15+
constructor(private $nativeScriptCloudExtensionService: INativeScriptCloudExtensionService) { }
1616

1717
public execute(args: string[]): Promise<any> {
18-
return this.$nativescriptCloudExtensionService.install();
18+
return this.$nativeScriptCloudExtensionService.install();
1919
}
2020
}
2121
$injector.registerCommand(["setup|cloud", "cloud|setup"], CloudSetupCommand);

lib/constants.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ export const enum TrackActionNames {
135135
CreateProject = "Create project",
136136
Debug = "Debug",
137137
Deploy = "Deploy",
138-
LiveSync = "LiveSync"
138+
LiveSync = "LiveSync",
139+
RunSetupScript = "Run Setup Script",
140+
CheckLocalBuildSetup = "Check Local Build Setup",
141+
CheckEnvironmentRequirements = "Check Environment Requirements"
139142
}
140143

141144
export const enum BuildStates {

lib/declarations.d.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -788,12 +788,17 @@ interface IBundleValidatorHelper {
788788
validate(): void;
789789
}
790790

791-
interface INativescriptCloudExtensionService {
791+
interface INativeScriptCloudExtensionService {
792792
/**
793793
* Installs nativescript-cloud extension
794794
* @return {Promise<IExtensionData>} returns the extension data
795795
*/
796796
install(): Promise<IExtensionData>;
797+
/**
798+
* Checks if nativescript-cloud extension is installed
799+
* @return {boolean} returns true in case when nativescript-cloud extension is installed, false otherwise
800+
*/
801+
isInstalled(): boolean
797802
}
798803

799804
/**

lib/definitions/platform.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,5 +381,5 @@ interface IUpdateAppOptions extends IOptionalFilesToSync, IOptionalFilesToRemove
381381
}
382382

383383
interface IPlatformEnvironmentRequirements {
384-
checkEnvironmentRequirements(platform: string): Promise<boolean>;
384+
checkEnvironmentRequirements(platform?: string): Promise<boolean>;
385385
}

lib/definitions/project.d.ts

+10-9
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,21 @@ interface IProjectSettings {
3737
ignoreScripts?: boolean;
3838
}
3939

40+
interface IProjectName {
41+
projectName: string;
42+
}
43+
44+
interface ICreateProjectData extends IProjectDir, IProjectName {
45+
46+
}
47+
4048
interface IProjectService {
4149
/**
4250
* Creates new NativeScript application.
4351
* @param {any} projectSettings Options describing new project - its name, appId, path and template from which to be created.
4452
* @returns {Promise<void>}
4553
*/
46-
createProject(projectSettings: IProjectSettings): Promise<void>;
54+
createProject(projectSettings: IProjectSettings): Promise<ICreateProjectData>;
4755

4856
/**
4957
* Checks if the specified project is valid NativeScript project.
@@ -58,8 +66,7 @@ interface INsConfig {
5866
appResourcesPath?: string;
5967
}
6068

61-
interface IProjectData extends IProjectDir {
62-
projectName: string;
69+
interface IProjectData extends ICreateProjectData {
6370
platformsDir: string;
6471
projectFilePath: string;
6572
projectId?: string;
@@ -394,12 +401,6 @@ interface IPlatformProjectService extends NodeJS.EventEmitter {
394401
executeCommand(projectRoot: string, args: any, childProcessOpts?: any, spawnFromEventOptions?: ISpawnFromEventOptions): Promise<ISpawnResult>;
395402
}
396403

397-
interface IAndroidProjectPropertiesManager {
398-
getProjectReferences(): Promise<ILibRef[]>;
399-
addProjectReference(referencePath: string): Promise<void>;
400-
removeProjectReference(referencePath: string): Promise<void>;
401-
}
402-
403404
interface ITestExecutionService {
404405
startTestRunner(platform: string, projectData: IProjectData, projectFilesConfig: IProjectFilesConfig): Promise<void>;
405406
startKarmaServer(platform: string, projectData: IProjectData, projectFilesConfig: IProjectFilesConfig): Promise<void>;

lib/definitions/simple-plist.d.ts

-4
This file was deleted.

lib/services/analytics/analytics-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class AnalyticsService extends AnalyticsServiceBase {
7373

7474
// In some cases (like in case action is Build and platform is Android), we do not know if the deviceType is emulator or device.
7575
// Just exclude the device_type in this case.
76-
if (isForDevice !== null) {
76+
if (isForDevice !== null && isForDevice !== undefined) {
7777
const deviceType = isForDevice ? DeviceTypes.Device : (this.$mobileHelper.isAndroidPlatform(platform) ? DeviceTypes.Emulator : DeviceTypes.Simulator);
7878
label = this.addDataToLabel(label, deviceType);
7979
}

lib/services/analytics/google-analytics-provider.ts

+5-28
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { AnalyticsClients } from "../../common/constants";
44

55
export class GoogleAnalyticsProvider implements IGoogleAnalyticsProvider {
66
private static GA_TRACKING_ID = "UA-111455-44";
7-
private static GA_CROSS_CLIENT_TRACKING_ID = "UA-111455-51";
87
private currentPage: string;
98

109
constructor(private clientId: string,
@@ -15,15 +14,12 @@ export class GoogleAnalyticsProvider implements IGoogleAnalyticsProvider {
1514
}
1615

1716
public async trackHit(trackInfo: IGoogleAnalyticsData): Promise<void> {
18-
const trackingIds = [GoogleAnalyticsProvider.GA_TRACKING_ID, GoogleAnalyticsProvider.GA_CROSS_CLIENT_TRACKING_ID];
1917
const sessionId = uuid.v4();
2018

21-
for (const gaTrackingId of trackingIds) {
22-
try {
23-
await this.track(gaTrackingId, trackInfo, sessionId);
24-
} catch (e) {
25-
this.$logger.trace("Analytics exception: ", e);
26-
}
19+
try {
20+
await this.track(GoogleAnalyticsProvider.GA_TRACKING_ID, trackInfo, sessionId);
21+
} catch (e) {
22+
this.$logger.trace("Analytics exception: ", e);
2723
}
2824
}
2925

@@ -41,14 +37,7 @@ export class GoogleAnalyticsProvider implements IGoogleAnalyticsProvider {
4137
}
4238
});
4339

44-
switch (gaTrackingId) {
45-
case GoogleAnalyticsProvider.GA_CROSS_CLIENT_TRACKING_ID:
46-
this.setCrossClientCustomDimensions(visitor, sessionId);
47-
break;
48-
default:
49-
await this.setCustomDimensions(visitor, trackInfo.customDimensions, sessionId);
50-
break;
51-
}
40+
await this.setCustomDimensions(visitor, trackInfo.customDimensions, sessionId);
5241

5342
switch (trackInfo.googleAnalyticsDataType) {
5443
case GoogleAnalyticsDataType.Page:
@@ -83,18 +72,6 @@ export class GoogleAnalyticsProvider implements IGoogleAnalyticsProvider {
8372
});
8473
}
8574

86-
private async setCrossClientCustomDimensions(visitor: ua.Visitor, sessionId: string): Promise<void> {
87-
const customDimensions: IStringDictionary = {
88-
[GoogleAnalyticsCrossClientCustomDimensions.sessionId]: sessionId,
89-
[GoogleAnalyticsCrossClientCustomDimensions.clientId]: this.clientId,
90-
[GoogleAnalyticsCrossClientCustomDimensions.crossClientId]: this.clientId,
91-
};
92-
93-
_.each(customDimensions, (value, key) => {
94-
visitor.set(key, value);
95-
});
96-
}
97-
9875
private trackEvent(visitor: ua.Visitor, trackInfo: IGoogleAnalyticsEventData): Promise<void> {
9976
return new Promise<void>((resolve, reject) => {
10077
visitor.event(trackInfo.category, trackInfo.action, trackInfo.label, trackInfo.value, { p: this.currentPage }, (err: Error) => {

lib/services/android-plugin-build-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,11 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
253253
const androidToolsInfo = this.$androidToolsInfo.getToolsInfo();
254254
const compileSdk = androidToolsInfo.compileSdkVersion;
255255
const buildToolsVersion = androidToolsInfo.buildToolsVersion;
256+
const supportVersion = androidToolsInfo.supportRepositoryVersion;
256257

257258
localArgs.push(`-PcompileSdk=android-${compileSdk}`);
258259
localArgs.push(`-PbuildToolsVersion=${buildToolsVersion}`);
260+
localArgs.push(`-PsupportVersion=${supportVersion}`);
259261

260262
try {
261263
await this.$childProcess.exec(localArgs.join(" "), { cwd: newPluginDir });

0 commit comments

Comments
 (0)