Class

BuildScripts

BuildScripts()

Constructor

# new BuildScripts()

This class provides a comprehensive build script that handles TypeScript compilation, bundling with Rollup, and documentation generation. It supports different build modes (development, production), module formats (CJS, ESM), and can be extended with custom configurations.

A command-line script for building and bundling TypeScript projects.

View Source cli/commands/build-scripts.ts, line 199

Methods

# async buildDev(modeopt, includesArgopt, externalsArgopt) → {Promise.<void>}

This method runs the build process with development-specific configurations.

Builds the project for development.

Parameters:
Name Type Attributes Default Description
mode BuildMode <optional>
BuildMode.ALL

The build mode (build, bundle, or all).

includesArg string | Array.<string> <optional>

A list of dependencies to include.

externalsArg string | Array.<string> <optional>

A list of external dependencies.

View Source cli/commands/build-scripts.ts, line 812

Promise.<void>

# async buildDocs() → {Promise.<void>}

This method uses JSDoc and other tools to generate HTML documentation for the project. It also patches the README.md file with version and package size information.

Generates the project documentation.

View Source cli/commands/build-scripts.ts, line 833

Promise.<void>

# async buildProd(modeopt, includesArgopt, externalsArgopt) → {Promise.<void>}

This method runs the build process with production-specific configurations, including minification and other optimizations.

Builds the project for production.

Parameters:
Name Type Attributes Default Description
mode BuildMode <optional>
BuildMode.ALL

The build mode (build, bundle, or all).

includesArg string | Array.<string> <optional>

A list of dependencies to include.

externalsArg string | Array.<string> <optional>

A list of external dependencies.

View Source cli/commands/build-scripts.ts, line 824

Promise.<void>

# async bundle(mode, isDev, isLib, entryFileopt, nameOverrideopt, externalsArgopt, includeArgopt) → {Promise.<void>}

This method configures and runs Rollup to bundle the project. It handles different module formats, development and production builds, and external dependencies.

Bundles the project using Rollup.

Parameters:
Name Type Attributes Default Description
mode Modes

The module format (CJS or ESM).

isDev boolean

Whether it's a development build.

isLib boolean

Whether it's a library build.

entryFile string <optional>
"src/index.ts"

The entry file for the bundle.

nameOverride string <optional>
this.pkgName

The name of the output bundle.

externalsArg string | Array.<string> <optional>

A list of external dependencies.

includeArg string | Array.<string> <optional>

A list of dependencies to include.

View Source cli/commands/build-scripts.ts, line 801

Promise.<void>

# copyAssets(mode)

This method checks for the existence of an 'assets' directory in the source and copies it to the appropriate build output directory (lib or dist).

Copies assets to the build output directory.

Parameters:
Name Type Description
mode Modes

The build mode (CJS or ESM).

View Source cli/commands/build-scripts.ts, line 785

# patchFiles(p)

This method reads all files in a directory, finds placeholders for version and package name, and replaces them with the actual values from package.json.

Patches files with version and package name.

Parameters:
Name Type Description
p string

The path to the directory containing the files to patch.

View Source cli/commands/build-scripts.ts, line 777