Skip to content

Commit ef8d98a

Browse files
ddbeckjamesnwElchi3
authored
Check every key (regardless of compute_from) for discouraged condition (#2228)
Co-authored-by: James Stuckey Weber <[email protected]> Co-authored-by: Elchi3 <[email protected]>
1 parent 06fda87 commit ef8d98a

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

scripts/dist.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
parseRangedDateString,
66
setLogger,
77
} from "compute-baseline";
8-
import { Compat, Feature } from "compute-baseline/browser-compat-data";
8+
import { Compat, feature, Feature } from "compute-baseline/browser-compat-data";
99
import { fdir } from "fdir";
1010
import fs from "node:fs";
1111
import path from "node:path";
@@ -238,12 +238,12 @@ function toDist(sourcePath: string): YAML.Document {
238238

239239
if (!source.draft_date) {
240240
logger.error(
241-
`${id}: contains at least one deprecated compat feature and can never be Baseline. This is forbidden for published features.`,
241+
`${id}: contains at least one deprecated compat feature. This is forbidden for published features.`,
242242
);
243243
exitStatus = 1;
244244
} else {
245245
logger.warn(
246-
`${id}: draft contains at least one deprecated compat feature and can never be Baseline. Was this intentional?`,
246+
`${id}: draft contains at least one deprecated compat feature. Was this intentional?`,
247247
);
248248
}
249249
}
@@ -282,6 +282,22 @@ function toDist(sourcePath: string): YAML.Document {
282282
);
283283
exitStatus = 1;
284284
}
285+
286+
for (const key of compatFeatures) {
287+
const f = feature(key);
288+
if (f.deprecated) {
289+
if (!source.draft_date) {
290+
logger.error(
291+
`${id}: contains contains deprecated compat feature ${f.id}. This is forbidden for published features.`,
292+
);
293+
exitStatus = 1;
294+
} else {
295+
logger.warn(
296+
`${id}: draft contains deprecated compat feature ${f.id}. Was this intentional?`,
297+
);
298+
}
299+
}
300+
}
285301
}
286302

287303
const sortedStatus = Array.from(groups.keys()).sort(compareStatus);

0 commit comments

Comments
 (0)