@alifd/fusion-collector

Collect info for fusion based project

Usage no npm install needed!

<script type="module">
  import alifdFusionCollector from 'https://cdn.skypack.dev/@alifd/fusion-collector';
</script>

README

fusion-collector

fusion project 的静态分析器, 用来提取 next 组件的使用情况

使用方法:

import { collectDetail } from '@alifd/fusion-collector';
collectDetail({
    rootDir: process.cwd(), // 项目根地址
    kit: 'ice-scripts', // 统计的来源
    kitVersion: '', //
    cmd_type: 'dev' // 触发环节 默认为build
});

测试

tnpm  i -g @alifd/fusion-collector

DEBUG=next:collect tnpm run compile-test

收集信息:

  • package.json
  • 已安装的模块版本信息
  • src 下每个 js/jsx 文件的 import / require 的模块
  • 对引入的 next 基本组件/业务组件/第三方模块 使用情况的分析

对象结构:

// 返回结构
{
    collectDetail
};

// collectDetail
{
    "project_id": "", // ssh格式的gitUrl
    "author": "游鹿", // 项目作者
    "repoName": "@alifd/fusion-collector", // 仓库名
    "gitUrl": "",
    "kit": "fie-toolkit-next",
    "kitVersion": "",
    "projectName": "", // 项目名称 来自packge.json
    "description": "", // 项目描述 来自packge.json
    "basicPackageVersion": "1.15.2",// 主体包版本
    "orignTemplate": "@alifd/fusion-design-pro", // 项目来源于哪个模版
    // 只有内网才收集
    "dependencies": {}, // {...pkg.dependencies, ...pkg.peerDependencies }, 其中@alife/next, @alifd/next, @icedesign/base的版本数据需要来源于node_modules
    "nextComponents": {}, // 基础组件的使用分类
}