Skip to content

Commit 2a78457

Browse files
Merge pull request #5280 from NativeScript/vladimirov/merge-rel-master
chore: merge release in master
2 parents a2da3d0 + 97089d0 commit 2a78457

18 files changed

+112
-27
lines changed

CHANGELOG.md

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

4-
6.4.1 (2020, February 19)
4+
6.4.1 (2020, February 21)
55
===
66

7+
### New
8+
9+
* [Implemented #5255](https://github.com/NativeScript/nativescript-cli/issues/5255): Warn if the CLI might print sensitive data to the output
10+
711
### Fixed
812

913
* [Fixed #5236](https://github.com/NativeScript/nativescript-cli/issues/5236): File paths from device logs are not clickable
1014
* [Fixed #5251](https://github.com/NativeScript/nativescript-cli/issues/5251): External files are not livesynced
1115
* [Fixed #5252](https://github.com/NativeScript/nativescript-cli/issues/5252): Logs from platform specific files point to incorrect file
16+
* [Fixed #5259](https://github.com/NativeScript/nativescript-cli/issues/5259): Unable to use pnpm on macOS and Linux
17+
* [Fixed #5260](https://github.com/NativeScript/nativescript-cli/issues/5260): `tns package-manager set invalid_value` does not say pnpm is supported
18+
* [Fixed #5261](https://github.com/NativeScript/nativescript-cli/issues/5261): `tns package-manager set <valid value>` does not give any output
19+
* [Fixed #5262](https://github.com/NativeScript/nativescript-cli/issues/5262): `tns package-manager` fails with error
20+
* [Fixed #5263](https://github.com/NativeScript/nativescript-cli/issues/5263): `tns package-manager` docs does not list pnpm as supported value
21+
* [Fixed #5264](https://github.com/NativeScript/nativescript-cli/issues/5264): `tns package-manager --help` fails with error
1222

1323

1424
6.4.0 (2020, February 11)

docs/man_pages/general/package-manager-get.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ General | `$ tns package-manager get`
2121

2222
Command | Description
2323
----------|----------
24-
[package-manager-set](package-manager-set.html) | Enables the specified package manager for the NativeScript CLI. Supported values are npm and yarn.
24+
[package-manager-set](package-manager-set.html) | Enables the specified package manager for the NativeScript CLI. Supported values are npm, yarn and pnpm.
25+
[package-manager-get](package-manager-get.html) | Prints the value of the current package manager.
2526
<% } %>

docs/man_pages/general/package-manager-set.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ position: 18
77

88
### Description
99

10-
Enables the specified package manager for the NativeScript CLI. Supported values are npm and yarn.
10+
Enables the specified package manager for the NativeScript CLI. Supported values are npm, yarn and pnpm.
1111

1212
### Commands
1313

@@ -17,7 +17,7 @@ General | `$ tns package-manager set <PackageManager>`
1717

1818
### Arguments
1919

20-
* `<PackageManager>` is the name of the package manager. Supported values are npm and yarn.
20+
* `<PackageManager>` is the name of the package manager. Supported values are npm, yarn and pnpm.
2121

2222
<% if(isHtml) { %>
2323

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<% if (isJekyll) { %>---
2+
title: tns package-manager get
3+
position: 19
4+
---<% } %>
5+
6+
# tns package-manager get
7+
8+
### Description
9+
10+
Prints the value of the current package manager.
11+
12+
### Commands
13+
14+
Usage | Synopsis
15+
------|-------
16+
General | `$ tns package-manager get`
17+
18+
<% if(isHtml) { %>
19+
20+
### Related Commands
21+
22+
Command | Description
23+
----------|----------
24+
[package-manager-set](package-manager-set.html) | Enables the specified package manager for the NativeScript CLI. Supported values are npm, yarn and pnpm.
25+
<% } %>

docs/man_pages/start.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Command | Description
2323
[proxy](general/proxy.html) | Displays proxy settings.
2424
[migrate](general/migrate.html) | Migrates the app dependencies to a form compatible with NativeScript 6.0.
2525
[update](general/update.html) | Updates the project with the latest versions of iOS/Android runtimes and cross-platform modules.
26+
[package-manager](general/package-manager.html) | Prints the value of the current package manager.
2627

2728
## Project Development Commands
2829
Command | Description

lib/bootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ $injector.requirePublic("packageManager", "./package-manager");
113113
$injector.requirePublic("npm", "./node-package-manager");
114114
$injector.requirePublic("yarn", "./yarn-package-manager");
115115
$injector.requirePublic("pnpm", "./pnpm-package-manager");
116+
$injector.requireCommand("package-manager|*get", "./commands/package-manager-get");
116117
$injector.requireCommand("package-manager|set", "./commands/package-manager-set");
117-
$injector.requireCommand("package-manager|get", "./commands/package-manager-get");
118118

119119
$injector.require("packageInstallationManager", "./package-installation-manager");
120120

lib/common/commands/package-manager-get.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export class PackageManagerGetCommand implements ICommand {
1515
}
1616

1717
const result = await this.$userSettingsService.getSettingValue("packageManager");
18-
this.$logger.info(`Your current package manager is ${result || "npm"}.`);
18+
this.$logger.printMarkdown(`Your current package manager is \`${result || "npm"}\`.`);
1919
}
2020
}
2121

22-
$injector.registerCommand("package-manager|get", PackageManagerGetCommand);
22+
$injector.registerCommand("package-manager|*get", PackageManagerGetCommand);

lib/common/commands/package-manager-set.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1+
import { PackageManagers } from "../../constants";
12

23
export class PackageManagerCommand implements ICommand {
34

45
constructor(private $userSettingsService: IUserSettingsService,
56
private $errors: IErrors,
7+
private $logger: ILogger,
68
private $stringParameter: ICommandParameter) { }
79

810
public allowedParameters: ICommandParameter[] = [this.$stringParameter];
911

10-
public execute(args: string[]): Promise<void> {
11-
if (args[0] === 'yarn') {
12-
return this.$userSettingsService.saveSetting("packageManager", "yarn");
13-
} else if (args[0] === 'pnpm') {
14-
return this.$userSettingsService.saveSetting("packageManager", "pnpm");
15-
} else if (args[0] === 'npm') {
16-
return this.$userSettingsService.saveSetting("packageManager", "npm");
12+
public async execute(args: string[]): Promise<void> {
13+
const packageManagerName = args[0];
14+
const supportedPackageManagers = Object.keys(PackageManagers);
15+
if (supportedPackageManagers.indexOf(packageManagerName) === -1) {
16+
this.$errors.fail(`${packageManagerName} is not a valid package manager. Supported values are: ${supportedPackageManagers.join(", ")}.`);
1717
}
18-
return this.$errors.fail(`${args[0]} is not a valid package manager. Only yarn or npm are supported.`);
18+
19+
await this.$userSettingsService.saveSetting("packageManager", packageManagerName);
20+
21+
this.$logger.printMarkdown(`Please ensure you have the directory containing \`${packageManagerName}\` executable available in your PATH.`);
22+
this.$logger.printMarkdown(`You've successfully set \`${packageManagerName}\` as your package manager.`);
1923
}
2024
}
2125

lib/common/logger/logger.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ export class Logger implements ILogger {
4848
log4js.configure({ appenders, categories });
4949

5050
this.log4jsLogger = log4js.getLogger();
51+
if (level === LoggerLevel.TRACE || level === LoggerLevel.ALL) {
52+
this.warn(`The "${level}" log level might print some sensitive data like secrets or access tokens in request URLs. Be careful when you share this output.`, { wrapMessageWithBorders: true });
53+
}
5154
}
5255

5356
public initializeCliLogger(opts?: ILoggerOptions): void {

lib/common/services/help-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export class HelpService implements IHelpService {
183183

184184
private async convertCommandNameToFileName(commandData: ICommandData): Promise<string> {
185185
let { commandName } = commandData;
186-
const defaultCommandMatch = commandName && commandName.match(/(\w+?)\|\*/);
186+
const defaultCommandMatch = commandName && commandName.match(/([\w-]+?)\|\*/);
187187
if (defaultCommandMatch) {
188188
this.$logger.trace("Default command found. Replace current command name '%s' with '%s'.", commandName, defaultCommandMatch[1]);
189189
commandName = defaultCommandMatch[1];

0 commit comments

Comments
 (0)