Options
All
  • Public
  • Public/Protected
  • All
Menu

typescript-starter

Index

Variables

Const buildDir

buildDir: string = join(process.cwd(), 'build')

Const down

down: "" = ""

Const enter

enter: " " = " "

Const inherit

inherit: undefined | null | number | "pipe" | "ipc" | "ignore" | Stream = 'inherit' as StdIOOption

Const repoURL

repoURL: string = process.cwd()

NOTE: many of the tests below validate file modification. The filesystem is not mocked, and these tests make real changes. Proceed with caution.

Filesystem changes made by these tests should be contained in the build directory for easier clean up.

Const up

up: "" = ""

Functions

asyncABC

  • asyncABC(): Promise<ReadonlyArray<string>>
  • A sample async function (to demo Typescript's es7 async/await downleveling).

    Example (es imports)

    import { asyncABC } from 'typescript-starter'
    console.log(await asyncABC())
    // => ['a','b','c']
    

    Example (commonjs)

    var double = require('typescript-starter').asyncABC;
    asyncABC().then(console.log);
    // => ['a','b','c']
    

    Returns Promise<ReadonlyArray<string>>

    a Promise which should contain ['a','b','c']

checkArgs

Const cloneRepo

  • cloneRepo(spawner: ExecaStatic, suppressOutput?: boolean): (Anonymous function)
  • Parameters

    • spawner: ExecaStatic
    • Default value suppressOutput: boolean = false

    Returns (Anonymous function)

double

  • double(value: number): number
  • Multiplies a value by 2. (Also a full example of Typedoc's functionality.)

    Example (es module)

    import { double } from 'typescript-starter'
    console.log(double(4))
    // => 8
    

    Example (commonjs)

    var double = require('typescript-starter').double;
    console.log(double(4))
    // => 8
    
    anothernote

    Some other value.

    Parameters

    • value: number

      Comment describing the value parameter.

    Returns number

    Comment describing the return type.

Const getGithubUsername

  • getGithubUsername(fetcher: any): (Anonymous function)
  • Parameters

    • fetcher: any

    Returns (Anonymous function)

Const getInferredOptions

getIntro

  • getIntro(columns: number | undefined): string
  • Parameters

    • columns: number | undefined

    Returns string

Const getRepoUrl

  • getRepoUrl(): string

Const getUserInfo

  • getUserInfo(spawner: ExecaStatic): (Anonymous function)
  • Parameters

    • spawner: ExecaStatic

    Returns (Anonymous function)

Const hash

  • hash(t: ExecutionContext<__type>, input: string, expected: string): void
  • Parameters

    • t: ExecutionContext<__type>
    • input: string
    • expected: string

    Returns void

hashAllTheThings

  • hashAllTheThings(projectName: string, sandboxed?: boolean): Promise<object>

Const initialCommit

  • initialCommit(spawner: ExecaStatic): (Anonymous function)
  • Parameters

    • spawner: ExecaStatic

    Returns (Anonymous function)

inquire

Const install

  • install(spawner: ExecaStatic): (Anonymous function)
  • Parameters

    • spawner: ExecaStatic

    Returns (Anonymous function)

Const mockErr

  • mockErr(code?: string | number): ExecaStatic

Const ms

  • ms(milliseconds: number): Promise<void>

Const passUpdateNotifier

  • passUpdateNotifier(version: string): void

power

  • power(base: number, exponent: number): number
  • Raise the value of the first parameter to the power of the second using the es7 ** operator.

    Example (es module)

    import { power } from 'typescript-starter'
    console.log(power(2,3))
    // => 8
    

    Example (commonjs)

    var power = require('typescript-starter').power;
    console.log(power(2,3))
    // => 8
    

    Parameters

    • base: number
    • exponent: number

    Returns number

Const readPackageJson

  • readPackageJson(path: string): any

Const sandboxTasks

  • sandboxTasks(t: ExecutionContext<__type>, commit: boolean, install: boolean): Tasks

sha256

  • sha256(message: string): string
  • Calculate the sha256 digest of a string.

    Example (es imports)

    import { sha256 } from 'typescript-starter'
    sha256('test')
    // => '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
    

    Parameters

    • message: string

    Returns string

    sha256 message digest

sha256Native

  • sha256Native(message: string): string
  • A faster implementation of sha256 which requires the native Node.js module. Browser consumers should use sha256, instead.

    Example (es imports)

    import { sha256Native as sha256 } from 'typescript-starter'
    sha256('test')
    // => '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
    

    Parameters

    • message: string

    Returns string

    sha256 message digest

Const silenceConsole

  • silenceConsole(console: any): void

testInteractive

  • testInteractive(t: ExecutionContext<__type>, projectName: string, entry: ReadonlyArray<string | ReadonlyArray<string>>): Promise<ExecaReturns>
  • Parameters

    • t: ExecutionContext<__type>
    • projectName: string
    • entry: ReadonlyArray<string | ReadonlyArray<string>>

    Returns Promise<ExecaReturns>

typescriptStarter

  • typescriptStarter(__namedParameters: object, tasks: Tasks): Promise<void>
  • Parameters

    • __namedParameters: object
      • description: string
      • domDefinitions: boolean
      • email: string
      • fullName: string
      • githubUsername: string
      • immutable: boolean
      • install: boolean
      • nodeDefinitions: boolean
      • projectName: string
      • repoURL: string
      • runner: Runner
      • strict: boolean
      • vscode: boolean
      • workingDirectory: string
    • tasks: Tasks

    Returns Promise<void>

validateName

  • validateName(input: string): true | string
  • Parameters

    • input: string

    Returns true | string

Const writePackageJson

  • writePackageJson(path: string, pkg: any): void

Object literals

Const LiveTasks

LiveTasks: object

cloneRepo

cloneRepo: (Anonymous function) = cloneRepo(execa)

initialCommit

initialCommit: (Anonymous function) = initialCommit(execa)

install

install: (Anonymous function) = install(execa)

Const sandboxOptions

sandboxOptions: object

description

description: string = "this is an example description"

githubUsername

githubUsername: string = "SOME_GITHUB_USERNAME"

repoURL

repoURL: string

workingDirectory

workingDirectory: string = buildDir

Generated using TypeDoc