Skip to content

Commit

Permalink
feat: add 'ns' alias
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker authored and rigor789 committed Sep 4, 2020
1 parent 716d175 commit b0acd67
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion PublicAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Public API
This document describes all methods that can be invoked when NativeScript CLI is required as library, i.e.

```JavaScript
const tns = require("nativescript");
const ns = require("nativescript");
```

# Contents
Expand Down
3 changes: 3 additions & 0 deletions bin/ns
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require("./tns");
2 changes: 1 addition & 1 deletion lib/commands/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ can skip this prompt next time using the --template option, or the --ng, --react
const { projectDir } = this.createdProjectData;
const relativePath = path.relative(process.cwd(), projectDir);
this.$logger.printMarkdown(`Now you can navigate to your project with \`$ cd ${relativePath}\``);
this.$logger.printMarkdown(`After that you can preview it on device by executing \`$ tns preview\``);
this.$logger.printMarkdown(`After that you can preview it on device by executing \`$ ns preview\``);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/list-platforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ListPlatformsCommand implements ICommand {
} else {
const formattedPlatformsList = helpers.formatListOfNames(this.$platformCommandHelper.getAvailablePlatforms(this.$projectData), "and");
this.$logger.info("Available platforms for this OS: ", formattedPlatformsList);
this.$logger.info("No installed platforms found. Use $ tns platform add");
this.$logger.info("No installed platforms found. Use $ ns platform add");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class MigrateCommand implements ICommand {
});

if (!shouldMigrateResult) {
this.$logger.printMarkdown('__Project is compatible with NativeScript "v6.0.0". To get the latest NativeScript packages execute "tns update".__');
this.$logger.printMarkdown('__Project is compatible with NativeScript "v6.0.0". To get the latest NativeScript packages execute "ns update".__');
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/post-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class PostInstallCliCommand implements ICommand {
this.$logger.info("You have successfully installed the NativeScript CLI!".green.bold);
this.$logger.info("");
this.$logger.info("Your next step is to create a new project:");
this.$logger.info("tns create".green.bold);
this.$logger.info("ns create".green.bold);

this.$logger.info("");
this.$logger.printMarkdown("New to NativeScript?".bold + " Try the tutorials in NativeScript Playground: `https://play.nativescript.org`");
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/test-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class TestInitCommand implements ICommand {
this.$logger.info(`\nPlace your test files under ${relativeTestsDir}`.yellow);
}

this.$logger.info('Run your tests using the "$ tns test <platform>" command.'.yellow);
this.$logger.info('Run your tests using the "$ ns test <platform>" command.'.yellow);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ abstract class TestCommandBase {
const canStartKarmaServer = await this.$testExecutionService.canStartKarmaServer(this.$projectData);
if (!canStartKarmaServer) {
this.$errors.fail({
formatStr: "Error: In order to run unit tests, your project must already be configured by running $ tns test init.",
formatStr: "Error: In order to run unit tests, your project must already be configured by running $ ns test init.",
errorCode: ErrorCodes.TESTS_INIT_REQUIRED
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class UpdateCommand implements ICommand {
public allowedParameters: ICommandParameter[] = [];
public static readonly SHOULD_MIGRATE_PROJECT_MESSAGE = 'This project is not compatible with the current NativeScript version and cannot be updated. Use "tns migrate" to make your project compatible.';
public static readonly SHOULD_MIGRATE_PROJECT_MESSAGE = 'This project is not compatible with the current NativeScript version and cannot be updated. Use "ns migrate" to make your project compatible.';
public static readonly PROJECT_UP_TO_DATE_MESSAGE = 'This project is up to date.';

constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/common/commands/post-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class PostInstallCommand implements ICommand {
public allowedParameters: ICommandParameter[] = [];

public async execute(args: string[]): Promise<void> {
this.$errors.fail("This command is deprecated. Use `tns dev-post-install-cli` instead");
this.$errors.fail("This command is deprecated. Use `ns dev-post-install-cli` instead");
}
}
$injector.registerCommand("dev-post-install", PostInstallCommand);
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "nativescript",
"preferGlobal": true,
"version": "6.8.1-rc.0",
"version": "6.8.1-rc.1",
"author": "NativeScript <support@nativescript.org>",
"description": "Command-line interface for building NativeScript projects",
"bin": {
"tns": "./bin/tns",
"nativescript": "./bin/tns",
"nsc": "./bin/tns"
"nsc": "./bin/tns",
"ns": "./bin/tns"
},
"main": "./lib/nativescript-cli-lib.js",
"scripts": {
Expand Down

0 comments on commit b0acd67

Please sign in to comment.