Skip to content

Update #1

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 159 commits into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
365b484
feat: add sample test in TypeScript for ts projects on test init command
Fatme Mar 28, 2019
51cb7ca
chore: exclude example test ts files from compilation
Fatme Mar 29, 2019
33c3f8c
fix: errors are shown on postinstall when using sudo
rosen-vladimirov Apr 1, 2019
344335b
Merge pull request #4493 from NativeScript/vladimirov/fix-errors-post…
rosen-vladimirov Apr 2, 2019
c4295f6
fix: detect java correctly
rosen-vladimirov Apr 2, 2019
882ca60
Merge pull request #4494 from NativeScript/vladimirov/fix-java-home-d…
rosen-vladimirov Apr 2, 2019
cd32805
feat(api): respect the correct min supported versions for ksplay schema
Fatme Apr 1, 2019
9536b60
fix(api): return correct store urls based on the schema from getPlayg…
Fatme Apr 2, 2019
4b7bd96
test: add tests for preview-schema-service
Fatme Apr 2, 2019
4fba741
feat(kinvey preview app): show correct store urls when deprecated pag…
Fatme Apr 2, 2019
ad2a4df
chore: update to the latest version of nativescript-preview-sdk
Fatme Apr 2, 2019
27ca961
Merge pull request #4492 from NativeScript/fatme/kinvey-schema
rosen-vladimirov Apr 2, 2019
1060aaa
fix: change ksplay to kspreview schema
Fatme Apr 2, 2019
45219d3
Merge pull request #4496 from NativeScript/fatme/change-kinvey-schema
rosen-vladimirov Apr 2, 2019
d9d1d95
fix(kinvey): use correct store ids for preview and scanner apps
Fatme Apr 3, 2019
16d3760
fix(grunt): generate unit testing dependencies on grunt rebuild command
Fatme Apr 3, 2019
54bf922
chore: add separate test files for `--bundle` and no-bundle case
Fatme Apr 1, 2019
66a6c5b
chore: update cli's version
Fatme Apr 3, 2019
3fbdadf
Merge pull request #4498 from NativeScript/fatme/fix-kinvey-store-id
Apr 3, 2019
df1dd13
Merge branch 'release' into fatme/merge-release
Fatme Apr 3, 2019
34f4e45
Merge pull request #4502 from NativeScript/fatme/merge-release
Apr 3, 2019
3dae2cd
fix: remove legacy code related to old structure of android project
Fatme Apr 4, 2019
0d4fc5b
Merge pull request #4501 from NativeScript/fatme/fix-grunt-rebuild
Apr 4, 2019
7d7ce8e
Merge pull request #4505 from NativeScript/fatme/fix-legacy-code
Apr 4, 2019
9bce91f
fix: handle HTTP 304 response status code
rosen-vladimirov Apr 8, 2019
4aa3de6
Merge pull request #4510 from NativeScript/vladimirov/handle-http-304
rosen-vladimirov Apr 8, 2019
36d54e3
docs: add environment flags in CLI help
NickIliev Apr 10, 2019
7f32293
revert tsconfig change
NickIliev Apr 10, 2019
b76a956
docs: section improvments
NickIliev Apr 10, 2019
8b618cf
Merge branch 'niliev/env' of https://github.com/NativeScript/nativesc…
NickIliev Apr 10, 2019
04ef643
Merge pull request #4519 from NativeScript/niliev/env
Apr 10, 2019
cd00be9
feat: add iCloudContainerEnvironment build option
jzgoda Apr 10, 2019
3270ecd
Merge pull request #4526 from jzgoda/add-icloud-container-environment
Apr 11, 2019
673c761
Merge pull request #4482 from NativeScript/fatme/ts-unit-tests
Apr 12, 2019
3ec8b22
Revert "fix: remove legacy code related to old structure of android p…
Fatme Apr 12, 2019
de8f649
fix: support custom tagged android runtime versions
Fatme Apr 12, 2019
f057e90
Merge pull request #4531 from NativeScript/fatme/revert-android-old-s…
Apr 12, 2019
b211403
Merge branch 'release' into fatme/merge-release-in-master
Fatme Apr 12, 2019
3267539
Merge pull request #4532 from NativeScript/fatme/merge-release-in-master
Apr 12, 2019
19fa242
fix: stop handling SIGINT signal
rosen-vladimirov Apr 10, 2019
b820bc5
fix: kill leaked analytics process
rosen-vladimirov Apr 10, 2019
4d848ab
feat: introduce cleanup child process
rosen-vladimirov Apr 10, 2019
6028eae
feat: improve cleanup service
rosen-vladimirov Apr 11, 2019
0ce13f5
fix: replace processService with cleanupService
rosen-vladimirov Apr 11, 2019
b97f5aa
chore: remove `$timers`
rosen-vladimirov Apr 12, 2019
916b17e
docs: update PublicAPI for cleanupService
rosen-vladimirov Apr 12, 2019
6e366d8
chore: remove already implemented TODO
rosen-vladimirov Apr 12, 2019
ce2a801
feat: allow setting timeout when using childProcess
rosen-vladimirov Apr 12, 2019
9a6b0f2
feat: add timeout for each cleanup process
rosen-vladimirov Apr 12, 2019
d17998b
chore: add changelog for 5.3.2 release
Fatme Apr 15, 2019
8084cac
chore: remove unused object from httpClient
rosen-vladimirov Apr 15, 2019
531bfda
chore: remove forgotten TODO
rosen-vladimirov Apr 15, 2019
5744075
fix: cleanup all resources used by lockService
rosen-vladimirov Apr 15, 2019
1b8a954
chore: rename interfaces for cleanup
rosen-vladimirov Apr 15, 2019
2906020
fix: do not remove ports forwarding for Android on cleanup
rosen-vladimirov Apr 15, 2019
2d32053
fix: handle disposing of cleanup-process
rosen-vladimirov Apr 15, 2019
9ab9639
Merge pull request #4536 from NativeScript/fatme/changelog-5.3.2
Apr 15, 2019
f8b0948
fix(cli-message): Shows an appropriate message with the --path option
jamesgeorge007 Apr 16, 2019
8525296
Minor fix :construction:
jamesgeorge007 Apr 16, 2019
1f5f160
Fix linting error :construction:
jamesgeorge007 Apr 16, 2019
994fddc
Merge pull request #4538 from jamesgeorge007/hotfix/show-right-messag…
Apr 16, 2019
59a7310
Merge pull request #4533 from NativeScript/vladimirov/fix-ctrl-c
rosen-vladimirov Apr 16, 2019
d255b97
feat: deprecate the legacy workflow and recommend the new one
DimitarTachev Apr 18, 2019
dfbc087
fix: recommend the new workflow before executing run/test/debug/prepa…
DimitarTachev Apr 18, 2019
28390c1
fix: fix upload to appstore for accounts without 2 factor authentication
Fatme Apr 18, 2019
ace53e5
fix: handle CLI usage as a library
DimitarTachev Apr 19, 2019
b2bd5b4
chore: fix PR comments
Fatme Apr 19, 2019
85843c6
Merge pull request #4547 from NativeScript/fatme/publish
Apr 19, 2019
f2d59a7
fix: add the initial version of the Legacy Workflow warnings and reco…
DimitarTachev Apr 19, 2019
d728b39
Merge branch 'release' into fatme/merge-release-5.3.3
Fatme Apr 22, 2019
afdb021
fix: prepare xcconfig files for all conigurations
rosen-vladimirov Apr 23, 2019
f9be51d
chore: fix PR comments
DimitarTachev Apr 23, 2019
a2d1098
chore: set version to 5.3.4
rosen-vladimirov Apr 23, 2019
53d0741
Merge pull request #4559 from NativeScript/vladimirov/prepare-xcconfi…
rosen-vladimirov Apr 23, 2019
5b35f2f
docs: remove obsolete HMR steps
NickIliev Apr 24, 2019
5957657
docs: remove BETA statement for HMR status
NickIliev Apr 24, 2019
713855f
Merge pull request #4557 from NativeScript/fatme/merge-release-5.3.3
Apr 24, 2019
8b83f91
Merge pull request #4546 from NativeScript/tachev/legacy-workflow-war…
Apr 24, 2019
ed965e7
chore: add changelog for 5.3.3 and 5.3.4
Fatme Apr 24, 2019
61d77ac
fix: use proxy only for remote requests
martinfrancois Apr 24, 2019
8f9178f
fix: fix the workflow warnings split on Windows (always split by "\n"…
DimitarTachev Apr 25, 2019
9283d29
Merge pull request #4566 from NativeScript/tachev/fix-workflow-warnin…
Apr 25, 2019
995258b
Merge pull request #4564 from NativeScript/fatme/change-log-5.3.4
Fatme Apr 25, 2019
7fdb7b7
feat: initial work on watch app integration
KristianDD Apr 18, 2019
25bf41a
refactor: extract common logic for watch app and extensions
KristianDD Apr 19, 2019
57a97a3
fix: code signing for apps with watchapp
KristianDD Apr 23, 2019
3c08232
refactor: extract more common logic for extension and watchapp
KristianDD Apr 23, 2019
1723a67
refactor: extract some constants
KristianDD Apr 24, 2019
ac311ec
chore: update pbxproj libraries
KristianDD Apr 25, 2019
4b69bb3
fix: no way to control watchos deployment target
KristianDD Apr 25, 2019
be2ee2a
chore: remove unnecessary code
KristianDD Apr 25, 2019
2e5a7e9
chore: fix tests
KristianDD Apr 25, 2019
74ace6b
fix: wrong check for watchapp folder
KristianDD Apr 25, 2019
e260a59
chore: add changelog for 5.3.1 release
Fatme Apr 29, 2019
ef73740
Merge pull request #4572 from NativeScript/fatme/changelog-5.3.1
Fatme Apr 30, 2019
0468853
fix: logcat process is not restarted in some cases
rosen-vladimirov Apr 30, 2019
a28b41b
Merge pull request #4565 from martinfrancois/fixProxyLocalRequests
Fatme Apr 30, 2019
873d82b
Merge pull request #4573 from NativeScript/vladimirov/fix-android-logs-2
rosen-vladimirov May 2, 2019
77f4947
Merge branch 'release' into fatme/merge-release-5.3.4
Fatme May 2, 2019
646f7a7
Merge pull request #4577 from NativeScript/fatme/merge-release-5.3.4
May 2, 2019
8e6f70e
fix: fix the order of applying Podfiles
rosen-vladimirov May 2, 2019
3e586f2
feat: allow executing JS funcitons on cleanup
rosen-vladimirov Apr 21, 2019
395e476
feat: show deprecated messages for things that will be dropped as of …
Fatme Apr 30, 2019
66ce514
Merge pull request #4581 from NativeScript/vladimirov/improve-cleanup
rosen-vladimirov May 7, 2019
d5725e0
fix PR comments
Fatme May 7, 2019
c32139a
Merge pull request #4578 from NativeScript/fatme/deprecated-messages
Fatme May 7, 2019
9ad0ac8
chore: remove the deprecation message for `--bundle` option
Fatme May 7, 2019
1ad9786
Merge pull request #4568 from NativeScript/kddimitrov/watch-app
KristianDD May 7, 2019
a3128cd
Merge pull request #4588 from NativeScript/fatme/remove-message-for-b…
Fatme May 7, 2019
7a79e78
Merge pull request #4563 from NativeScript/niliev/update-hmr-section
May 7, 2019
b606213
chore: update watchapp beta warning
KristianDD May 7, 2019
3baf93a
Merge pull request #4590 from NativeScript/kddimitrov/update-watchapp…
KristianDD May 8, 2019
bd73657
fix: target argument passed to xcodebuild when using workspace
KristianDD May 8, 2019
f031e8d
Merge pull request #4594 from NativeScript/kddimitrov/fix-cocoa-build…
KristianDD May 8, 2019
2ea0b5e
Merge pull request #4579 from NativeScript/vladimirov/apply-cocoapods…
rosen-vladimirov May 8, 2019
8207834
fix (test command): generate source maps when debug-brk is set
DimitarTachev May 8, 2019
84a516c
Merge pull request #4597 from NativeScript/tachev/fix-test-source-maps
May 8, 2019
f8443f8
fix: ensure analytics and cleanup processes are not leaking
rosen-vladimirov May 8, 2019
8e108ea
fix: do not send hot updates when debugBrk is set as we will restart …
DimitarTachev May 8, 2019
3a3d3bf
Merge pull request #4599 from NativeScript/vladimirov/fix-leaking-pro…
rosen-vladimirov May 8, 2019
a3850dc
chore: delete unused progress-indicator
rosen-vladimirov May 1, 2019
02d6dfb
chore: remove `printMsgWithTimeout` from logger
rosen-vladimirov May 1, 2019
822173a
chore: rename initService to projectInitService
rosen-vladimirov May 3, 2019
5169829
feat: expose logger and enable configuring it
rosen-vladimirov May 3, 2019
86dd22a
feat: introduce initializeService
rosen-vladimirov May 3, 2019
449e8a7
fix: use correct method for showing all warnings on initialize
rosen-vladimirov May 3, 2019
b28f5be
feat: use only log4js methods in CLI logger
rosen-vladimirov May 7, 2019
e874d33
chore: handle changes in logger API
rosen-vladimirov May 7, 2019
4f1d7a8
chore: remove write method from logger
rosen-vladimirov May 7, 2019
8b65272
chore: use correct interfaces for appenders
rosen-vladimirov May 7, 2019
9509b74
docs: add information for logger in Public API
rosen-vladimirov May 7, 2019
296dbe9
Merge pull request #4600 from NativeScript/tachev/fix-debug-brk-hmr
May 8, 2019
9bff5a0
chore: handle PR comments
rosen-vladimirov May 8, 2019
194106c
feat: improve initialization service
rosen-vladimirov May 8, 2019
09b6908
Merge pull request #4592 from NativeScript/vladimirov/expose-logger
rosen-vladimirov May 8, 2019
ae4abbd
fix: logger changes broke trace and some hooks
rosen-vladimirov May 9, 2019
31e49d7
Merge pull request #4601 from NativeScript/vladimirov/fix-logger
rosen-vladimirov May 9, 2019
f63195a
chore: set version to 6.0.0
rosen-vladimirov May 9, 2019
f9424dc
chore: set version to 5.4.1
rosen-vladimirov May 9, 2019
7fcece8
Merge pull request #4605 from NativeScript/vladimirov/version-6
rosen-vladimirov May 9, 2019
6ddcc2f
style: misleading warning message
tgpetrov May 10, 2019
2e5ca3c
Merge pull request #4609 from NativeScript/tgpetrov-patch-1
May 10, 2019
7d3302f
fix: make logger backwards compatible
rosen-vladimirov May 10, 2019
201c2be
Merge pull request #4610 from NativeScript/vladimirov/backwards-compa…
May 13, 2019
f8a6d0f
Merge remote-tracking branch 'origin/release' into vladimirov/merge-r…
rosen-vladimirov May 13, 2019
66daa62
Merge pull request #4612 from NativeScript/vladimirov/merge-rel-master
rosen-vladimirov May 13, 2019
beb69e9
chore: update nativescript-dev-xcode to 0.2.0
KristianDD May 13, 2019
d62f84a
Merge pull request #4613 from NativeScript/kddimitrov/update-nativesc…
KristianDD May 13, 2019
3be9e81
fix: set correct link for legacy workflow warning
rosen-vladimirov May 13, 2019
2376eea
Merge pull request #4615 from NativeScript/vladimirov/fix-links
rosen-vladimirov May 13, 2019
936cdff
fix: plugin create command needs more args for plugin seed
rosen-vladimirov May 13, 2019
c3e16d6
Merge pull request #4614 from NativeScript/vladimirov/fix-plugin-create
rosen-vladimirov May 13, 2019
d969467
docs: update changelog for 5.4.0 release
rosen-vladimirov May 15, 2019
fa18afc
Merge pull request #4621 from NativeScript/vladimirov/changelog-540
rosen-vladimirov May 15, 2019
b859af0
Merge pull request #4622 from NativeScript/release-patch
rosen-vladimirov May 16, 2019
f92d24a
chore: merge release in master
rosen-vladimirov May 16, 2019
a4cb42c
Merge pull request #4625 from NativeScript/vladimirov/merge-rel-master
May 16, 2019
255ccfa
feat: add vue drawer navigation template to create project command
May 27, 2019
6343541
Merge pull request #4652 from NativeScript/hristova/add-drawer-naviga…
elena-p May 28, 2019
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
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,61 @@
NativeScript CLI Changelog
================


5.4.0 (2019, May 15)
==

### Implemented
* [Implemented #3993](https://github.com/NativeScript/nativescript-cli/issues/3993): Improve `ctrl + c` handling.
* [Implemented #4374](https://github.com/NativeScript/nativescript-cli/issues/4374): Add `iCloudContainerEnvironment` build option.
* [Implemented #4394](https://github.com/NativeScript/nativescript-cli/issues/4394): Enable Using Hot Module Replacement by Default for New Projects
* [Implemented #4518](https://github.com/NativeScript/nativescript-cli/issues/4518): Show deprecation messages for things that will be dropped for 6.0.0 release
* [Implemented #4541](https://github.com/NativeScript/nativescript-cli/issues/4541): [Beta] Allow integration of Apple Watch application in NativeScript app
* [Implemented #4548](https://github.com/NativeScript/nativescript-cli/issues/4548): Deprecate support for the Legacy Workflow
* [Implemented #4602](https://github.com/NativeScript/nativescript-cli/issues/4602): Streamline CLI's logger


### Fixed
* [Fixed #4280](https://github.com/NativeScript/nativescript-cli/issues/4280): Incorrect message if you delete app's folder and run command with `--path` in it
* [Fixed #4512](https://github.com/NativeScript/nativescript-cli/issues/4512): App's Podfile should be applied last
* [Fixed #4573](https://github.com/NativeScript/nativescript-cli/pull/4573): logcat process is not restarted in some cases
* [Fixed #4593](https://github.com/NativeScript/nativescript-cli/issues/4593): Node.js processes not killed after `tns create` on macOS when analytics are enabled
* [Fixed #4598](https://github.com/NativeScript/nativescript-cli/issues/4598): app.css changes don't apply when debugging with --debug-brk
* [Fixed #4606](https://github.com/NativeScript/nativescript-cli/issues/4606): Unable to build application for iOS with nativescript-bottombar
* [Fixed #4616](https://github.com/NativeScript/nativescript-cli/issues/4616): `tns plugin create` command hangs

5.3.4 (2019, April 24)
==

### Fixed
* [Fixed #4561](https://github.com/NativeScript/nativescript-cli/issues/4561): CLI merges xcconfig files only for specified build configuration

5.3.3 (2019, April 23)
==

### Fixed
* [Fixed #4527](https://github.com/NativeScript/nativescript-cli/issues/4527): Unable to upload applications to App Store

5.3.2 (2019, April 12)
==

### Fixed
* [Fixed #1798](https://github.com/NativeScript/nativescript-cli/issues/1798): Test init command doesn't add a sample test in TypeScript for TypeScript/Angular projects
* [Fixed #4498](https://github.com/NativeScript/nativescript-cli/pull/4498): API: Change the AppStore ids for kinvey scanner and preview app
* [Fixed #4504](https://github.com/NativeScript/nativescript-cli/issues/4504): Custom tagged versions of android runtime are not supported
* [Fixed #4510](https://github.com/NativeScript/nativescript-cli/pull/4510): Handle HTTP 304 response status code

5.3.1 (2019, April 03)
==

### Implemented
* [Implemented #4492](https://github.com/NativeScript/nativescript-cli/pull/4492): API(kinvey): provide correct data to preview-sdk based on the schema

### Fixed
* [Fixed #4370](https://github.com/NativeScript/nativescript-cli/issues/4370): NativeScript CLI installation fails on linux
* [Fixed #4451](https://github.com/NativeScript/nativescript-cli/issues/4451): Error while trying to start application on Android emulator with API level Q
* [Fixed #4483](https://github.com/NativeScript/nativescript-cli/pull/4483): Detection fixes for emulator/device

5.3.0 (2019, March 27)
==

Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ module.exports = function (grunt) {
});
grunt.registerTask("lint", ["tslint:build"]);
grunt.registerTask("all", ["clean", "test", "lint"]);
grunt.registerTask("rebuild", ["clean", "ts:devlib"]);
grunt.registerTask("rebuild", ["clean", "default"]);
grunt.registerTask("default", ["ts:devlib", "generate_unit_testing_dependencies"]);
grunt.registerTask("docs-jekyll", ['template']);
};
Expand Down
207 changes: 207 additions & 0 deletions PublicAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ const tns = require("nativescript");
* [deviceLog](#devicelog)
* [previewQrCodeService](#previewqrcodeservice)
* [getPlaygroundAppQrCode](#getplaygroundappqrcode)
* [cleanupService](#cleanupservice)
* [setCleanupLogFile](#setcleanuplogfile)
* [initializeService](#initializeService)
* [initialize](#initialize)
* [logger](#logger)
* [initialize](#initialize)
* [getLevel](#getlevel)
* [appenders](#appenders)
* [emit-appender](#emit-appender)
* [cli-appender](#cli-appender)
* [custom layouts](#custom-layouts)


## Module projectService

Expand Down Expand Up @@ -1487,6 +1499,201 @@ tns.previewQrCodeService.getPlaygroundAppQrCode()
});
```

## cleanupService
The `cleanupService` is used to handle actions that should be executed after CLI's process had exited. This is an internal service, that runs detached childProcess in which it executes CLI's cleanup actions once CLI is dead. As the process is detached, logs from it are not shown anywhere, so the service exposes a way to add log file in which the child process will write its logs.

### setCleanupLogFile
Defines the log file location where the child cleanup process will write its logs.

> NOTE: You must call this method immediately after requiring NativeScript CLI. In case you call it after the cleanup process had started, it will not use the passed log file.

* Definition
```TypeScript
/**
* Sets the file in which the cleanup process will write its logs.
* This method must be called before starting the cleanup process, i.e. when CLI is initialized.
* @param {string} filePath Path to file where the logs will be written. The logs are appended to the passed file.
* @returns {void}
*/
setCleanupLogFile(filePath: string): void;
```

* Usage
```JavaScript
const tns = require("nativescript");
tns.cleanupService.setCleanupLogFile("/Users/username/cleanup-logs.txt");
```

## initializeService
The `initializeService` is used to initialize CLI's configuration at the beginning and print all warnings related to current environment.

### initialize
This method executes initialization actions based on the passed parameters. In case `loggerOptions` are not passed, the default CLI logger will be used.
After initialization, the method will print all system warnings.

* Definition
```TypeScript
interface IInitializeOptions {
loggerOptions?: ILoggerOptions;
settingsServiceOptions?: IConfigurationSettings;
extensibilityOptions?: { pathToExtensions: string };
}

interface IInitializeService {
initialize(initOpts?: IInitializeOptions): Promise<void>;
}

```

> NOTE: For more information about loggerOptions, you can check `logger`.

* Usage
* Initialization without passing any data - `logger` will be initialized with default CLI settings. Warnings will be printed if there are any.
```JavaScript
const tns = require("nativescript");
tns.initializeService.initialize();
```
* Initialize with custom settings service options:
```JavaScript
const tns = require("nativescript");
tns.initializeService.initialize({ settingsServiceOptions: { profileDir: "/Users/username/customDir", userAgentName: "MyApp" } });
```
* Initialize with custom extensibility path:
```JavaScript
const tns = require("nativescript");
tns.initializeService.initialize({ extensibilityOptions: { pathToExtensions: "/Users/username/customDir/extensions" } });
```

## logger

`logger` module is used to show any kind of information to the user. The `logger` uses `log4js` internally, which allows setting different levels for the messages.
The levels are available in `tns.constants.LoggerLevel` enum. Only messages from the current log level (or higher) are shown to the user, i.e. in case the log level is set to `INFO`, `DEBUG` and `TRACE` messages will not be shown to the user, but `WARN` and `ERROR` messages will be shown. </br>
`logger` module can be configured how to show the messages by using different appenders and layouts. </br>
* `appenders` are responsible for output of log events. They may write events to files, send emails, store them in a database, or anything. Most appenders use layouts to serialise the events to strings for output.
* `layout` is a function for converting a LogEvent into a string representation.

`log4js` has predefined appenders and layouts that can be used. In case you do not pass any options to logger's initialization, CLI will default to [console appender](https://log4js-node.github.io/log4js-node/console.html) with [messagePassThrough layout](https://log4js-node.github.io/log4js-node/layouts.html#message-pass-through) with `INFO` log level.</br>
You can override only the properties you want, i.e. only the log level, the layout or the appender. </br>
`nativescript` itself has additional appenders that you can use. More information about them can be found below. You can get a full list of the available appenders by checking the `tns.constants.LoggerAppenders` object. </br>

> NOTE: When CLI is used as a command-line tool, it uses a custom appender and layout in order to write coloured messages to stdout or stderr.

### initialize
The `initialize` method initializes the log4js settings - level, appender and layout. Once called, the settings cannot be changed anymore for the current process.

* Definition
```TypeScript
interface IAppenderOptions extends IDictionary<any> {
type: string;
layout?: Layout;
}

interface ILoggerOptions {
level?: LoggerLevel;
appenderOptions?: IAppenderOptions;
}

initialize(opts?: ILoggerOptions): void;
```

* Usage
* Initialize with default settings:
```JavaScript
tns.logger.initialize();
```
* Initialize with DEBUG log level:
```JavaScript
tns.logger.initialize({ level: tns.constants.LoggerLevel.DEBUG });
```
* Initialize with different appender, for example [fileSync](https://log4js-node.github.io/log4js-node/fileSync.html) appender:
```JavaScript
tns.logger.initialize({ appenderOptions: { type: "fileSync" } });
```
* Initialize with different layout, for example [Pattern](https://log4js-node.github.io/log4js-node/layouts.html#pattern) layout:
```JavaScript
tns.logger.initialize({ appenderOptions: { layout: { type: "pattern" } } });
```
* Initialize with custom appender, layout and level:
```JavaScript
tns.logger.initialize({ appenderOptions: { type: "fileSync", layout: { type: "pattern" } }, level: tns.constants.LoggerLevel.DEBUG });
```

### getLevel
This method returns information for the current log level.

* Definition
```TypeScript
getLevel(): string;
```

* Usage
```JavaScript
console.log(`Current log level is: ${tns.logger.getLevel()}`);
```

### appenders
The `appenders` are log4js concept. `appenders` are responsible for output of log events. You can use all predefined [log4js appenders](https://log4js-node.github.io/log4js-node/appenders.html) and also several predefined CLI appenders

#### emit-appender
The `emit-appender` is used to emit the log events through a passed emitter instead of writing the messages. Whenever a message should be shown, the `emit-appender` emits `logData` event with an object containing the `loggingEvent` and the message passed through the specified layout stored in `formattedMessage` property.

* Usage:
```JavaScript
const tns = require("nativescript");
const { EventEmitter } = require("events");
const { EMIT_APPENDER_EVENT_NAME, LoggerAppenders } = tns.constants;
const emitter = new EventEmitter();
// IMPORTANT: Add the event handler before calling logger's initialize method.
// This is required as log4js makes a copy of the appenderOptions, where the emitter is passed
// NOTE: In case you want to debug the event handler, place `debugger` in it.
emitter.on(EMIT_APPENDER_EVENT_NAME, (logData) => {
if (logData.loggingEvent.level.levelStr === LoggerLevel.WARN) {
console.log(`WARNING: ${logData.formattedMessage}`);
}
});

const logger = tns.logger;
logger.initialize({
appenderOptions: {
type: LoggerAppenders.emitAppender,
emitter
}
});
```

> NOTE: In several cases CLI passes additional configuration properties in the `context` of the `loggingEvent`. Full list is available in the `tns.constants.LoggerConfigData` object. These properties are used by CLI's layout and appender to change the way the message is printed on the terminal and if it should be on stderr or stdout.

#### cli-appender
`cli-appender` prints messages to stdout or stderr based on the passed options for the message.

* Usage
```JavaScript
const tns = require("nativescript");
const { EventEmitter } = require("events");
const { EMIT_APPENDER_EVENT_NAME, LoggerAppenders } = tns.constants;

const logger = tns.logger;
logger.initialize({
appenderOptions: {
type: LoggerAppenders.cliAppender,
}
});
```

### custom layouts
You can define your own layout function in the following way:
```JavaScript
const log4js = require("nativescript/node_modules/log4js");
const util = require("util");
log4js.addLayout("myCustomLayout", (config) => {
return (loggingEvent) => {
return util.format.apply(null, loggingEvent.data);
}
});

tns.logger.initialize({ appenderOptions: { layout: { type: "myCustomLayout" } } });
```

## How to add a new method to Public API
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.
For example the `$options` injected module contains information about all `--` options passed on the terminal. When the CLI is used as a library, the options are not populated. Before adding method to public API, make sure its implementation does not rely on `$options`.
Expand Down
20 changes: 20 additions & 0 deletions config/test-dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,25 @@
{
"name": "karma-qunit",
"framework": "qunit"
},
{
"name": "@types/karma-chai",
"framework": "mocha",
"projectType": ".ts"
},
{
"name": "@types/mocha",
"framework": "mocha",
"projectType": ".ts"
},
{
"name": "@types/jasmine",
"framework": "jasmine",
"projectType": ".ts"
},
{
"name": "@types/qunit",
"framework": "qunit",
"projectType": ".ts"
}
]
6 changes: 4 additions & 2 deletions docs/build-jekyll-md.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ rm -rf docs-cli
npm install --ignore-scripts

grunt docs-jekyll
cd docs-cli
mv index.md start.md
if [ -d docs-cli ]; then
cd docs-cli
mv index.md start.md
fi
2 changes: 2 additions & 0 deletions docs/man_pages/lib-management/plugin-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Create from a custom plugin seed | `$ tns plugin create <Plugin Repository Name>
* `--path` - Specifies the directory where you want to create the project, if different from the current directory.
* `--username` - Specifies the Github username, which will be used to build the URLs in the plugin's package.json file.
* `--pluginName` - Used to set the default file and class names in the plugin source.
* `--includeTypeScriptDemo` - Specifies if TypeScript demo should be created. Default value is `y` (i.e. `demo` will be created), in case you do not want to create this demo, pass `--includeTypeScriptDemo=n`
* `--includeAngularDemo` - Specifies if Angular demo should be created. Default value is `y` (i.e. `demo-angular` will be created), in case you do not want to create this demo, pass `--includeAngularDemo=n`
* `--template` - Specifies the custom seed archive, which you want to use to create your plugin. If `--template` is not set, the NativeScript CLI creates the plugin from the default NativeScript Plugin Seed. `<Template>` can be a URL or a local path to a `.tar.gz` file with the contents of a seed repository.<% if(isHtml) { %> This must be a clone of the [NativeScript Plugin Seed](https://github.com/NativeScript/nativescript-plugin-seed) and must contain a `src` directory with a package.json file and a script at `src/scripts/postclone.js`. After the archive is extracted, the postclone script will be executed with the username (`gitHubUsername`) and plugin name (`pluginName`) parameters given to the `tns plugin create` command prompts. For more information, visit the default plugin seed repository and [examine the source script](https://github.com/NativeScript/nativescript-plugin-seed/blob/master/src/scripts/postclone.js) there. Examples:

* Using a local file:
Expand Down
3 changes: 2 additions & 1 deletion docs/man_pages/project/creation/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Template | Command
`Angular - Hello World`, `--ng`, `--angular` | tns create tns-template-hello-world-ng
`Angular - SideDrawer` | tns create tns-template-drawer-navigation-ng
`Angular - Tabs` | tns create tns-template-tab-navigation-ng
`Vue.js`, `--vue`, `--vuejs` | tns create tns-template-blank-vue
`Vue.js - Blank`, `--vue`, `--vuejs` | tns create tns-template-blank-vue
`Vue.js - SideDrawer`, | tns create tns-template-drawer-navigation-vue

### Related Commands

Expand Down
8 changes: 7 additions & 1 deletion docs/man_pages/project/testing/build-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ General | `$ tns build android [--compileSdk <API Level>] [--key-store-path <Fil
* `--key-store-alias-password` - Provides the password for the alias specified with `--key-store-alias-password`. You can use the `--key-store-*` options along with `--release` to produce a signed release build. You need to specify all `--key-store-*` options.
* `--copy-to` - Specifies the file path where the built `.apk` will be copied. If it points to a non-existent directory path, it will be created. If the specified value is existing directory, the original file name will be used.
* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application.
* `--env.*` - Specifies additional flags that the bundler may process. May be passed multiple times. For example: `--env.uglify --env.snapshot`.
* `--env.*` - Specifies additional flags that the bundler may process. May be passed multiple times. Supported additional flags:
* `--env.aot` - creates Ahead-Of-Time build (Angular only).
* `--env.snapshot`- creates [Snapshot](https://docs.nativescript.org/performance-optimizations/bundling-with-webpack#v8-heap-snapshot) (only for release builds on Mac OS & for Android).
* `--env.uglify` - provides basic obfuscation and smaller app size.
* `--env.report` - creates a Webpack report inside a `report` folder in the root folder.
* `--env.sourceMap` - creates inline source maps (useful for debbuging bundled app).
* `--env.hiddenSourceMap` - creates sources maps in the root folder (useful for Crashlytics usage with bundled app in release).
* `--aab` - Specifies that the build will produce an Android App Bundle(`.aab`) file.

<% if(isHtml) { %>
Expand Down
Loading