or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

angular-cli-adapter.mdconfiguration.mdindex.mdlogging.mdpackage-manager.mdproject-graph.mdtree-api.mdworkspace-management.mdworkspace-root.md
tile.json

tessl/npm-nrwl--tao

CLI compatibility layer for older Nx workspaces that serves as a bridge to core nx functionality

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@nrwl/tao@15.9.x

To install, run

npx @tessl/cli install tessl/npm-nrwl--tao@15.9.0

index.mddocs/

@nrwl/tao

@nrwl/tao is a CLI compatibility layer for older Nx workspaces that serves as a bridge between legacy workspace configurations and the newer Nx CLI. It provides backward compatibility for legacy commands and migration support while re-exporting essential Nx APIs for programmatic usage.

Package Information

  • Package Name: @nrwl/tao
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @nrwl/tao

Core Imports

ESM imports:

import { logger, Workspaces, Tree } from "@nrwl/tao";

CommonJS imports:

const { logger, Workspaces, Tree } = require("@nrwl/tao");

Specific module imports:

import { logger } from "@nrwl/tao/shared/logger";
import { Workspaces } from "@nrwl/tao/shared/workspace";
import { Tree } from "@nrwl/tao/shared/tree";

Basic Usage

import { logger, Workspaces, workspaceRoot } from "@nrwl/tao";

// Basic logging
logger.info("Starting workspace operation");
logger.warn("This is a warning message");

// Workspace management
const workspaces = new Workspaces(workspaceRoot);
const nxConfig = workspaces.readNxJson();
const projects = workspaces.readProjectsConfigurations();

console.log(`Found ${Object.keys(projects.projects).length} projects`);

Architecture

@nrwl/tao is built as a thin compatibility layer with two primary components:

  • CLI Binary: Handles command redirection for backward compatibility (tao migrate → tao _migrate)
  • API Re-exports: Provides access to 8 core Nx functional areas through direct re-exports

The package acts as a stable interface to essential Nx functionality, ensuring older tooling and scripts continue to work while providing access to modern Nx capabilities.

Capabilities

Logging Utilities

Formatted logging system with consistent branding and error handling for CLI applications.

export const logger: {
  warn(s: string | any): void;
  error(s: string | Error | any): void;
  info(s: string | any): void;
  log(...s: any[]): void;
  debug(...s: any[]): void;
  fatal(...s: any[]): void;
};

export const NX_PREFIX: string;
export const NX_ERROR: string;
export function stripIndent(str: string): string;

Logging

Nx Configuration

Types and interfaces for nx.json configuration management and workspace setup.

export interface NxJsonConfiguration<T = "*"> {
  extends?: string;
  implicitDependencies?: ImplicitDependencyEntry<T>;
  targetDefaults?: TargetDefaults;
  npmScope?: string;
  affected?: NxAffectedConfig;
  workspaceLayout?: { libsDir: string; appsDir: string };
  tasksRunnerOptions?: { [tasksRunnerName: string]: { runner: string; options?: any } };
  cli?: { packageManager?: PackageManager; defaultCollection?: string };
  plugins?: string[];
  defaultProject?: string;
}

export type PackageManager = 'yarn' | 'pnpm' | 'npm';

Configuration

Package Manager Detection

Cross-platform package manager utilities for detecting and working with npm, yarn, and pnpm.

export function detectPackageManager(dir?: string): PackageManager;
export function getPackageManagerCommand(packageManager?: PackageManager): PackageManagerCommands;
export function getPackageManagerVersion(packageManager?: PackageManager): string;

Package Manager

Project Graph Analysis

Types and interfaces for analyzing project dependencies and workspace structure.

export interface ProjectGraph {
  nodes: Record<string, ProjectGraphProjectNode>;
  externalNodes?: Record<string, ProjectGraphExternalNode>;
  dependencies: Record<string, ProjectGraphDependency[]>;
  allWorkspaceFiles?: FileData[];
  version?: string;
}

export interface ProjectGraphDependency {
  type: DependencyType | string;
  target: string;
  source: string;
}

Project Graph

Virtual File System

Tree API for code generation and file system operations with change tracking.

export interface Tree {
  root: string;
  read(filePath: string): Buffer | null;
  read(filePath: string, encoding: BufferEncoding): string | null;
  write(filePath: string, content: Buffer | string, options?: TreeWriteOptions): void;
  exists(filePath: string): boolean;
  delete(filePath: string): void;
  rename(from: string, to: string): void;
  listChanges(): FileChange[];
}

export function flushChanges(root: string, fileChanges: FileChange[]): void;

Tree API

Workspace Management

Comprehensive workspace discovery, project configuration parsing, and workspace utilities.

export class Workspaces {
  constructor(root: string);
  readProjectsConfigurations(opts?: { _ignorePluginInference?: boolean }): ProjectsConfigurations;
  readNxJson(): NxJsonConfiguration;
  hasNxJson(): boolean;
  calculateDefaultProjectName(cwd: string, projects: ProjectsConfigurations, nxJson: NxJsonConfiguration): string;
}

export function toProjectName(fileName: string): string;
export function globForProjectFiles(root: string, pluginsGlobPatterns: string[], nxJson?: NxJsonConfiguration): string[];

Workspace Management

Angular CLI Adapter

Bridge functionality for running Angular schematics, migrations, and builders within Nx workspaces.

export function scheduleTarget(
  root: string,
  opts: { project: string; target: string; configuration: string; runOptions: any },
  verbose: boolean
): Promise<Observable<BuilderOutput>>;

export function generate(root: string, opts: GenerateOptions, verbose: boolean): Promise<number>;
export function runMigration(root: string, packageName: string, migrationName: string, isVerbose: boolean): Promise<{ loggingQueue: string[]; madeChanges: boolean }>;

Angular CLI Adapter

Workspace Root Detection

Utilities for finding and working with workspace root directories.

export const workspaceRoot: string;
export function workspaceRootInner(dir: string, candidateRoot: string | null): string;

Workspace Root