Options
All
  • Public
  • Public/Protected
  • All
Menu

typescript-starter

Index

Type aliases

TypescriptStarterArgsOptions

TypescriptStarterUserOptions

Variables

Const branch

branch: string = execa.sync('git', ['rev-parse','--symbolic-full-name','--abbrev-ref','HEAD']).stdout

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 buildDir

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

Const down

down: "" = ""

Const enter

enter: " " = " "

Const inherit

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

Const up

up: "" = ""

Functions

Const addInferredOptions

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)

getIntro

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

    • columns: number | undefined

    Returns string

Const getRepoInfo

  • getRepoInfo(starterVersion: string): object
  • Returns the URL and branch to clone. We clone the branch (tag) at the current release rather than master. This ensures we get the exact files expected by this version of the CLI. (If we cloned master, changes merged to master, but not yet released, may cause unexpected results.)

    Parameters

    • starterVersion: string

      the current version of this CLI

    Returns object

    • branch: string
    • repo: string

Const getUserInfo

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

    • spawner: ExecaStatic

    Returns (Anonymous function)

hasCLIOptions

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>

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 pretendLatestVersionIs

  • pretendLatestVersionIs(version: string): void

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
      • appveyor: boolean
      • circleci: boolean
      • description: string
      • domDefinitions: boolean
      • email: string
      • fullName: string
      • githubUsername: string
      • immutable: boolean
      • install: boolean
      • nodeDefinitions: boolean
      • projectName: string
      • repoInfo: object
        • branch: string
        • repo: string
      • runner: Runner
      • strict: boolean
      • travis: 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 env

env: object

TYPESCRIPT_STARTER_REPO_BRANCH

TYPESCRIPT_STARTER_REPO_BRANCH: string = repoInfo.branch

TYPESCRIPT_STARTER_REPO_URL

TYPESCRIPT_STARTER_REPO_URL: string = repoInfo.repo

Const repoInfo

repoInfo: object

branch

branch: string = branch === 'HEAD' ? '.' : branch

repo

repo: string = process.cwd()

Const sandboxOptions

sandboxOptions: object

description

description: string = "this is an example description"

githubUsername

githubUsername: string = "SOME_GITHUB_USERNAME"

repoInfo

repoInfo: object

Type declaration

  • branch: string
  • repo: string

workingDirectory

workingDirectory: string = buildDir

Generated using TypeDoc