Member Junction
    Preparing search index...

    Manages modifications to an Angular project's angular.json file.

    Usage:

    const manager = new AngularConfigManager(repoRoot, clientPackagePath);
    if (!manager.Load()) return; // angular.json not found — skip silently

    manager.AddPrebundleExcludes(manifest);
    // future: manager.AddAssets(manifest);
    // future: manager.AddBuildOptions(manifest);

    const result = manager.Save();

    The class tracks whether any mutations actually changed the config. If nothing changed, Save() is a no-op (no unnecessary file writes).

    Index

    Constructors

    Methods

    • Adds the app's npm scope(s) to serve.options.prebundle.exclude for all projects in angular.json. Idempotent: patterns already present are skipped.

      Parameters

      • manifest: {
            $schema?: string;
            categories?: string[];
            code?: { sourceDirectory?: string; visibility?: "public" | "private" };
            color?: string;
            configuration?: { schema?: Record<string, unknown> };
            dependencies?:
                | {
                    [k: string]: { repository: string; subpath?: string; version: string };
                }
                | Record<
                    string,
                    string
                    | { repository?: string; subpath?: string; version?: string },
                >;
            description?: string;
            displayName?: string;
            hooks?: {
                postInstall?: string;
                postInstallModule?: string;
                postUpgrade?: string;
                postUpgradeModule?: string;
                preRemove?: string;
                preRemoveModule?: string;
            };
            icon?: string;
            license?: string;
            manifestVersion?: 1;
            metadata?: { directory?: string };
            migrations?: {
                directory?: string;
                engine?: "flyway" | "skyway";
                teardownDirectory?: string;
            };
            mjVersionRange?: string;
            name?: string;
            packages?: {
                client?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
                prefix?: string;
                registry?: string;
                server?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
                shared?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
            };
            publisher?: { email?: string; name?: string; url?: string };
            repository?: string;
            schema?: {
                createIfNotExists?: boolean;
                entityPackage?: string;
                name?: string;
            };
            tags?: string[];
            version?: string;
        }

      Returns number

      Number of patterns added (0 if all already present).

    • Loads and parses angular.json from the client workspace.

      Returns boolean

      true if the file was loaded successfully, false if angular.json doesn't exist (which is not an error — the project may not use Angular).

      If the file exists but can't be parsed as JSON.

    • Removes the app's npm scope(s) from serve.options.prebundle.exclude. Only removes patterns NOT used by any other installed app.

      Parameters

      • manifest: {
            $schema?: string;
            categories?: string[];
            code?: { sourceDirectory?: string; visibility?: "public" | "private" };
            color?: string;
            configuration?: { schema?: Record<string, unknown> };
            dependencies?:
                | {
                    [k: string]: { repository: string; subpath?: string; version: string };
                }
                | Record<
                    string,
                    string
                    | { repository?: string; subpath?: string; version?: string },
                >;
            description?: string;
            displayName?: string;
            hooks?: {
                postInstall?: string;
                postInstallModule?: string;
                postUpgrade?: string;
                postUpgradeModule?: string;
                preRemove?: string;
                preRemoveModule?: string;
            };
            icon?: string;
            license?: string;
            manifestVersion?: 1;
            metadata?: { directory?: string };
            migrations?: {
                directory?: string;
                engine?: "flyway" | "skyway";
                teardownDirectory?: string;
            };
            mjVersionRange?: string;
            name?: string;
            packages?: {
                client?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
                prefix?: string;
                registry?: string;
                server?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
                shared?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
            };
            publisher?: { email?: string; name?: string; url?: string };
            repository?: string;
            schema?: {
                createIfNotExists?: boolean;
                entityPackage?: string;
                name?: string;
            };
            tags?: string[];
            version?: string;
        }

        The app being removed

      • otherInstalledManifests: {
            $schema?: string;
            categories?: string[];
            code?: { sourceDirectory?: string; visibility?: "public" | "private" };
            color?: string;
            configuration?: { schema?: Record<string, unknown> };
            dependencies?:
                | {
                    [k: string]: { repository: string; subpath?: string; version: string };
                }
                | Record<
                    string,
                    string
                    | { repository?: string; subpath?: string; version?: string },
                >;
            description?: string;
            displayName?: string;
            hooks?: {
                postInstall?: string;
                postInstallModule?: string;
                postUpgrade?: string;
                postUpgradeModule?: string;
                preRemove?: string;
                preRemoveModule?: string;
            };
            icon?: string;
            license?: string;
            manifestVersion?: 1;
            metadata?: { directory?: string };
            migrations?: {
                directory?: string;
                engine?: "flyway" | "skyway";
                teardownDirectory?: string;
            };
            mjVersionRange?: string;
            name?: string;
            packages?: {
                client?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
                prefix?: string;
                registry?: string;
                server?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
                shared?: {
                    name?: string;
                    role?: | "bootstrap"
                    | "actions"
                    | "engine"
                    | "provider"
                    | "module"
                    | "components"
                    | "library";
                    startupExport?: string;
                }[];
            };
            publisher?: { email?: string; name?: string; url?: string };
            repository?: string;
            schema?: {
                createIfNotExists?: boolean;
                entityPackage?: string;
                name?: string;
            };
            tags?: string[];
            version?: string;
        }[]

        Manifests of all OTHER installed apps

      Returns number

      Number of patterns removed.