[英]How get plugin information from package.json, like about the plugin and license type etc using React (typescript)?
我的项目有一个要求。
我们在项目中使用带有Typescript的React。 我们需要显示插件信息,例如插件的版本,git url,package.json中的插件自述文件,并在网页上显示。 而且,当package.json更新时,我们也必须更新页面。
您可以导入插件的package.json
并将其作为JavaScript对象进行检查:
// tslint:disable-next-line
const pkg = require('plugin/package.json');
console.log(pkg.description);
console.log(pkg.repository.url);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.