mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-15 18:58:11 +00:00
Merge branch 'feat/code-generator' into v/0.8.0
* feat/code-generator: fix: path resolve problem
This commit is contained in:
commit
8fddf2991f
@ -7,8 +7,7 @@
|
|||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "rimraf lib && tsc",
|
"build": "rimraf lib && tsc",
|
||||||
"build": "rimraf lib && webpack",
|
|
||||||
"demo": "ts-node -r tsconfig-paths/register ./src/demo/main.ts",
|
"demo": "ts-node -r tsconfig-paths/register ./src/demo/main.ts",
|
||||||
"test": "ava"
|
"test": "ava"
|
||||||
},
|
},
|
||||||
@ -24,11 +23,7 @@
|
|||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"ts-loader": "^6.2.2",
|
"ts-loader": "^6.2.2",
|
||||||
"ts-node": "^7.0.1",
|
"ts-node": "^7.0.1",
|
||||||
"tsconfig-paths": "^3.9.0",
|
"tsconfig-paths": "^3.9.0"
|
||||||
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
|
||||||
"webpack": "^4.42.1",
|
|
||||||
"webpack-cli": "^3.3.11",
|
|
||||||
"webpack-node-externals": "^1.7.2"
|
|
||||||
},
|
},
|
||||||
"ava": {
|
"ava": {
|
||||||
"compileEnhancements": false,
|
"compileEnhancements": false,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { IResultDir, IResultFile } from '@/types';
|
import { IResultDir, IResultFile } from '../types';
|
||||||
|
|
||||||
import CodeGenerator from '@/index';
|
import CodeGenerator from '../index';
|
||||||
import { createDiskPublisher } from '@/publisher/disk';
|
import { createDiskPublisher } from '../publisher/disk';
|
||||||
import demoSchema from './simpleDemo';
|
import demoSchema from './simpleDemo';
|
||||||
|
|
||||||
function flatFiles(rootName: string | null, dir: IResultDir): IResultFile[] {
|
function flatFiles(rootName: string | null, dir: IResultDir): IResultFile[] {
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
import { IProjectSchema } from '@/types';
|
import { IProjectSchema } from '../types';
|
||||||
|
|
||||||
// meta: {
|
|
||||||
// title: '测试',
|
|
||||||
// router: '/',
|
|
||||||
// },
|
|
||||||
|
|
||||||
const demoData: IProjectSchema = {
|
const demoData: IProjectSchema = {
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
|
|||||||
@ -11,10 +11,10 @@ import {
|
|||||||
PostProcessor,
|
PostProcessor,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
import ResultDir from '@/model/ResultDir';
|
import ResultDir from '../model/ResultDir';
|
||||||
import SchemaParser from '@/parser/SchemaParser';
|
import SchemaParser from '../parser/SchemaParser';
|
||||||
|
|
||||||
import { createModuleBuilder } from '@/generator/ModuleBuilder';
|
import { createModuleBuilder } from '../generator/ModuleBuilder';
|
||||||
|
|
||||||
interface IModuleInfo {
|
interface IModuleInfo {
|
||||||
moduleName?: string;
|
moduleName?: string;
|
||||||
@ -67,7 +67,7 @@ export class ProjectBuilder implements IProjectBuilder {
|
|||||||
// Parse / Format
|
// Parse / Format
|
||||||
|
|
||||||
// Preprocess
|
// Preprocess
|
||||||
// Colllect Deps
|
// Collect Deps
|
||||||
// Parse JSExpression
|
// Parse JSExpression
|
||||||
const parseResult: IParseResult = schemaParser.parse(schema);
|
const parseResult: IParseResult = schemaParser.parse(schema);
|
||||||
let buildResult: IModuleInfo[] = [];
|
let buildResult: IModuleInfo[] = [];
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
* 低代码引擎的出码模块,负责将编排产出的 Schema 转换成实际可执行的代码。
|
* 低代码引擎的出码模块,负责将编排产出的 Schema 转换成实际可执行的代码。
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { createProjectBuilder } from '@/generator/ProjectBuilder';
|
import { createProjectBuilder } from './generator/ProjectBuilder';
|
||||||
import { createDiskPublisher } from '@/publisher/disk';
|
import { createDiskPublisher } from './publisher/disk';
|
||||||
import createIceJsProjectBuilder from '@/solutions/icejs';
|
import createIceJsProjectBuilder from './solutions/icejs';
|
||||||
|
|
||||||
export * from './types';
|
export * from './types';
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,8 @@
|
|||||||
import { SUPPORT_SCHEMA_VERSION_LIST } from '../const';
|
import { SUPPORT_SCHEMA_VERSION_LIST } from '../const';
|
||||||
|
|
||||||
import { handleChildren } from '../utils/children';
|
import { handleChildren } from '../utils/children';
|
||||||
import { uniqueArray } from '../utils/common';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ChildNodeItem,
|
|
||||||
ChildNodeType,
|
ChildNodeType,
|
||||||
CodeGeneratorError,
|
CodeGeneratorError,
|
||||||
CompatibilityError,
|
CompatibilityError,
|
||||||
@ -86,7 +84,7 @@ class SchemaParser implements ISchemaParser {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new CodeGeneratorError(`Can't find anything to generator.`);
|
throw new CodeGeneratorError(`Can't find anything to generate.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 建立所有容器的内部依赖索引
|
// 建立所有容器的内部依赖索引
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import {
|
|||||||
ChunkType,
|
ChunkType,
|
||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IContainerInfo,
|
|
||||||
} from '../../../types';
|
} from '../../../types';
|
||||||
|
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import {
|
|||||||
IJSExpression,
|
IJSExpression,
|
||||||
} from '../../../types';
|
} from '../../../types';
|
||||||
|
|
||||||
import { handleChildren } from '@/utils/children';
|
import { handleChildren } from '../../../utils/children';
|
||||||
import { generateCompositeType } from '../../utils/compositeType';
|
import { generateCompositeType } from '../../utils/compositeType';
|
||||||
import { REACT_CHUNK_NAME } from './const';
|
import { REACT_CHUNK_NAME } from './const';
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { COMMON_CHUNK_NAME } from '@/const/generator';
|
import { COMMON_CHUNK_NAME } from '../../const/generator';
|
||||||
import { generateCompositeType } from '@/plugins/utils/compositeType';
|
import { generateCompositeType } from '../../plugins/utils/compositeType';
|
||||||
import {
|
import {
|
||||||
BuilderComponentPlugin,
|
BuilderComponentPlugin,
|
||||||
ChunkType,
|
ChunkType,
|
||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IProjectInfo,
|
IProjectInfo,
|
||||||
} from '@/types';
|
} from '../../types';
|
||||||
|
|
||||||
// TODO: How to merge this logic to common deps
|
// TODO: How to merge this logic to common deps
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { COMMON_CHUNK_NAME } from '@/const/generator';
|
import { COMMON_CHUNK_NAME } from '../../../../../const/generator';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BuilderComponentPlugin,
|
BuilderComponentPlugin,
|
||||||
@ -6,7 +6,7 @@ import {
|
|||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IProjectInfo,
|
IProjectInfo,
|
||||||
} from '@/types';
|
} from '../../../../../types';
|
||||||
|
|
||||||
// TODO: How to merge this logic to common deps
|
// TODO: How to merge this logic to common deps
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { COMMON_CHUNK_NAME } from '@/const/generator';
|
import { COMMON_CHUNK_NAME } from '../../../../../const/generator';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BuilderComponentPlugin,
|
BuilderComponentPlugin,
|
||||||
@ -6,7 +6,7 @@ import {
|
|||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IProjectInfo,
|
IProjectInfo,
|
||||||
} from '@/types';
|
} from '../../../../../types';
|
||||||
|
|
||||||
// TODO: How to merge this logic to common deps
|
// TODO: How to merge this logic to common deps
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { COMMON_CHUNK_NAME } from '@/const/generator';
|
import { COMMON_CHUNK_NAME } from '../../../../../const/generator';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BuilderComponentPlugin,
|
BuilderComponentPlugin,
|
||||||
@ -6,7 +6,7 @@ import {
|
|||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IProjectInfo,
|
IProjectInfo,
|
||||||
} from '@/types';
|
} from '../../../../../types';
|
||||||
|
|
||||||
// TODO: How to merge this logic to common deps
|
// TODO: How to merge this logic to common deps
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { COMMON_CHUNK_NAME } from '@/const/generator';
|
import { COMMON_CHUNK_NAME } from '../../../../../const/generator';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BuilderComponentPlugin,
|
BuilderComponentPlugin,
|
||||||
@ -7,7 +7,7 @@ import {
|
|||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IPackageJSON,
|
IPackageJSON,
|
||||||
IProjectInfo,
|
IProjectInfo,
|
||||||
} from '@/types';
|
} from '../../../../../types';
|
||||||
|
|
||||||
interface IIceJsPackageJSON extends IPackageJSON {
|
interface IIceJsPackageJSON extends IPackageJSON {
|
||||||
ideMode: {
|
ideMode: {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { COMMON_CHUNK_NAME } from '@/const/generator';
|
import { COMMON_CHUNK_NAME } from '../../../../../const/generator';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BuilderComponentPlugin,
|
BuilderComponentPlugin,
|
||||||
@ -6,7 +6,7 @@ import {
|
|||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IRouterInfo,
|
IRouterInfo,
|
||||||
} from '@/types';
|
} from '../../../../../types';
|
||||||
|
|
||||||
// TODO: How to merge this logic to common deps
|
// TODO: How to merge this logic to common deps
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import ResultFile from '@/model/ResultFile';
|
import ResultFile from '../../../../../../model/ResultFile';
|
||||||
import { IResultFile } from '@/types';
|
import { IResultFile } from '../../../../../../types';
|
||||||
|
|
||||||
export default function getFile(): [string[], IResultFile] {
|
export default function getFile(): [string[], IResultFile] {
|
||||||
const file = new ResultFile(
|
const file = new ResultFile(
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
import ResultDir from '@/model/ResultDir';
|
import ResultDir from '../../../../../model/ResultDir';
|
||||||
import { IProjectTemplate, IResultDir, IResultFile } from '@/types';
|
import {
|
||||||
|
IProjectTemplate,
|
||||||
|
IResultDir,
|
||||||
|
IResultFile,
|
||||||
|
} from '../../../../../types';
|
||||||
|
|
||||||
import file12 from './files/abc.json';
|
import file12 from './files/abc.json';
|
||||||
import file11 from './files/build.json';
|
import file11 from './files/build.json';
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { COMMON_CHUNK_NAME } from '@/const/generator';
|
import { COMMON_CHUNK_NAME } from '../../const/generator';
|
||||||
import { generateCompositeType } from '@/plugins/utils/compositeType';
|
import { generateCompositeType } from '../../plugins/utils/compositeType';
|
||||||
import {
|
import {
|
||||||
BuilderComponentPlugin,
|
BuilderComponentPlugin,
|
||||||
ChunkType,
|
ChunkType,
|
||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IProjectInfo,
|
IProjectInfo,
|
||||||
} from '@/types';
|
} from '../../types';
|
||||||
|
|
||||||
// TODO: How to merge this logic to common deps
|
// TODO: How to merge this logic to common deps
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
import { COMMON_CHUNK_NAME } from '@/const/generator';
|
import { COMMON_CHUNK_NAME } from '../../const/generator';
|
||||||
import { generateCompositeType } from '@/plugins/utils/compositeType';
|
|
||||||
// import { } from '@/plugins/utils/jsExpression';
|
|
||||||
import {
|
import {
|
||||||
BuilderComponentPlugin,
|
BuilderComponentPlugin,
|
||||||
ChunkType,
|
ChunkType,
|
||||||
FileType,
|
FileType,
|
||||||
ICodeStruct,
|
ICodeStruct,
|
||||||
IUtilInfo,
|
IUtilInfo,
|
||||||
} from '@/types';
|
} from '../../types';
|
||||||
|
|
||||||
// TODO: How to merge this logic to common deps
|
// TODO: How to merge this logic to common deps
|
||||||
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { CompositeArray, CompositeValue, ICompositeObject } from '@/types';
|
import { CompositeArray, CompositeValue, ICompositeObject } from '../../types';
|
||||||
import { generateValue, isJsExpression } from './jsExpression';
|
import { generateValue, isJsExpression } from './jsExpression';
|
||||||
|
|
||||||
function generateArray(value: CompositeArray): string {
|
function generateArray(value: CompositeArray): string {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import prettier from 'prettier';
|
import prettier from 'prettier';
|
||||||
|
|
||||||
import { PostProcessor } from '@/types';
|
import { PostProcessor } from '../../types';
|
||||||
|
|
||||||
const PARSERS = ['css', 'scss', 'less', 'json', 'html', 'vue'];
|
const PARSERS = ['css', 'scss', 'less', 'json', 'html', 'vue'];
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { CodeGeneratorError, IResultDir } from '@/types';
|
import { CodeGeneratorError, IResultDir } from '../../types';
|
||||||
|
|
||||||
export type PublisherFactory<T, U> = (configuration?: Partial<T>) => U;
|
export type PublisherFactory<T, U> = (configuration?: Partial<T>) => U;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { existsSync, mkdir, writeFile } from 'fs';
|
import { existsSync, mkdir, writeFile } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
import { IResultDir, IResultFile } from '@/types';
|
import { IResultDir, IResultFile } from '../../types';
|
||||||
|
|
||||||
export const writeFolder = async (
|
export const writeFolder = async (
|
||||||
folder: IResultDir,
|
folder: IResultDir,
|
||||||
|
|||||||
@ -1,27 +1,27 @@
|
|||||||
import { IProjectBuilder } from '@/types';
|
import { IProjectBuilder } from '../types';
|
||||||
|
|
||||||
import { createProjectBuilder } from '@/generator/ProjectBuilder';
|
import { createProjectBuilder } from '../generator/ProjectBuilder';
|
||||||
|
|
||||||
import esmodule from '@/plugins/common/esmodule';
|
import esmodule from '../plugins/common/esmodule';
|
||||||
import containerClass from '@/plugins/component/react/containerClass';
|
import containerClass from '../plugins/component/react/containerClass';
|
||||||
import containerInitState from '@/plugins/component/react/containerInitState';
|
import containerInitState from '../plugins/component/react/containerInitState';
|
||||||
// import containerInjectUtils from '@/plugins/component/react/containerInjectUtils';
|
import containerInjectUtils from '../plugins/component/react/containerInjectUtils';
|
||||||
import containerLifeCycle from '@/plugins/component/react/containerLifeCycle';
|
import containerLifeCycle from '../plugins/component/react/containerLifeCycle';
|
||||||
import containerMethod from '@/plugins/component/react/containerMethod';
|
import containerMethod from '../plugins/component/react/containerMethod';
|
||||||
import jsx from '@/plugins/component/react/jsx';
|
import jsx from '../plugins/component/react/jsx';
|
||||||
import reactCommonDeps from '@/plugins/component/react/reactCommonDeps';
|
import reactCommonDeps from '../plugins/component/react/reactCommonDeps';
|
||||||
import css from '@/plugins/component/style/css';
|
import css from '../plugins/component/style/css';
|
||||||
import constants from '@/plugins/project/constants';
|
import constants from '../plugins/project/constants';
|
||||||
import iceJsEntry from '@/plugins/project/framework/icejs/plugins/entry';
|
import iceJsEntry from '../plugins/project/framework/icejs/plugins/entry';
|
||||||
import iceJsEntryHtml from '@/plugins/project/framework/icejs/plugins/entryHtml';
|
import iceJsEntryHtml from '../plugins/project/framework/icejs/plugins/entryHtml';
|
||||||
import iceJsGlobalStyle from '@/plugins/project/framework/icejs/plugins/globalStyle';
|
import iceJsGlobalStyle from '../plugins/project/framework/icejs/plugins/globalStyle';
|
||||||
import iceJsPackageJSON from '@/plugins/project/framework/icejs/plugins/packageJSON';
|
import iceJsPackageJSON from '../plugins/project/framework/icejs/plugins/packageJSON';
|
||||||
import iceJsRouter from '@/plugins/project/framework/icejs/plugins/router';
|
import iceJsRouter from '../plugins/project/framework/icejs/plugins/router';
|
||||||
import template from '@/plugins/project/framework/icejs/template';
|
import template from '../plugins/project/framework/icejs/template';
|
||||||
import i18n from '@/plugins/project/i18n';
|
import i18n from '../plugins/project/i18n';
|
||||||
import utils from '@/plugins/project/utils';
|
import utils from '../plugins/project/utils';
|
||||||
|
|
||||||
import { prettier } from '@/postprocessor';
|
import { prettier } from '../postprocessor';
|
||||||
|
|
||||||
export default function createIceJsProjectBuilder(): IProjectBuilder {
|
export default function createIceJsProjectBuilder(): IProjectBuilder {
|
||||||
return createProjectBuilder({
|
return createProjectBuilder({
|
||||||
@ -31,7 +31,7 @@ export default function createIceJsProjectBuilder(): IProjectBuilder {
|
|||||||
reactCommonDeps,
|
reactCommonDeps,
|
||||||
esmodule,
|
esmodule,
|
||||||
containerClass,
|
containerClass,
|
||||||
// containerInjectUtils,
|
containerInjectUtils,
|
||||||
containerInitState,
|
containerInitState,
|
||||||
containerLifeCycle,
|
containerLifeCycle,
|
||||||
containerMethod,
|
containerMethod,
|
||||||
@ -42,7 +42,7 @@ export default function createIceJsProjectBuilder(): IProjectBuilder {
|
|||||||
reactCommonDeps,
|
reactCommonDeps,
|
||||||
esmodule,
|
esmodule,
|
||||||
containerClass,
|
containerClass,
|
||||||
// containerInjectUtils,
|
containerInjectUtils,
|
||||||
containerInitState,
|
containerInitState,
|
||||||
containerLifeCycle,
|
containerLifeCycle,
|
||||||
containerMethod,
|
containerMethod,
|
||||||
|
|||||||
@ -143,3 +143,8 @@ export interface IProjectBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type PostProcessor = (content: string, fileType: string) => string;
|
export type PostProcessor = (content: string, fileType: string) => string;
|
||||||
|
|
||||||
|
// TODO: temp interface, need modify
|
||||||
|
export interface IPluginOptions {
|
||||||
|
fileDirDepth: number;
|
||||||
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import {
|
|||||||
ChildNodeType,
|
ChildNodeType,
|
||||||
IComponentNodeItem,
|
IComponentNodeItem,
|
||||||
IJSExpression,
|
IJSExpression,
|
||||||
} from '@/types';
|
} from '../types';
|
||||||
|
|
||||||
// tslint:disable-next-line: no-empty
|
// tslint:disable-next-line: no-empty
|
||||||
const noop = () => [];
|
const noop = () => [];
|
||||||
|
|||||||
@ -1,17 +1,12 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
|
||||||
"strictNullChecks": true,
|
|
||||||
"inlineSources": false,
|
|
||||||
"lib": ["es6"],
|
|
||||||
"downlevelIteration": true,
|
|
||||||
"paths": {
|
|
||||||
"@/*": ["./src/*"]
|
|
||||||
},
|
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
|
"lib": [
|
||||||
|
"es6"
|
||||||
|
],
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"baseUrl": "." /* Base directory to resolve non-absolute module names. */
|
"baseUrl": ".", /* Base directory to resolve non-absolute module names. */
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*"
|
"src/**/*"
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
const nodeExternals = require('webpack-node-externals');
|
|
||||||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
mode: 'production',
|
|
||||||
target: 'node',
|
|
||||||
entry: {
|
|
||||||
index: './src/index.ts',
|
|
||||||
// demo: './src/demo/main.ts',
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.tsx?$/,
|
|
||||||
use: 'ts-loader',
|
|
||||||
exclude: /node_modules/,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: [ '.tsx', '.ts', '.js' ],
|
|
||||||
plugins: [new TsconfigPathsPlugin({/* options: see below */})],
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
// filename: 'bundle.js',
|
|
||||||
filename: '[name].js',
|
|
||||||
path: path.resolve(__dirname, 'lib'),
|
|
||||||
},
|
|
||||||
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
|
|
||||||
};
|
|
||||||
Loading…
x
Reference in New Issue
Block a user