mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
32 lines
732 B
JavaScript
32 lines
732 B
JavaScript
#!/usr/bin/env node
|
|
|
|
/* eslint-disable import/no-commonjs */
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const packages = path.join(__dirname, '..', 'packages');
|
|
|
|
const invalid = [];
|
|
|
|
fs.readdirSync(packages).forEach((name) => {
|
|
const dir = path.join(packages, name);
|
|
|
|
if (fs.statSync(path.join(packages, name)).isDirectory()) {
|
|
const pak = JSON.parse(
|
|
fs.readFileSync(path.join(dir, 'package.json'), 'utf8')
|
|
);
|
|
|
|
if (pak.types && !fs.existsSync(path.join(dir, pak.types))) {
|
|
invalid.push(pak);
|
|
}
|
|
}
|
|
});
|
|
|
|
if (invalid.length) {
|
|
console.log(
|
|
'Found invalid path to type definitions in the following packages:\n',
|
|
invalid.map((p) => `- ${p.name} (${p.types})`).join('\n')
|
|
);
|
|
}
|