Skip to content

Commit

Permalink
fix: manually 'resolve' paths in cem
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Jun 2, 2024
1 parent c71307f commit cb71745
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .changeset/slimy-lizards-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@rhds/elements": patch
---
**Custom Elements Manifest**: corrected module paths in the manifest
22 changes: 22 additions & 0 deletions custom-elements-manifest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,27 @@ import { pfeCustomElementsManifestConfig } from '@patternfly/pfe-tools/custom-el
export default pfeCustomElementsManifestConfig({
globs: ['elements/*/rh-*.ts', 'elements/*/Rh*.ts'],
exclude: ['*.css.js'],
plugins: [{
// because analyzer tooling does not support export paths,
// we here need to 'manually resolve' those paths in the manifest
// practically, this means removing the 'elements/' prefix
name: 'rhds-fix-module-exports-paths',
packageLinkPhase({ customElementsManifest }) {
const fix = path => path.replace(/^elements\//, '');
for (const mod of customElementsManifest.modules) {
mod.path &&= fix(mod.path);
for (const declaration of mod.declarations ?? []) {
if (declaration?.superClass?.module) {
declaration.superClass.module &&= fix(declaration.superClass.module);
}
}
for (const exportDecl of mod.exports ?? []) {
if (exportDecl?.declaration?.module) {
exportDecl.declaration.module &&= fix(exportDecl.declaration.module);
}
}
}
}
}]
});

0 comments on commit cb71745

Please sign in to comment.