-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba3293c
commit 5dbc780
Showing
26 changed files
with
1,206 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
// using chalk as some of our other dependencies are already using it... | ||
// exporting from here so we can easily refactor to a different color library if needed | ||
import * as ansi from "ansi-colors"; | ||
import * as chalk from "chalk"; | ||
|
||
export type Color = typeof chalk.Color; | ||
|
||
export function stripColors(formatStr: string) { | ||
return ansi.stripColor(formatStr); | ||
} | ||
|
||
export const color = chalk; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ICommand, ICommandParameter } from "../common/definitions/commands"; | ||
import { injector } from "../common/yok"; | ||
import { IStartService } from "../definitions/start-service"; | ||
|
||
export class StartCommand implements ICommand { | ||
constructor(private $startService: IStartService) {} | ||
async execute(args: string[]): Promise<void> { | ||
this.$startService.start(); | ||
return; | ||
} | ||
allowedParameters: ICommandParameter[]; | ||
async canExecute?(args: string[]): Promise<boolean> { | ||
return true; | ||
} | ||
} | ||
|
||
injector.registerCommand("start", StartCommand); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
export type IKeyCommandPlatform = "Android" | "iOS" | "all"; | ||
export type IKeysLowerCase = | ||
| "a" | ||
| "b" | ||
| "c" | ||
| "d" | ||
| "e" | ||
| "f" | ||
| "g" | ||
| "h" | ||
| "i" | ||
| "j" | ||
| "k" | ||
| "l" | ||
| "m" | ||
| "n" | ||
| "o" | ||
| "p" | ||
| "q" | ||
| "r" | ||
| "s" | ||
| "t" | ||
| "u" | ||
| "v" | ||
| "w" | ||
| "x" | ||
| "y" | ||
| "z"; | ||
|
||
export type IValidKeyCommands = IKeysLowerCase | `${Uppercase<IKeysLowerCase>}`; | ||
|
||
export interface IKeyCommandHelper { | ||
attachKeyCommands: ( | ||
platform: IKeyCommandPlatform, | ||
processType: SupportedProcessType | ||
) => void; | ||
|
||
addOverride(key: IValidKeyCommands, execute: () => Promise<boolean>); | ||
removeOverride(key: IValidKeyCommands); | ||
printCommands(platform: IKeyCommandPlatform): void; | ||
} | ||
|
||
export type SupportedProcessType = "start" | "run"; | ||
|
||
export interface IKeyCommand { | ||
key: IValidKeyCommands; | ||
platform: IKeyCommandPlatform; | ||
description: string; | ||
willBlockKeyCommandExecution?: boolean; | ||
execute(platform: string): Promise<void>; | ||
canExecute?: (processType: SupportedProcessType) => boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { color, stripColors } from "../color"; | ||
|
||
export function printHeader() { | ||
if (process.env.HIDE_HEADER) return; | ||
const version = "8.5.3"; | ||
const middle = [ | ||
color.dim("│ "), | ||
color.cyanBright.bold(" {N} NativeScript "), | ||
color.whiteBright.bold("CLI"), | ||
color.dim(` [v${version}] `), | ||
color.dim(" │"), | ||
].join(""); | ||
const middle2 = [ | ||
color.dim("│ "), | ||
color.whiteBright.bold(" Empowering JS with Native APIs "), | ||
color.dim(" │"), | ||
].join(""); | ||
|
||
const end = [color.dim("─┘")].join(""); | ||
|
||
const width = stripColors(middle).length; | ||
const endWidth = stripColors(end).length; | ||
console.info(" "); | ||
console.info(" " + color.dim("┌" + "─".repeat(width - 2) + "┐")); | ||
console.info(" " + middle); | ||
console.info(" " + middle2); | ||
console.info(" " + color.dim("└" + "─".repeat(width - endWidth - 1)) + end); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.