Skip to content

Commit

Permalink
Finalize replace drafts.csswg.org -> w3c.github.io/csswg-drafts URL (#…
Browse files Browse the repository at this point in the history
…17802)

* Finalize replace drafts.csswg.org -> w3c.github.io/csswg-drafts URL

* let -> const
  • Loading branch information
queengooborg committed Sep 15, 2022
1 parent c68da8b commit e1e14f1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/linter/test-spec-urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ const specsExceptions = [
'https://w3c.github.io/mathml/',

// Remove when added to browser-specs
'https://drafts.csswg.org/css-color-6/',
'https://w3c.github.io/csswg-drafts/css-color-6/',
];

const allowedSpecURLs = [
...specData.map((spec) => spec.url),
...specData.map((spec) => spec.nightly.url),
...specData.map((spec) => spec.series.nightlyUrl),
...specsExceptions,
];
].map((s) =>
// Since drafts.csswg.org is down too often, use an alternative canonical URL
s.replace('drafts.csswg.org', 'w3c.github.io/csswg-drafts'),
);

/**
* Process the data for spec URL errors
Expand All @@ -67,11 +70,18 @@ const processData = (data: CompatStatement, logger: Logger): void => {
? data.spec_url
: [data.spec_url];

for (let specURL of featureSpecURLs) {
specURL = specURL.replace('w3c.github.io/csswg-drafts', 'drafts.csswg.org');
for (const specURL of featureSpecURLs) {
if (!allowedSpecURLs.some((prefix) => specURL.startsWith(prefix))) {
logger.error(
chalk`Invalid specification URL found: {bold ${specURL}}. Try a more current specification URL and/or check if the specification URL is listed in https://github.com/w3c/browser-specs.`,
{
tip: specURL.includes('drafts.csswg.org')
? chalk`{cyan due to how often https://drafts.csswg.org is down, use https://w3c.github.io/csswg-drafts instead -- that is, replace {bold ${specURL}} with {bold ${specURL.replace(
'drafts.csswg.org',
'w3c.github.io/csswg-drafts',
)}}}`
: null,
},
);
}
}
Expand Down

0 comments on commit e1e14f1

Please sign in to comment.