mirror of
https://github.com/sass/sass.git
synced 2024-09-21 10:37:22 +00:00
87699d79b2
Instead of having the list of deprecations repeated in several different places across all of our repos, the new `spec/deprecations.yaml` file will be the only place we need to update it, with all other uses generating code based on it.
23 lines
700 B
TypeScript
23 lines
700 B
TypeScript
import * as crypto from 'crypto';
|
|
import * as fs from 'fs';
|
|
|
|
const yamlFile = 'spec/deprecations.yaml';
|
|
const specFile = 'spec/js-api/deprecations.d.ts.md';
|
|
const docFile = 'js-api-doc/deprecations.d.ts';
|
|
|
|
(async () => {
|
|
const yamlText = fs.readFileSync(yamlFile, 'utf8');
|
|
const specText = fs.readFileSync(specFile, 'utf8');
|
|
const docText = fs.readFileSync(docFile, 'utf8');
|
|
|
|
const checksum = crypto.createHash('sha1').update(yamlText).digest('hex');
|
|
|
|
if (
|
|
!specText.includes(`<!-- Checksum: ${checksum} -->`) ||
|
|
!docText.includes(`// Checksum: ${checksum}`)
|
|
) {
|
|
console.error('Deprecations out-of-sync. Run `npm run sync-deprecations`.');
|
|
process.exitCode = 1;
|
|
}
|
|
})();
|