A comprehensive set of build tools and configurations for LoopBack 4 and TypeScript projects providing CLI commands for compilation, linting, testing, and coverage
npx @tessl/cli install tessl/npm-loopback--build@12.0.0@loopback/build is a comprehensive set of build tools and configurations specifically designed for LoopBack 4 and other TypeScript projects. It provides command-line utilities for TypeScript compilation, code linting, formatting, testing, and coverage, along with programmatic APIs for integration into build workflows.
npm install @loopback/build --save-devimport {
tsc,
prettier,
mocha,
nyc,
clean,
runCLI,
runShell,
mergeMochaConfigs,
typeScriptPath
} from "@loopback/build";For CommonJS:
const {
tsc,
prettier,
mocha,
nyc,
clean,
runCLI,
runShell,
mergeMochaConfigs,
typeScriptPath
} = require("@loopback/build");{
"scripts": {
"build": "lb-tsc",
"build:watch": "lb-tsc --watch",
"clean": "lb-clean",
"lint": "npm run prettier:check && npm run eslint",
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
"prettier:cli": "lb-prettier \"**/*.ts\" \"**/*.js\"",
"prettier:check": "npm run prettier:cli -- -l",
"prettier:fix": "npm run prettier:cli -- --write",
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha \"dist/__tests__\"",
"posttest": "npm run lint"
}
}@loopback/build is built around several key components:
lb-tsc, lb-eslint, etc.) that wrap popular development toolsTypeScript compiler wrapper with support for ttypescript plugins, resource copying, and automatic configuration generation.
function tsc(argv: string[], options?: RunOptions): ChildProcess | string;ESLint integration with automatic configuration discovery and LoopBack-specific rules through the lb-eslint CLI command.
Prettier integration with configuration discovery and file pattern support.
function prettier(argv: string[], options?: RunOptions): ChildProcess | string;Mocha test runner with console log detection, configuration merging, and enhanced error reporting.
function mocha(argv: string[], options?: RunOptions): ChildProcess | string;NYC code coverage wrapper for generating test coverage reports.
function nyc(argv: string[], options?: RunOptions): ChildProcess | string;Utility for safely removing build artifacts and temporary files.
function clean(argv: string[], options?: RunOptions): string;Core utilities for running CLI commands and managing child processes.
function runCLI(
cli: string,
args: string[],
options?: RunCLIOptions
): ChildProcess | string;
function runShell(
command: string,
args: string[],
options?: RunShellOptions
): ChildProcess | string;import { ChildProcess } from "child_process";
interface RunOptions {
dryRun?: boolean;
cwd?: string;
resolveFromProjectFirst?: boolean;
}
interface RunCLIOptions extends RunOptions {
nodeArgs?: string[];
}
interface RunShellOptions extends RunOptions {
stdio?: string;
env?: Record<string, string>;
shell?: boolean;
}
interface MochaConfig {
timeout?: number;
require?: string | string[];
[key: string]: any;
}