Skip to content

Commit

Permalink
fix(updateFeatures): handle removed features
Browse files Browse the repository at this point in the history
  • Loading branch information
clshortfuse committed Sep 20, 2024
1 parent fe02589 commit f9c0a24
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/update-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ for (const [featureId, packedFeature] of Object.entries(caniuse.features)) {
continue;
}

const title = databaseEntry ? databaseEntry.title : unpackFeature(packedFeature).title;
const title = databaseEntry ? databaseEntry.title : unpackFeature(packedFeature)?.title;

const stubOptions = {
id: featureId,
Expand Down Expand Up @@ -154,8 +154,10 @@ await Promise.all(
// make sure the file is empty or only contains a TODO comment
const filepath = path.resolve(`data/features/${filename}`);
const fileContent = await fs.readFile(filepath, 'utf8');

const { title } = unpackFeature(caniuse.features[name]);

const feature = caniuse.features[name];
if (!feature) return; // Ignore removed features
const { title } = unpackFeature(feature);
const category = caniuseDb.data[name]?.categories.join(', ');

if (fileContent.includes(' * TODO: initially implement ')
Expand Down

0 comments on commit f9c0a24

Please sign in to comment.