ant-design/scripts/check-demo.js

15 lines
449 B
JavaScript
Raw Normal View History

const path = require('path');
const yfm = require('yaml-front-matter');
const glob = require('glob');
2019-09-16 11:23:26 +08:00
const fs = require('fs');
const demoFiles = glob.sync(path.join(process.cwd(), 'components/**/demo/*.md'));
// eslint-disable-next-line no-restricted-syntax
for (const url of demoFiles) {
const demoContent = fs.readFileSync(url);
const meta = yfm.loadFront(demoContent);
if (meta.only) {
throw Error(`there is a 'only': ${url}`);
}
}