Skip to content

Commit dc10658

Browse files
committed
Merge remote-tracking branch 'origin/master' into tdermendzhiev/objc-source-support
2 parents de78502 + acb7030 commit dc10658

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1590
-1847
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!--
2+
We, the rest of the NativeScript community, thank you for your
3+
contribution!
4+
To help the rest of the community review your change, please follow the instructions in the template.
5+
-->
6+
7+
<!-- PULL REQUEST TEMPLATE -->
8+
<!-- (Update "[ ]" to "[x]" to check a box) -->
9+
10+
## PR Checklist
11+
12+
- [ ] The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/CONTRIBUTING.md#commit-messages.
13+
- [ ] There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
14+
- [ ] You have signed the [CLA](http://www.nativescript.org/cla).
15+
- [ ] All existing tests are passing: https://github.com/NativeScript/nativescript-cli/blob/master/CONTRIBUTING.md#contribute-to-the-code-base
16+
- [ ] Tests for the changes are included.
17+
18+
## What is the current behavior?
19+
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
20+
21+
## What is the new behavior?
22+
<!-- Describe the changes. -->
23+
24+
Fixes/Implements/Closes #[Issue Number].
25+
26+
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
27+
28+
<!--
29+
BREAKING CHANGES:
30+
31+
32+
[Describe the impact of the changes here.]
33+
34+
Migration steps:
35+
[Provide a migration path for existing applications.]
36+
-->
37+

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
NativeScript CLI Changelog
22
================
33

4+
4.0.0 (2018, April 10)
5+
==
6+
7+
### New
8+
* [Implemented #2632](https://github.com/NativeScript/nativescript-cli/issues/2632) Guidance for new CLI users
9+
* [Implemented #3243](https://github.com/NativeScript/nativescript-cli/issues/3243) 'Scss' file changes trigger app refresh instead reloading the view and apply generated 'css'
10+
* [Implemented #3248](https://github.com/NativeScript/nativescript-cli/issues/3248) Support JDK_HOME and JAVA_HOME
11+
* [Implemented #3257](https://github.com/NativeScript/nativescript-cli/issues/3257) Make {N} project structure configurable
12+
* [Implemented #3317](https://github.com/NativeScript/nativescript-cli/issues/3317) Support livesync with webpack
13+
* [Implemented #3449](https://github.com/NativeScript/nativescript-cli/pull/3449) Track Vue.js project type
14+
* [Implemented #3496](https://github.com/NativeScript/nativescript-cli/issues/3496) Generate assets for the mobile application
15+
* [Implemented #3497](https://github.com/NativeScript/nativescript-cli/issues/3497) Command to migrate Android resources to 4.0.0 structure
16+
* [Implemented #3516](https://github.com/NativeScript/nativescript-cli/issues/3516) Improve Getting Started Experience
17+
18+
### Fixed
19+
* [Fixed #3151](https://github.com/NativeScript/nativescript-cli/issues/3151): Install fails if user setting file is not valid json
20+
* [Fixed #3324](https://github.com/NativeScript/nativescript-cli/issues/3324): Error when iOS simulator's window is closed
21+
* [Fixed #3442](https://github.com/NativeScript/nativescript-cli/issues/3442): Unnecessary second build upon `tns run android`
22+
* [Fixed #3451](https://github.com/NativeScript/nativescript-cli/issues/3451): `tns plugin remove` fails with : Cannot convert undefined or null to object
23+
* [Fixed #3470](https://github.com/NativeScript/nativescript-cli/issues/3470): Error when we are publishing to AppStore
24+
* [Fixed #3481](https://github.com/NativeScript/nativescript-cli/issues/3481): Cannot log in users on iOS simulator with kinvey-nativescript-sdk
25+
* [Fixed #3514](https://github.com/NativeScript/nativescript-cli/pull/3514): Incorrect error is shown when xcrun simctl is not configured
26+
427
3.4.3 (2018, March 02)
528
==
629

PublicAPI.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ const tns = require("nativescript");
4848
* [assetsGenerationService](#assetsgenerationservice)
4949
* [generateIcons](#generateicons)
5050
* [generateSplashScreens](#generatesplashscreens)
51+
* [androidProcessService](#androidprocessservice)
52+
* [getAppProcessId](#getappprocessid)
5153

5254
## Module projectService
5355

@@ -1125,6 +1127,29 @@ tns.assetsGenerationService.generateSplashScreens({ projectDir: "/Users/username
11251127
});
11261128
```
11271129
1130+
## androidProcessService
1131+
The `androidProcessService` exposes methods for getting information about the applications working on Android devices.
1132+
1133+
### getAppProcessId
1134+
The `getAppProcessId` returns the PID of the specified application. If the app is not running on device, the method will return null.
1135+
1136+
* Definition
1137+
```TypeScript
1138+
/**
1139+
* Gets the PID of a running application.
1140+
* @param deviceIdentifier {string} The identifier of the device.
1141+
* @param appIdentifier The identifier of the application.
1142+
* @return {string} Returns the process id matching the application identifier in the device process list.
1143+
*/
1144+
getAppProcessId(deviceIdentifier: string, appIdentifier: string): Promise<string>;
1145+
```
1146+
1147+
* Usage
1148+
```JavaScript
1149+
tns.androidProcessService.getAppProcessId("4df18f307d8a8f1b", "org.nativescript.demoapp")
1150+
.then(pid => console.log(`The PID is ${pid}`))
1151+
.catch(err => console.error(`Error while checking for PID: ${err}`));
1152+
```
11281153
11291154
11301155
## How to add a new method to Public API

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

Lines changed: 6 additions & 3 deletions
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

docs/man_pages/project/testing/run-ios.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ position: 11
88
Usage | Synopsis
99
---|---
1010
Run on all connected devices | `$ tns run ios [--release] [--justlaunch] [--bundle [<value>] [--env.*]]`
11-
Run on a selected connected device. Will start simulator with specified `Device Identifier`, if not already running. | `$ tns run ios [--device <Device ID>] [--release] [--justlaunch] [--bundle [<value>] [--env.*]]`
11+
Run on a selected connected device. Will start simulator with specified `Device Identifier` or `Device Name`, if not already running. | `$ tns run ios [--device <Device ID>] [--release] [--justlaunch] [--bundle [<value>] [--env.*]]`
1212
Start an emulator and run the app inside it | `$ tns run ios --emulator [--release] [--bundle [<value>] [--env.*]]`
13+
Start an emulator with specified device name and sdk | `$ tns run ios [--device <Device Name>] [--sdk <sdk>]`
14+
Start an emulator with specified device identifier and sdk | `$ tns run ios [--device <Device Identifier>] [--sdk <sdk>]`
1315

1416
Runs your project on a connected iOS device or in the iOS Simulator, if configured. This is shorthand for prepare, build and deploy. While your app is running, prints the output from the application in the console and watches for changes in your code. Once a change is detected, it synchronizes the change with all selected devices and restarts/refreshes the application.
1517

@@ -20,6 +22,7 @@ Runs your project on a connected iOS device or in the iOS Simulator, if configur
2022
### Options
2123
* `--device` - Specifies a connected device/simulator to start and run the app.
2224
* `--emulator` - If set, runs the app in all available and configured ios simulators. It will start a simulator if none are already running.
25+
* `--sdk` - Specifies the target simulator's sdk.
2326
* `--justlaunch` - If set, does not print the application output in the console.
2427
* `--clean` - If set, forces rebuilding the native application.
2528
* `--no-watch` - If set, changes in your code will not be reflected during the execution of this command.
@@ -30,6 +33,7 @@ Runs your project on a connected iOS device or in the iOS Simulator, if configur
3033

3134
### Attributes
3235
* `<Device ID>` is the index or `Device Identifier` of the target device as listed by `$ tns device ios --available-devices`
36+
* `<Device Name>` is the name of the target simulator as listed by `$ tns device ios --available-devices`
3337
<% } %>
3438
<% if(isHtml) { %>
3539
### Prerequisites

lib/bootstrap.ts

Lines changed: 1 addition & 1 deletion
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

Lines changed: 12 additions & 1 deletion
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

Lines changed: 21 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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);

0 commit comments

Comments
 (0)