Options
All
  • Public
  • Public/Protected
  • All
Menu

typescript-starter

Index

Type aliases

Tasks

Tasks: { cloneRepo: (repoInfo: { branch: string; repo: string }, workingDirectory: string, dir: string) => Promise<{ commitHash: string; gitHistoryDir: string }>; initialCommit: (hash: string, projectDir: string, name: string) => Promise<void>; install: (runner: Runner, projectDir: string) => Promise<void> }

Type declaration

  • Readonly cloneRepo: (repoInfo: { branch: string; repo: string }, workingDirectory: string, dir: string) => Promise<{ commitHash: string; gitHistoryDir: string }>
      • (repoInfo: { branch: string; repo: string }, workingDirectory: string, dir: string): Promise<{ commitHash: string; gitHistoryDir: string }>
      • Parameters

        • repoInfo: { branch: string; repo: string }
          • Readonly branch: string
          • Readonly repo: string
        • workingDirectory: string
        • dir: string

        Returns Promise<{ commitHash: string; gitHistoryDir: string }>

  • Readonly initialCommit: (hash: string, projectDir: string, name: string) => Promise<void>
      • (hash: string, projectDir: string, name: string): Promise<void>
      • Parameters

        • hash: string
        • projectDir: string
        • name: string

        Returns Promise<void>

  • Readonly install: (runner: Runner, projectDir: string) => Promise<void>
      • (runner: Runner, projectDir: string): Promise<void>
      • Parameters

        • runner: Runner
        • projectDir: string

        Returns Promise<void>

TypescriptStarterArgsOptions

TypescriptStarterCLIOptions

TypescriptStarterCLIOptions: { appveyor: boolean; circleci: boolean; cspell: boolean; description: string; domDefinitions: boolean; editorconfig: boolean; functional: boolean; install: boolean; nodeDefinitions: boolean; projectName: string; runner: Runner; strict: boolean; travis: boolean; vscode: boolean }

Type declaration

  • Readonly appveyor: boolean
  • Readonly circleci: boolean
  • Readonly cspell: boolean
  • Readonly description: string
  • Readonly domDefinitions: boolean
  • Readonly editorconfig: boolean
  • Readonly functional: boolean
  • Readonly install: boolean
  • Readonly nodeDefinitions: boolean
  • Readonly projectName: string
  • Readonly runner: Runner
  • Readonly strict: boolean
  • Readonly travis: boolean
  • Readonly vscode: boolean

TypescriptStarterInferredOptions

TypescriptStarterInferredOptions: { email: string; fullName: string; githubUsername: string; repoInfo: { branch: string; repo: string }; workingDirectory: string }

Type declaration

  • Readonly email: string
  • Readonly fullName: string
  • Readonly githubUsername: string
  • Readonly repoInfo: { branch: string; repo: string }
    • Readonly branch: string
    • Readonly repo: string
  • Readonly workingDirectory: string

TypescriptStarterOptions

TypescriptStarterRequiredConfig

TypescriptStarterRequiredConfig: { install: boolean; starterVersion: string }

Type declaration

  • Readonly install: boolean
  • Readonly starterVersion: string

TypescriptStarterUserOptions

Functions

Const addInferredOptions

Const asyncABC

  • asyncABC(): Promise<string[]>
  • A sample async function (to demo Typescript's es7 async/await down-leveling).

    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<string[]>

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

checkArgs

Const cloneRepo

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

    • spawner: typeof execa
    • Default value suppressOutput: boolean = false

    Returns (Anonymous function)

Const 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): { branch: string; repo: string }
  • 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 { branch: string; repo: string }

    • branch: string
    • repo: string

Const getUserInfo

  • getUserInfo(spawner: typeof execa): (Anonymous function)
  • Parameters

    • spawner: typeof execa

    Returns (Anonymous function)

hasCLIOptions

Const initialCommit

  • initialCommit(spawner: typeof execa): (Anonymous function)
  • Parameters

    • spawner: typeof execa

    Returns (Anonymous function)

inquire

Const install

  • install(spawner: typeof execa): (Anonymous function)
  • Parameters

    • spawner: typeof execa

    Returns (Anonymous function)

Const normalizePath

  • normalizePath(path: string): string
  • On Windows, normalize returns "\" as the path separator. This method normalizes with POSIX.

    Parameters

    • path: string

    Returns string

Const power

  • power(base: number, exponent: number): number
  • Raise the value of the first parameter to the power of the second using the es7 exponentiation 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

      the base to exponentiate

    • exponent: number

      the power to which to raise the base

    Returns number

Const readPackageJson

  • readPackageJson(path: string): any

Const sha256

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

    Example (es imports)

    import { sha256 } from 'typescript-starter'
    
    (async () => {
      console.log(await sha256('test'));
      // => '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
    });

    Parameters

    • message: string

      the string to hash

    Returns Promise<string>

    sha256 message digest

Const sha256Native

  • sha256Native(message: string): string
  • A synchronous implementation of sha256 which uses the native Node.js module. (Browser consumers should use the sha256 method.)

    Example (es imports)

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

    Parameters

    • message: string

      the string to hash

    Returns string

    sha256 message digest

typescriptStarter

  • typescriptStarter(__namedParameters: { appveyor: boolean; circleci: boolean; cspell: boolean; description: string; domDefinitions: boolean; editorconfig: boolean; email: string; fullName: string; functional: boolean; githubUsername: string; install: boolean; nodeDefinitions: boolean; projectName: string; repoInfo: { branch: string; repo: string }; runner: Runner; strict: boolean; travis: boolean; vscode: boolean; workingDirectory: string }, tasks: Tasks): Promise<void>
  • Parameters

    • __namedParameters: { appveyor: boolean; circleci: boolean; cspell: boolean; description: string; domDefinitions: boolean; editorconfig: boolean; email: string; fullName: string; functional: boolean; githubUsername: string; install: boolean; nodeDefinitions: boolean; projectName: string; repoInfo: { branch: string; repo: string }; runner: Runner; strict: boolean; travis: boolean; vscode: boolean; workingDirectory: string }
      • appveyor: boolean
      • circleci: boolean
      • cspell: boolean
      • description: string
      • domDefinitions: boolean
      • editorconfig: boolean
      • email: string
      • fullName: string
      • functional: boolean
      • githubUsername: string
      • install: boolean
      • nodeDefinitions: boolean
      • projectName: string
      • repoInfo: { branch: string; repo: string }
        • Readonly branch: string
        • Readonly 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: unknown): 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)

Generated using TypeDoc