Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit c14592b

Browse files
author
Aaron Dernley
committed
feat(clover): add cloudformationonly prop to cloudformation aws assets
1 parent 6d344d3 commit c14592b

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

‎bin/clover/src/pipelines/aws/pipeline-steps/pruneCfAssets.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { createFunc, strippedBase64 } from "../../../spec/funcs.ts";
44
import { CODE_GENERATION_FUNC_SPECS } from "../funcs.ts";
55
import { ulid } from "https://deno.land/x/ulid@v0.3.0/mod.ts";
66
import { FuncArgumentSpec } from "../../../bindings/FuncArgumentSpec.ts";
7+
import {
8+
createScalarProp,
9+
ExpandedPropSpecFor,
10+
findPropByName,
11+
} from "../../../spec/props.ts";
712

813
const logger = _logger.ns("pruneCfAssets").seal();
914

@@ -32,6 +37,36 @@ export function pruneCfAssets(specs: ExpandedPkgSpec[]): ExpandedPkgSpec[] {
3237
return specs;
3338
}
3439

40+
// Add CloudFormationOnly prop to assets with empty managementFuncs
41+
// This runs after overrides so custom management funcs are accounted for
42+
export function addCloudFormationOnlyProp(specs: ExpandedPkgSpec[]): ExpandedPkgSpec[] {
43+
for (const spec of specs) {
44+
const [schema] = spec.schemas;
45+
const [variant] = schema.variants;
46+
47+
if (!spec.name.includes("::") || variant.managementFuncs.length > 0) {
48+
continue;
49+
}
50+
51+
const extraProp = findPropByName(
52+
variant.domain,
53+
"extra",
54+
) as ExpandedPropSpecFor["object"];
55+
if (extraProp) {
56+
const cfOnlyProp = createScalarProp(
57+
"CloudFormationOnly",
58+
"boolean",
59+
extraProp.metadata.propPath,
60+
false,
61+
);
62+
cfOnlyProp.data.defaultValue = "true";
63+
cfOnlyProp.data.hidden = true;
64+
extraProp.entries.push(cfOnlyProp);
65+
}
66+
}
67+
return specs;
68+
}
69+
3570
function createAttributeFunc() {
3671
const code = Deno.readTextFileSync(
3772
"./src/pipelines/aws/funcs/attribute/awsCloudControlCfAssetAttr.ts",

‎bin/clover/src/pipelines/aws/pipeline.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import _logger from "../../logger.ts";
99
import { ExpandedPkgSpec } from "../../spec/pkgs.ts";
1010
import { loadInferred } from "../../spec/inferred.ts";
1111
import { addInferredEnums } from "./pipeline-steps/addInferredEnums.ts";
12-
import { pruneCfAssets } from "./pipeline-steps/pruneCfAssets.ts";
12+
import { pruneCfAssets, addCloudFormationOnlyProp } from "./pipeline-steps/pruneCfAssets.ts";
1313
import { removeUnneededAssets } from "./pipeline-steps/removeUnneededAssets.ts";
1414
import { applyAssetOverrides } from "../generic/applyAssetOverrides.ts";
1515
import { removeBadDocLinks } from "./pipeline-steps/removeBadDocLinks.ts";
@@ -58,6 +58,9 @@ export async function generateAwsSpecs(options: {
5858
// Apply provider-specific overrides
5959
specs = applyAssetOverrides(specs, AWS_PROVIDER_CONFIG);
6060

61+
// Add CloudFormationOnly prop to CF-only assets (after overrides)
62+
specs = addCloudFormationOnlyProp(specs);
63+
6164
// These need everything to be complete
6265
specs = reorderProps(specs);
6366
specs = generateAssetFuncs(specs);

0 commit comments

Comments
 (0)