Don't fail publishing on default feature detection

Signed-off-by: Harrison Hogg <hhogg@spotify.com>
This commit is contained in:
Harrison Hogg
2024-09-16 12:48:03 +01:00
parent fd8128c26f
commit e1b002c2ec
+12 -5
View File
@@ -158,12 +158,19 @@ export const getEntryPointDefaultFeatureType = (
entryPoint.path.replace(entryPoint.ext, '.d.ts'),
);
const defaultFeatureType = getSourceFileDefaultFeatureType(
project.addSourceFileAtPath(dtsPath),
);
try {
const defaultFeatureType = getSourceFileDefaultFeatureType(
project.addSourceFileAtPath(dtsPath),
);
if (defaultFeatureType) {
return defaultFeatureType;
if (defaultFeatureType) {
return defaultFeatureType;
}
} catch (error) {
console.error(
`Failed to extract default feature type from ${dtsPath}, ${error}. ` +
'Your package will publish fine but it may be missing metadata about its default feature.',
);
}
}