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/traverse": "^7.8.4",
"@babel/types": "^7.8.3",
"ast-types": "^0.13.3",
"cross-spawn-promise": "^0.10.2",
"debug": "^4.1.1",
"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);
fs.writeFileSync(JsonPath, JSON.stringify(schema, null, 2), 'utf-8');
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);
console.log('schema.d.ts is successfully generated');
} catch (e) {

View File

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

View File

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

View File

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