1.0.3 • Published 3 years ago
npm-info-excel v1.0.3
npm-info-excel
use npm view
to get info of npm packages and export to excel.
Install
$ npm install npm-info-excel
Usage
const { exportExcel } = require("npm-info-excel");
const params = [
{
col: { caption: "version", type: "string" },
row: {
key: "version",
},
},
{
col: { caption: "description", type: "string" },
row: {
key: "description",
filter: (val) => {
return val + "!!!!";
},
},
},
{
col: { caption: "downloadUrl", type: "string" },
row: {
key: "repository.url",
},
},
];
exportExcel("./package.json", "./1.xlsx", params);
params
exportExcel(packageJsonUrl,outputPath,params)
- packageJsonUrl: package.json path.
- outputPath: path to the generated file
- params: Rules for generating excel。Array type, item[]。
- col:The head of each column
- row:The content of each column
- key:The value used to get information from the NPM view。
- filter: Converts the obtained value