0.3.5 • Published 11 months ago
dien-cg v0.3.5
코드 생성기
해당 모듈은 생산성을 높히기 위해서 만든 코드 생성기 입니다.
dien.config.json
실행시키는 위치에 dien.config.json 파일을 만들어야 됩니다.
필드 | 설명 |
---|---|
type | api, web 중 하나를 선택 |
database | 데이터베이스 정보 |
templatePath | 템플릿 만들어서 out하는 폴더 경로. ex) "templates", "src/templates" etc |
templates | 템플릿들이 있는 경로 아래의 예제를 봐주세요. key는 그 경로에 파일명에 맞게 처리 함 |
예시는 아래와 같습니다.
{
"type": "api",
"database": {
"host": "",
"database": "",
"user": "",
"password": "",
"port": 3306
},
"outTemplatePath": "templates",
"templates": {
"service/{camelTableName}.service.ts": "temps/service.template.ejs",
"controllers/{camelTableName}.controller.ts": "temps/controller.template.ejs",
"service/{camelTableName}.dao.ts": "temps/dao.template.ejs",
"controllers/{camelTableName}.validator.ts": "temps/validator.template.ejs",
"http/{camelTableName}.http": "temps/http.template.ejs"
}
}
템플릿
템플릿은 ejs를 기반으로 만들어졌습니다. ejs에 대한 자세한 내용은 ejs를 참고해주세요.
템플릿를 만들 때 여기를 참고해주세요.
변수명
이름 | 설명 |
---|---|
tableName | 테이블 이름 |
tableComment | 테이블 Comment |
camelTableName | 테이블 이름을 카멜케이스로 변경처리 것 |
columnSchemas | 테이블의 컬럼들에 대한 스키마 입니다. |
columnSchemas types
type columnSchemas = SchemaInterface[];
interface SchemaInterface {
column: {
name: string;
type: string;
key: string;
null: string;
extra: string;
comment: string;
};
field: string;
type: string;
ableNull: boolean;
primaryKey: boolean;
autoIncrement: boolean;
isDate: boolean;
hasDefault: boolean;
comment: string;
}
0.3.5
11 months ago
0.3.4
11 months ago
0.3.0
2 years ago
0.2.7
2 years ago
0.2.6
2 years ago
0.3.2
2 years ago
0.3.1
2 years ago
0.3.3
2 years ago
0.2.1
2 years ago
0.2.3
2 years ago
0.2.2
2 years ago
0.2.5
2 years ago
0.2.4
2 years ago
0.2.0
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago