unused-files-found
v1.0.1
Published
``` const chalk = require('chalk'); const findUnusedModule = require('./index'); const path = require('path');
Downloads
3
Readme
const chalk = require('chalk');
const findUnusedModule = require('./index');
const path = require('path');
const { all, used, unused } = findUnusedModule({
cwd: process.cwd(),//根目录
entries: ['./demo-project/fre.js', './demo-project/suzhe2.js'],
includes: ['./demo-project/**/*'],//glob加的一些过滤条件
resolveRequirePath (curDir, requirePath) {//自定义规则
if (requirePath === 'b') {
return path.resolve(curDir, './lib/ssh.js');
}
return requirePath;
}
});
console.log(chalk.blue('used modules:'));
console.log(used);
console.log(chalk.yellow('unused modules:'));
console.log(unused);
PS: 主要是运维工具
demo-project是用于测试的项目
其中require('./index')用于本地测试
用户使用的话直接npm i unused-files-found