-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
check-compat-data-modules-by-versions
script
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import semver from 'semver'; | ||
const { version } = require('../package'); | ||
const modulesByVersions = require('../packages/core-js-compat/modules-by-versions'); | ||
|
||
const { major, minor, patch } = semver.coerce(version); | ||
let ok = true; | ||
|
||
if (minor || patch) { // ignore for pre-releases | ||
const zero = `${ major }.0`; | ||
const result = await fetch(`https://unpkg.com/core-js-compat@${ major }/modules-by-versions.json`); | ||
const prev = await result.json(); | ||
const set = new Set(prev[zero]); | ||
for (const mod of modulesByVersions[zero]) { | ||
if (!set.has(mod)) { | ||
ok = false; | ||
console.log(chalk.red(`${ chalk.cyan(mod) } should be added to modules-by-versions`)); | ||
} | ||
} | ||
} | ||
|
||
if (!ok) throw console.log(chalk.red('\nmodules-by-versions should be updated')); | ||
console.log(chalk.green('modules-by-versions checked')); |