Gathering detailed insights and metrics for @angular-devkit/core
Gathering detailed insights and metrics for @angular-devkit/core
Gathering detailed insights and metrics for @angular-devkit/core
Gathering detailed insights and metrics for @angular-devkit/core
npm install @angular-devkit/core
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.3
Supply Chain
99.6
Quality
96.5
Maintenance
100
Vulnerability
100
License
TypeScript (95%)
Starlark (2.32%)
JavaScript (1.36%)
HTML (0.98%)
EJS (0.24%)
Shell (0.06%)
jq (0.03%)
Total Downloads
2,162,267,134
Last Day
2,699,034
Last Week
13,646,984
Last Month
59,229,497
Last Year
558,226,399
MIT License
26,955 Stars
16,886 Commits
11,945 Forks
989 Watchers
32 Branches
660 Contributors
Updated on Jul 31, 2025
Latest Version
20.1.4
Package Id
@angular-devkit/core@20.1.4
Unpacked Size
257.39 kB
Size
54.13 kB
File Count
113
NPM Version
11.4.2
Node Version
22.17.1
Published on
Jul 30, 2025
Cumulative downloads
Total Downloads
Last Day
2.5%
2,699,034
Compared to previous day
Last Week
0.7%
13,646,984
Compared to previous week
Last Month
6.3%
59,229,497
Compared to previous month
Last Year
28%
558,226,399
Compared to previous year
6
1
Shared utilities for Angular DevKit.
export interface SchemaValidatorResult {
success: boolean;
errors?: string[];
}
export interface SchemaValidator {
(data: any): Observable<SchemaValidatorResult>;
}
export interface SchemaFormatter {
readonly async: boolean;
validate(data: any): boolean | Observable<boolean>;
}
export interface SchemaRegistry {
compile(schema: Object): Observable<SchemaValidator>;
addFormat(name: string, formatter: SchemaFormatter): void;
}
SchemaRegistry
implementation using https://github.com/epoberezkin/ajv.
Constructor accepts object containing SchemaFormatter
that will be added automatically.
export class CoreSchemaRegistry implements SchemaRegistry {
constructor(formats: { [name: string]: SchemaFormatter} = {}) {}
}
The workspaces
namespace provides an API for interacting with the workspace file formats.
It provides an abstraction of the underlying storage format of the workspace and provides
support for both reading and writing. Currently, the only supported format is the JSON-based
format used by the Angular CLI. For this format, the API provides internal change tracking of values which
enables fine-grained updates to the underlying storage of the workspace. This allows for the
retention of existing formatting and comments.
A workspace is defined via the following object model. Definition collection objects are specialized
Javascript Map
objects with an additional add
method to simplify addition and provide more localized
error checking of the newly added values.
1export interface WorkspaceDefinition { 2 readonly extensions: Record<string, JsonValue | undefined>; 3 readonly projects: ProjectDefinitionCollection; 4} 5 6export interface ProjectDefinition { 7 readonly extensions: Record<string, JsonValue | undefined>; 8 readonly targets: TargetDefinitionCollection; 9 root: string; 10 prefix?: string; 11 sourceRoot?: string; 12} 13 14export interface TargetDefinition { 15 options?: Record<string, JsonValue | undefined>; 16 configurations?: Record<string, Record<string, JsonValue | undefined> | undefined>; 17 builder: string; 18}
The API is asynchronous and has two main functions to facilitate reading, creation, and modifying
a workspace: readWorkspace
and writeWorkspace
.
1export enum WorkspaceFormat { 2 JSON, 3}
1export function readWorkspace(
2 path: string,
3 host: WorkspaceHost,
4 format?: WorkspaceFormat,
5): Promise<{ workspace: WorkspaceDefinition }>;
1export function writeWorkspace(
2 workspace: WorkspaceDefinition,
3 host: WorkspaceHost,
4 path?: string,
5 format?: WorkspaceFormat,
6): Promise<void>;
A WorkspaceHost
abstracts the underlying data access methods from the functions. It provides
methods to read, write, and analyze paths. A utility function is provided to create
an instance of a WorkspaceHost
from the Angular DevKit's virtual filesystem host abstraction.
1export interface WorkspaceHost {
2 readFile(path: string): Promise<string>;
3 writeFile(path: string, data: string): Promise<void>;
4 isDirectory(path: string): Promise<boolean>;
5 isFile(path: string): Promise<boolean>;
6}
7
8export function createWorkspaceHost(host: virtualFs.Host): WorkspaceHost;
To demonstrate the usage of the API, the following code will show how to add a option property to a build target for an application.
1import { NodeJsSyncHost } from '@angular-devkit/core/node'; 2import { workspaces } from '@angular-devkit/core'; 3 4async function demonstrate() { 5 const host = workspaces.createWorkspaceHost(new NodeJsSyncHost()); 6 const { workspace } = await workspaces.readWorkspace('path/to/workspace/directory/', host); 7 8 const project = workspace.projects.get('my-app'); 9 if (!project) { 10 throw new Error('my-app does not exist'); 11 } 12 13 const buildTarget = project.targets.get('build'); 14 if (!buildTarget) { 15 throw new Error('build target does not exist'); 16 } 17 18 buildTarget.options.optimization = true; 19 20 await workspaces.writeWorkspace(workspace, host); 21} 22 23demonstrate();
No vulnerabilities found.