fix: fix bug of build errors

This commit is contained in:
gengyang 2020-03-31 14:20:31 +08:00
parent 9ce0a7362a
commit 770a1b6c34
5 changed files with 41 additions and 53 deletions

View File

@ -47,6 +47,7 @@
"@babel/parser": "^7.8.4", "@babel/parser": "^7.8.4",
"@babel/traverse": "^7.8.4", "@babel/traverse": "^7.8.4",
"@babel/types": "^7.8.3", "@babel/types": "^7.8.3",
"ast-types": "^0.13.3",
"cross-spawn-promise": "^0.10.2", "cross-spawn-promise": "^0.10.2",
"debug": "^4.1.1", "debug": "^4.1.1",
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",

View File

@ -17,7 +17,7 @@ const tsPath = path.resolve(__dirname, '../src/otter-core/schema/types.ts');
ajv.compile(schema); ajv.compile(schema);
fs.writeFileSync(JsonPath, JSON.stringify(schema, null, 2), 'utf-8'); fs.writeFileSync(JsonPath, JSON.stringify(schema, null, 2), 'utf-8');
console.log('yaml file is successfully transformed into json'); console.log('yaml file is successfully transformed into json');
const ts = await compile(schema, 'IComponentMaterial'); const ts = await compile(schema, 'ComponentMeta');
fs.writeFileSync(tsPath, ts); fs.writeFileSync(tsPath, ts);
console.log('schema.d.ts is successfully generated'); console.log('schema.d.ts is successfully generated');
} catch (e) { } catch (e) {

View File

@ -10,23 +10,8 @@
*/ */
export type ComponentMeta = BasicSection & PropsSection & ConfigureSection; export type ComponentMeta = BasicSection & PropsSection & ConfigureSection;
export type PropType = BasicType | RequiredType | ComplexType; export type PropType = BasicType | RequiredType | ComplexType;
export type BasicType = export type BasicType = "array" | "bool" | "func" | "number" | "object" | "string" | "node" | "element" | "any";
| 'array' export type ComplexType = OneOf | OneOfType | ArrayOf | ObjectOf | Shape | Exact;
| 'bool'
| 'func'
| 'number'
| 'object'
| 'string'
| 'node'
| 'element'
| 'any';
export type ComplexType =
| OneOf
| OneOfType
| ArrayOf
| ObjectOf
| Shape
| Exact;
export type ConfigureProp = { export type ConfigureProp = {
title?: string; title?: string;
extraProps?: { extraProps?: {
@ -43,7 +28,7 @@ export interface BasicSection {
screenshot?: string; screenshot?: string;
icon?: string; icon?: string;
tags?: string[]; tags?: string[];
devMode?: 'proCode' | 'lowCode'; devMode?: "proCode" | "lowCode";
npm: Npm; npm: Npm;
[k: string]: any; [k: string]: any;
} }
@ -71,31 +56,31 @@ export interface RequiredType {
isRequired?: boolean; isRequired?: boolean;
} }
export interface OneOf { export interface OneOf {
type: 'oneOf'; type: "oneOf";
value: (string | number | boolean)[]; value: (string | number | boolean)[];
isRequired?: boolean; isRequired?: boolean;
[k: string]: any; [k: string]: any;
} }
export interface OneOfType { export interface OneOfType {
type: 'oneOfType'; type: "oneOfType";
value: PropType[]; value: PropType[];
isRequired?: boolean; isRequired?: boolean;
[k: string]: any; [k: string]: any;
} }
export interface ArrayOf { export interface ArrayOf {
type: 'arrayOf'; type: "arrayOf";
value: PropType; value: PropType;
isRequired?: boolean; isRequired?: boolean;
[k: string]: any; [k: string]: any;
} }
export interface ObjectOf { export interface ObjectOf {
type: 'objectOf'; type: "objectOf";
value: PropType; value: PropType;
isRequired?: boolean; isRequired?: boolean;
[k: string]: any; [k: string]: any;
} }
export interface Shape { export interface Shape {
type: 'shape'; type: "shape";
value: { value: {
name?: string; name?: string;
propType?: PropType; propType?: PropType;
@ -104,7 +89,7 @@ export interface Shape {
[k: string]: any; [k: string]: any;
} }
export interface Exact { export interface Exact {
type: 'exact'; type: "exact";
value: { value: {
name?: string; name?: string;
propType?: PropType; propType?: PropType;
@ -127,38 +112,38 @@ export interface ConfigureSection {
[k: string]: any; [k: string]: any;
} }
export interface ConfigureFieldProp { export interface ConfigureFieldProp {
type: 'field'; type: "field";
name?: string; name?: string;
setter?: ConfigureFieldSetter; setter?: ConfigureFieldSetter;
[k: string]: any; [k: string]: any;
} }
export interface ConfigureFieldSetter { export interface ConfigureFieldSetter {
componentName: componentName:
| 'List' | "List"
| 'Object' | "Object"
| 'Function' | "Function"
| 'Node' | "Node"
| 'Mixin' | "Mixin"
| 'Expression' | "Expression"
| 'Switch' | "Switch"
| 'Number' | "Number"
| 'Input' | "Input"
| 'TextArea' | "TextArea"
| 'Date' | "Date"
| 'DateYear' | "DateYear"
| 'DateMonth' | "DateMonth"
| 'DateRange' | "DateRange"
| 'ColorPicker' | "ColorPicker"
| 'CodeEditor' | "CodeEditor"
| 'Select' | "Select"
| 'RadioGroup'; | "RadioGroup";
props?: { props?: {
[k: string]: any; [k: string]: any;
}; };
[k: string]: any; [k: string]: any;
} }
export interface ConfigureGroupProp { export interface ConfigureGroupProp {
type: 'group'; type: "group";
items: ConfigureProp[]; items: ConfigureProp[];
[k: string]: any; [k: string]: any;
} }

View File

@ -6,11 +6,13 @@ import ICompiler from './ICompiler';
import IExtensionConfigManifest from './IExtensionConfigManifest'; import IExtensionConfigManifest from './IExtensionConfigManifest';
import IMaterializeOptions from './IMaterializeOptions'; import IMaterializeOptions from './IMaterializeOptions';
import IMaterialScanModel from './IMaterialScanModel'; import IMaterialScanModel from './IMaterialScanModel';
import { IMaterialParsedModel } from './IMaterialParsedModel';
import SourceType from './SourceType'; import SourceType from './SourceType';
export { export {
ExtensionName, ExtensionName,
IExtensionConfigManifest, IExtensionConfigManifest,
IMaterialParsedModel,
IMaterializeOptions, IMaterializeOptions,
IMaterialScanModel, IMaterialScanModel,
SourceType, SourceType,

View File

@ -67,13 +67,13 @@ test('ts component by local', async t => {
t.snapshot(actual); t.snapshot(actual);
}); });
// test('fusion next component by local', async t => { test('fusion next component by local', async t => {
// const options: IMaterializeOptions = { const options: IMaterializeOptions = {
// entry: fusionComptPath, entry: fusionComptPath,
// accesser: 'local', accesser: 'local',
// }; };
// const actual = await parse(options); const actual = await parse(options);
// t.snapshot(actual); t.snapshot(actual);
// }); });