2.1.0 • Published 2 years ago

dependparser v2.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

自动依赖分析器

项目的目标是创建一个小程序,自动帮用户分析出一个项目中所require的模块,以帮助用户编写出精确的 package.json 文件的 dependencies 和 devDependencies 属性。

实现思路

通过扫描目录中的 js 文件,正则表达式匹配 require 调用,提取出项目中 require 到的所有模块。并且排除掉Node的原生模块、文件模块,提取出依赖的第三方模块。并自动从 NPM 服务器上查看最新的版本以提供一个推荐的依赖列表。

安装

$ npm i dependparser -g

使用

命令行使用方式

$ dependparser <project dir path>

代码调用方式

// import the package
const dp = require('dependparser');

/**
 * 第一个参数是项目路径
 * 第二个参数是配置项(黑名单,checkVersion)
 */
const result = await parser.process(path.resolve(input), config);
const expectKeys = Object.keys(result.expect);
const actualKeys = Object.keys(result.actual);

License

The MIT License

2.1.0

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

7 years ago

1.0.0

10 years ago

0.0.8

10 years ago

0.0.7

12 years ago

0.0.6

12 years ago

0.0.5

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago