add frontend frame and service logic
This commit is contained in:
@ -2,12 +2,14 @@ import * as path from 'path';
|
||||
const ncp = require('ncp').ncp;
|
||||
import { createDatabase, writeMigrationsToFile } from './database/database-creator';
|
||||
import { createViews } from './views/views-creator';
|
||||
import {createFrontend} from "./frontend-services/fe-service-creator";
|
||||
|
||||
class SystemGenService {
|
||||
|
||||
public runSysGen(defs: SystemDef) {
|
||||
ncp(path.join(process.cwd(), 'frame'), path.join(process.cwd(), defs.name), (err: any) => {
|
||||
if (err) {
|
||||
console.log("error in ncp");
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log('success copying files');
|
||||
@ -15,6 +17,16 @@ class SystemGenService {
|
||||
this.buildViews(defs, defs.name);
|
||||
}
|
||||
});
|
||||
|
||||
ncp(path.join(process.cwd(), 'frontend-frame'), path.join(process.cwd(), `frontend-${defs.name}`), (err: any) => {
|
||||
if (err) {
|
||||
console.log("error in frontend ncp");
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log("success copying frontend files");
|
||||
this.buildFrontend(defs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public buildDatabase(storage: StorageDef, outDir: string) {
|
||||
@ -25,6 +37,14 @@ class SystemGenService {
|
||||
public buildViews(systemDef: SystemDef, outDir: string) {
|
||||
createViews(systemDef);
|
||||
}
|
||||
|
||||
public buildFrontend(systemDef: SystemDef) {
|
||||
createFrontend(systemDef);
|
||||
}
|
||||
|
||||
public cleanup() {
|
||||
// TODO: remove 'component/{{component}}' folder
|
||||
}
|
||||
}
|
||||
|
||||
const systemGenService = new SystemGenService();
|
||||
@ -69,6 +89,7 @@ interface Filter {
|
||||
column: ColumnRef;
|
||||
comparison: '=' | '!=' | '>' | '<' | 'contains' | 'LIKE';
|
||||
required?: boolean;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface TableDef {
|
||||
@ -91,6 +112,7 @@ interface ColumnRef {
|
||||
table: string;
|
||||
param?: string;
|
||||
required?: boolean;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface ValueDef {
|
||||
|
Reference in New Issue
Block a user