Options
All
  • Public
  • Public/Protected
  • All
Menu

External module targets/lib

This module defines the lib target type used to create libraries for other projects.

In the following list of tasks, {target} represents the name of the target as defined by the name property of the target options. The lib target provides the following tasks:

{target}:build

Performs a full build of the library to the build directory, used for development. This copies the static assets and compiles the scripts.

The following sub-tasks are available:

  • {target}:build:copy: Only copy the static assets
  • {target}:build:script: Only compile the scripts

For distribution builds, use {target:dist}

{target}:watch

Watch the files and run incremental builds on change. This useful during development to get build errors reported immediately or accelerate the code/test cycle. You can combine it with Nodemon to continuously restart your Node process when changing the source.

{target}:dist

Performs a full build of the library to the dist directory, used for distribution (ie. publication to npm). This build creates a fully autonomous directory with its own package.json, source code, license file, etc. This allows to use a different structure for distribution rather than structure of the repo, the main benefit is to provide support for deep package imports (import * as mod from "my-lib/deep/module") by placing the build at the root of the package. This build also allows you to remap the package.json, for example to set the version dynamically.

The following sub-tasks are available:

  • {target}:dist:copy-src: Only copy the source files to the build directory.
  • {target}:dist:package.json: Copy (and eventually transform) the root package.json to the build directory.

For development builds, use {target:build}.

##{target}:publish

Publish the package to an npm registry (it honors the registry option, to publish to private npm registries such as Verdaccio). It uses the authentication token of the current user, this token is in ~/.npmrc. For CI, you can use the following command to set the token the registry npm.example.com. (for the official registry, use //registry.npmjs.org):

echo "//npm.example.com/:_authToken=\"${NPM_TOKEN}\"" > ~/.npmrc

{target}:typedoc

Generate Typedoc documentation.

{target}:typedoc:deploy

Deploy the Typedoc documentation using git. This can be used to easily deploy the documentation to the gh-pages branch.

{target}:clean

Remove both the build and dist directories corresponding to this target.

{target}:tsconfig.json

Emit a tsconfig.json file corresponding to the configuration for this target. This allows to compile it using the command line tsc program. This is also useful for IDE to auto-detect the configuration of the project.

Index

Functions

generateLibTasks

  • Generates gulp tasks for the provided lib target.

    Parameters

    • taker: Undertaker

      Undertaker (or Gulp) registry used to generate tasks.

    • targetOptions: LibTarget

      Target configuration.

    Returns LibTasks

registerLibTasks

  • Generates and registers gulp tasks for the provided lib target.

    Parameters

    • taker: Undertaker

      Undertaker (or Gulp) instance where the tasks will be registered.

    • targetOptions: LibTarget

      Target configuration.

    Returns LibTasks

resolveLibTarget

Generated using TypeDoc