mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-24 04:25:34 +08:00
chore: initial commit
This commit is contained in:
31
scripts/check-types-path.js
Normal file
31
scripts/check-types-path.js
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/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')
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user