Repository navigation
refactor!: remove unused asset types and splash scaffolding - #41
Merged
Merged
Conversation
benmccarty91
approved these changes
Sep 22, 2026
6 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Deletes unused types and scaffolding from
src/project/assets/. Deletion only — no behaviour changes. +1 −154 across 5 files; the single insertion is an import line losing one unused name.This started from an observation that several
AssetKindvariants looked unused. Investigation showed only one actually was (NotificationIcon); the real dead weight was the splash/PWA scaffolding surrounding it.Removed from the public API
AssetsAssetKind.NotificationIconOrientationThemeIosContentsIosOutputAssetTemplateIconIosOutputAssetTemplateSplashAndroidOutputAssetTemplateSplashPwaOutputAssetTemplateRemoved internally (zero-reference)
MobileProject.assets— declared, alwaysnull, never read.assetDiris kept; it's still used byassetDirExists().AndroidAssetGenerator._generateSplashesFromLogo— uncallable: there is no splashAssetKindand no splash template exists inandroid/assets.ts.AssetGeneratorOptions:splashBackgroundColor,splashBackgroundColorDark,pwaManifestPath,pwaNoAppleFetch,logoSplashScale,logoSplashTargetWidth.Logger,relative), the commented-out iOS splash constants, and an unusediosDirlocal.Change Type
Rationale / Problems Fixed
src/project/assets/is a partially-ported fork of Ionic's Trapeze. Several families of types came across and then never acquired a consumer:assetsYAML operation, so the pipeline is unreachable from theconfigureCLI.InputAsset— it's an API-only surface.tsc --strictnever flagged any of this because nothing referenced it at all. The result was a public API advertising capabilities the package does not have —Assetsofferssplash,pwaIconandandroidNotificationIconslots that nothing can consume, andAssetKind.NotificationIconsilently returns[]from both generators.AssetKindkeeps its 6 live variants:Logo,LogoDark,AdaptiveIcon,Icon,IconForeground,IconBackground.Breaking change notes
asset-types.tsis re-exported fromsrc/project/index.ts, so all of the above are part of the published@capacitor/trampolinesurface.OrientationandThemeare value enums, so their removal is a runtime break, not just a type-level one — a consumer importing them getsundefined. The rest are type-only and fail at compile time.AssetGeneratorOptionsis not itself exported, but its fields are reachable structurally vianew AndroidAssetGenerator({ ... }); an object literal passing a removed key now produces an excess-property error. Minor, but worth knowing.Deliberately NOT fixed
generateAdaptiveIconForegroundandgenerateAdaptiveIconBackgroundfilter templates byAssetKind.Icon— the legacy 36–192px mipmaps — thenas-cast the result toAndroidOutputAssetTemplateAdaptiveIcon, so adaptive layers are written at legacy sizes rather than the 81–432px adaptive sizes defined inandroid/assets.ts. The cast is what hides it from the compiler. The logo path filters correctly onAssetKind.AdaptiveIcon, so the same enum drives two paths and only one is right. This dates back to40737a8.Left untouched here to keep this PR deletion-only —
feat/RDMR-1476/android-adaptive-iconalready addresses it.Tests or Reproductions
This repo has no test suite and CI runs only
npm ci && npm run build, sotscis the entire safety net. That is adequate for this particular change because it is pure deletion: anything still referenced fails to compile.Verification performed:
npm run build— passes clean.grep -rnoversrc/for every removed symbol — no residual references.git diff src/project/assets/android/generator.ts— confirmed the twoAssetKind.Iconfilter lines are unchanged, i.e. no behavioural drift.dist/and confirmed the runtime export list is nowAssetKind, Platform, Format, AndroidDensity, IosIdiom, withAssetKindholding exactly the 6 remaining values.Not done: an end-to-end generator run against a real Capacitor project. There is no fixture in-repo for it, and since no code path changed, the
tscgate covers the risk.Screenshots / Media
n/a
Platforms Affected
Both platform generators are touched, but only by removal of unreachable code — no generated output changes on either. PWA/web types were removed too, though no web generator has ever existed.
Notes / Comments
Neither
switchoverAssetKindhas an exhaustiveness check, which is why this drifted silently in the first place. I did not add one here:default: assertNever(...)will not compile whileAdaptiveIconremains intentionally unhandled in both generators (it is a template-only kind, never a valid input kind). Worth a follow-up that pairs the exhaustiveness check with a decision about whether input kinds and output-template kinds belong in the same enum at all.Also worth flagging for whoever picks that up:
IosAssetGenerator.updateIconsContentsJsoncallsrmSyncinside a.mapover every existingContents.jsonentry, for every generated asset. It will throw if a listed file is already missing. Out of scope here.🤖 Generated with Claude Code