0.3.3 • Published 8 months ago
dien-cg v0.3.3
코드 생성기
해당 모듈은 생산성을 높히기 위해서 만든 코드 생성기 입니다.
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.0
10 months ago
0.2.7
10 months ago
0.2.6
10 months ago
0.3.2
10 months ago
0.3.1
10 months ago
0.3.3
8 months ago
0.2.1
11 months ago
0.2.3
11 months ago
0.2.2
11 months ago
0.2.5
11 months ago
0.2.4
11 months ago
0.2.0
11 months ago
0.1.4
11 months ago
0.1.3
11 months ago
0.1.2
11 months ago
0.1.1
11 months ago
0.1.0
12 months ago
0.0.7
12 months ago
0.0.6
12 months ago
0.0.5
12 months ago
0.0.4
12 months ago
0.0.3
12 months ago
0.0.2
12 months ago
0.0.1
12 months ago