GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lowcode-engine/modules/material-parser/src/generate.ts at main · johnsky123/lowcode-engine

Expand file tree

/

generate.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
65 lines (59 loc) · 2 KB
/

generate.ts

Copy path

File metadata and controls

65 lines (59 loc) · 2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import * as path from 'path';
import { debug, ComponentMeta } from './core';
import { IMaterialParsedModel, IMaterialScanModel, IInternalMaterializeOptions } from './types';
const log = debug.extend('gen');
export default async function (
matScanModel: IMaterialScanModel,
matParsedModels: IMaterialParsedModel[],
options: IInternalMaterializeOptions,
): Promise<ComponentMeta[]> {
const containerList = [];
for (const matParsedModel of matParsedModels) {
// 默认排除掉 defaultExportName 为空的组件
if (!matParsedModel.componentName) {
log('skip');
continue;
}
// 组装 manifest
const manifest: any = await genManifest(matScanModel, matParsedModel, options);
containerList.push(manifest);
}
return containerList;
}
/**
* 生成 manifest
*
* @param {IMaterialParsedModel} matParsedModel
* @returns {Promise<
* manifestObj: ComponentMeta, // 组件描述
* >}
* @memberof LocalGenerator
*/
export async function genManifest(
matScanModel: IMaterialScanModel,
matParsedModel: IMaterialParsedModel,
options: IInternalMaterializeOptions,
): Promise<ComponentMeta> {
const manifestObj: Partial<ComponentMeta> = {
componentName: matParsedModel.componentName,
title: matScanModel.pkgName,
docUrl: '',
screenshot: '',
devMode: 'proCode', // 需要入料的组件都是源码模式,低代码组件在平台上即可直接生成描述
npm: {
package: matScanModel.pkgName,
version: matScanModel.pkgVersion,
exportName: matParsedModel.meta?.exportName || matParsedModel.componentName,
main:
options.root && path.isAbsolute(matScanModel.mainFilePath)
? path.relative(options.root, matScanModel.mainFilePath)
: matScanModel.mainFilePath,
destructuring: matParsedModel.meta?.exportName !== 'default',
subName: matParsedModel.meta?.subName || '',
},
};
// 填充 props
manifestObj.props = matParsedModel.props;
// 执行扩展点
return manifestObj as ComponentMeta;
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.