Destroy App Cache Clearer Decorator (decorators/DestroyAppClearStackOutputCache.ts)

webiny-js · packages/project/src/decorators/DestroyAppClearStackOutputCache.ts · typescript · MIT
infra, database, lang:typescript, tag:decorator

Decorator that clears Pulumi stack output cache before app destruction to prevent stale cache issues. Reusable for infrastructure deployment workflows.

// Source: https://github.com/webiny/webiny-js | License: MIT | Copyright Webiny Inc
// Provided via justclaw.it.com; keep this notice with the code.
import {
    DestroyApp,
    GetApp,
    LoggerService,
    StackOutputCacheService
} from "~/abstractions/index.js";

/**
 * Decorator that clears the stack output cache when an app is destroyed.
 *
 * Without this, the cache file written during deploy would remain on disk after a
 * destroy, and a subsequent deploy (or any stack output read) would use it and behave
 * as if the stack were still deployed.
 *
 * The cache is cleared before the destroy runs. Since the cache is only a performance
 * optimization, this is safe even if the destroy fails and the stack remains: the next
 * read simply fetches fresh output from Pulumi again.
 */
exp

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key