@simplix-boot/cli 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ko.md ADDED
@@ -0,0 +1,82 @@
1
+ [English](./README.md) | **한국어**
2
+
3
+ # SimpliX CLI
4
+
5
+ `simplix-boot`는 JPA 엔티티를 읽어 그 엔티티를 SimpliX로 제공하는 서비스, REST 컨트롤러, DTO, 테스트를 생성합니다. 필드별 동작은 yml 파일에 한 번만 적으면 되고, 이후 템플릿이 바뀌어도 생성된 코드와 직접 고친 내용을 함께 유지합니다.
6
+
7
+ ![엔티티는 config, generate, promote를 거쳐 모듈 소스가 됩니다. 개발자는 엔티티 yml을 편집하고, 템플릿이 코드의 모양을 정하며, generated가 모듈로 옮긴 파일과 템플릿의 일치 여부를 보고합니다.](../docs/assets/figures/cli-readme-pipeline.ko.svg)
8
+
9
+ ## 언제 사용하나
10
+
11
+ - 엔티티를 추가하고, 프로젝트의 다른 SimpliX API와 같은 형태의 CRUD API가 필요할 때
12
+ - 필드를 바꾸고 DTO, 검색 조건, 테스트에 그 변경을 반영해야 할 때
13
+ - 생성된 클래스를 직접 고친 내용을 다음 템플릿 변경 이후에도 유지해야 할 때
14
+
15
+ 엔티티 하나에 대응하지 않는 화면(대시보드, 여러 집계를 합친 보고서)은 직접 작성합니다. CLI가 생성의 근거로 삼을 엔티티가 없기 때문입니다.
16
+
17
+ ## 요구 사항
18
+
19
+ - Node.js 20 이상
20
+ - SimpliX에 의존하는 Gradle 또는 Maven 프로젝트
21
+ - 프로젝트의 SimpliX와 같은 릴리스 라인의 CLI
22
+
23
+ | 프로젝트 | SimpliX 라인 | 설치 |
24
+ |---|---|---|
25
+ | Spring Boot 4 | 2.x | `npm install -g @simplix-boot/cli` |
26
+ | Spring Boot 3 | 1.x | `npm install -g @simplix-boot/cli@spring-boot-3x` |
27
+
28
+ ## 설치
29
+
30
+ ```bash
31
+ # Spring Boot 4 projects (SimpliX 2.x)
32
+ npm install -g @simplix-boot/cli
33
+
34
+ # Spring Boot 3 projects (SimpliX 1.x)
35
+ npm install -g @simplix-boot/cli@spring-boot-3x
36
+
37
+ simplix-boot --version
38
+ ```
39
+
40
+ 설치하지 않고 실행하려면 같은 패키지 표기로 `npx @simplix-boot/cli <명령>`을 사용하세요. 팀 단위의 버전 고정과 프레임워크 체크아웃의 CLI를 실행하는 방법은 [버전 관리](docs/ko/managing-versions.md)에 있습니다.
41
+
42
+ ## 빠른 시작
43
+
44
+ `Author`라는 JPA 엔티티와 그 저장소가 이미 있는 프로젝트의 루트에서 실행하세요.
45
+
46
+ ```bash
47
+ # 1. Create the .simplix folder, then write .simplix/generator-simplix.json
48
+ simplix-boot init
49
+
50
+ # 2. Write .simplix/entity/Author.yml from the entity
51
+ simplix-boot config Author
52
+
53
+ # 3. Edit the yml, then generate the code into generated/
54
+ simplix-boot generate Author
55
+
56
+ # 4. Move the generated files into a module
57
+ simplix-boot promote Author --module catalog
58
+
59
+ # 5. Check that every promoted file matches the templates
60
+ simplix-boot generated
61
+ ```
62
+
63
+ [시작하기](docs/ko/getting-started.md)에서 같은 단계를 설정 파일, yml 편집 내용, 명령별 출력과 함께 따라 할 수 있습니다.
64
+
65
+ ## 문서
66
+
67
+ | 하려는 일 | 문서 |
68
+ |---|---|
69
+ | 첫 API를 단계별로 생성 | [시작하기](docs/ko/getting-started.md) |
70
+ | 생성되는 코드의 모양 변경 | [템플릿 사용자 지정](docs/ko/customizing-templates.md) |
71
+ | 템플릿이나 yml을 바꾼 뒤 직접 고친 내용을 유지하며 다시 생성 | [생성 코드 갱신](docs/ko/updating-generated-code.md) |
72
+ | 맞는 라인 설치, 버전 고정, 체크아웃 연결 | [버전 관리](docs/ko/managing-versions.md) |
73
+ | generator-simplix를 쓰던 프로젝트 전환 | [generator-simplix에서 전환](docs/ko/migrating-from-generator-simplix.md) |
74
+ | 명령과 옵션 확인 | [명령 레퍼런스](docs/ko/command-reference.md) |
75
+ | 설정 파일과 엔티티 yml의 키 확인 | [설정 레퍼런스](docs/ko/configuration-reference.md) |
76
+ | 템플릿 변수와 내장 템플릿 확인 | [템플릿 레퍼런스](docs/ko/template-reference.md) |
77
+ | 명령의 내부 동작 이해 | [동작 원리](docs/ko/how-it-works.md) |
78
+ | 오류 해결 | [문제 해결](docs/ko/troubleshooting.md) |
79
+
80
+ ## 라이선스
81
+
82
+ SimpleCORE License 1.0 (SCL-1.0). [LICENSE](../LICENSE)를 참조하세요.
package/README.md CHANGED
@@ -1,147 +1,82 @@
1
+ **English** | [한국어](./README.ko.md)
2
+
1
3
  # SimpliX CLI
2
4
 
3
- JPA 엔티티에서 SimpliX 서비스, REST 컨트롤러, DTO, 테스트 코드를 생성하는 명령줄 도구입니다. npm 패키지 이름은 `@simplix-boot/cli`이고 실행 파일 이름은 `simplix-boot`입니다.
5
+ `simplix-boot` reads a JPA entity and writes the service, REST controller, DTOs and tests that expose it through SimpliX. You describe each field once in a yml file, and the CLI keeps the generated code and your own edits together when a template changes later.
4
6
 
5
- ## 주요 기능
7
+ ![An entity becomes module source through config, generate and promote. The developer edits the entity yml, templates decide the code, and generated reports whether promoted files still match the templates.](../docs/assets/figures/cli-readme-pipeline.en.svg)
6
8
 
7
- - ✔ **엔티티 분석** - JPA 엔티티 소스를 읽어 필드, 식별자, 연관 관계를 담은 yml을 작성합니다.
8
- - ✔ **코드 생성** - yml과 템플릿으로 서비스, REST 컨트롤러, DTO, 서비스 테스트를 생성합니다.
9
- - ✔ **내장 템플릿** - 템플릿을 CLI에 포함해 배포하므로 프로젝트에 템플릿을 복사하지 않아도 생성할 수 있습니다.
10
- - ✔ **프로젝트 템플릿 우선** - `.simplix/templates`에 같은 상대 경로의 파일을 두면 내장 템플릿 대신 그 파일로 렌더링합니다.
11
- - ✔ **추적 렌더(tracked render)** - 모듈로 옮긴 파일에 렌더 지문(render fingerprint)을 기록하고, 템플릿이 바뀌면 직접 고친 내용에 3방향 병합으로 반영합니다.
12
- - ✔ **버전 고정** - 프로젝트가 요구하는 CLI 버전을 설정 파일에 기록하고, 더 낮은 버전의 CLI로는 생성하지 않습니다.
9
+ ## When to use it
13
10
 
14
- ## 빠른 시작
11
+ - You add an entity and need its CRUD API in the shape every other SimpliX API of the project has.
12
+ - You change a field and want the DTOs, the search conditions and the tests to follow.
13
+ - You want hand edits in generated classes to survive the next template change.
15
14
 
16
- ### 1. 실행
15
+ A screen that is not backed by one entity (a dashboard, a report that joins several aggregates) is written by hand; the CLI has nothing to generate it from.
17
16
 
18
- 설치 없이 실행하려면 `npx`를 사용하세요.
17
+ ## Requirements
19
18
 
20
- ```bash
21
- npx @simplix-boot/cli help
22
- ```
19
+ - Node.js 20 or later
20
+ - A Gradle or Maven project that depends on SimpliX
21
+ - The CLI of the same release line as the project's SimpliX
23
22
 
24
- 자주 쓰는 환경에서는 전역으로 설치하세요.
23
+ | Your project | SimpliX line | Install |
24
+ |---|---|---|
25
+ | Spring Boot 4 | 2.x | `npm install -g @simplix-boot/cli` |
26
+ | Spring Boot 3 | 1.x | `npm install -g @simplix-boot/cli@spring-boot-3x` |
27
+
28
+ ## Install
25
29
 
26
30
  ```bash
31
+ # Spring Boot 4 projects (SimpliX 2.x)
27
32
  npm install -g @simplix-boot/cli
28
- simplix-boot help
29
- ```
30
-
31
- Spring Boot 3 기반의 SimpliX 1.x 프로젝트에서는 `@simplix-boot/cli@spring-boot-3x`를 설치하세요. 릴리스 라인별 설치 방법은 [개요](docs/ko/overview.md#릴리스-라인)에 있습니다.
32
33
 
33
- SimpliX 프레임워크 체크아웃이 있으면 그 안의 `simplix-cli`를 전역 명령으로 연결해 사용할 수 있습니다. 게시된 버전을 기다리지 않고 체크아웃의 현재 소스로 실행합니다. 확인과 해제 방법은 [개요](docs/ko/overview.md#설치와-실행)에 있습니다.
34
+ # Spring Boot 3 projects (SimpliX 1.x)
35
+ npm install -g @simplix-boot/cli@spring-boot-3x
34
36
 
35
- ```bash
36
- cd <simplix checkout>/simplix-cli
37
- npm ci
38
- npm link
39
37
  simplix-boot --version
40
38
  ```
41
39
 
42
- ### 2. 프로젝트 설정
40
+ To run it without installing, use `npx @simplix-boot/cli <command>` with the same package spec. [Managing versions](docs/en/managing-versions.md) covers pinning a version for a team and running the CLI from a framework checkout.
41
+
42
+ ## Quick start
43
43
 
44
- 프로젝트 루트에서 `.simplix` 폴더를 만듭니다.
44
+ Run these in the root of a project that already has a JPA entity named `Author` and its repository.
45
45
 
46
46
  ```bash
47
+ # 1. Create the .simplix folder, then write .simplix/generator-simplix.json
47
48
  simplix-boot init
48
- ```
49
49
 
50
- `.simplix/generator-simplix.json`을 작성합니다.
51
-
52
- ```json
53
- {
54
- "entity": {
55
- "scanPath": "src/main/java",
56
- "basePackage": "com.example.library.domain"
57
- },
58
- "repository": {
59
- "scanPath": "src/main/java",
60
- "deriveFromEntity": true
61
- },
62
- "target": {
63
- "generatedBasePath": "generated/main/java/com/example/library/web",
64
- "basePackage": "com.example.library.web",
65
- "targetPath": {
66
- "service": "{modulePath}/service",
67
- "controllerRest": "{modulePath}/controller",
68
- "dto": "{modulePath}/dto"
69
- },
70
- "testGeneratedBasePath": "generated/test/java/com/example/library/web",
71
- "testTargetPath": {
72
- "serviceTest": "{modulePath}/service"
73
- }
74
- },
75
- "promote": {
76
- "moduleRoot": "modules"
77
- }
78
- }
79
- ```
50
+ # 2. Write .simplix/entity/Author.yml from the entity
51
+ simplix-boot config Author
80
52
 
81
- ### 3. 사용
53
+ # 3. Edit the yml, then generate the code into generated/
54
+ simplix-boot generate Author
82
55
 
83
- ```bash
84
- # Write .simplix/entity/Book.yml from the Book entity
85
- simplix-boot config Book
56
+ # 4. Move the generated files into a module
57
+ simplix-boot promote Author --module catalog
86
58
 
87
- # Edit the yml, then generate the code into the generated tree
88
- simplix-boot generate Book
89
-
90
- # Move the generated files into a module as tracked renders
91
- simplix-boot promote Book --module catalog
92
-
93
- # Report the state of every promoted file
59
+ # 5. Check that every promoted file matches the templates
94
60
  simplix-boot generated
95
61
  ```
96
62
 
97
- ## 설정 요약
98
-
99
- `.simplix/generator-simplix.json`의 주요 키입니다. 전체 목록은 [설정 레퍼런스](docs/ko/configuration.md)에 있습니다.
100
-
101
- | 키 | 필수 | 설명 |
102
- |----|------|------|
103
- | `entity.scanPath` | 아니요 | 엔티티 소스를 찾는 경로입니다. 지정하지 않으면 `src/main/java`를 사용합니다. |
104
- | `target.generatedBasePath` | 예 | 생성한 소스를 쓰는 경로입니다. |
105
- | `target.basePackage` | 예 | 생성한 클래스의 기준 패키지입니다. |
106
- | `target.targetPath` | 예 | 구성 요소별 하위 경로입니다. 경로를 지정한 구성 요소만 생성합니다. |
107
- | `template` | 아니요 | 구성 요소별 템플릿 상대 경로입니다. |
108
- | `supportClasses` | 아니요 | 생성 코드가 호출하는 애플리케이션 클래스의 전체 이름입니다. |
109
- | `generator.version` | 아니요 | 프로젝트가 요구하는 CLI 버전입니다. |
110
-
111
- ## 아키텍처
112
-
113
- ```
114
- simplix-cli/
115
- +-- bin/
116
- | +-- simplix-boot.js # Executable entry
117
- +-- src/
118
- | +-- cli.js # Command dispatch, help, exit codes
119
- | +-- commands/ # init, config, generate, promote, generated, templates, version
120
- | +-- lib/
121
- | +-- analysis/ # JPA entity source analysis
122
- | +-- config/ # Entity yml construction
123
- | +-- generate/ # File plan, search fields, template variables
124
- | +-- templates.js # Project template first, built-in template otherwise
125
- | +-- tracked-render.js # Render fingerprint, stored base, three-way merge
126
- +-- templates/ # Built-in templates
127
- +-- test/ # node:test suites and the fixture project
128
- ```
129
-
130
- ## 문서
131
-
132
- | 문서 | 설명 |
133
- |------|------|
134
- | [개요](docs/ko/overview.md) | 처리 흐름, 구성 요소, 설정 구조 |
135
- | [명령 가이드](docs/ko/command-guide.md) | 명령별 인자, 옵션, 종료 코드 |
136
- | [템플릿 가이드](docs/ko/template-guide.md) | 내장 템플릿, 프로젝트 템플릿, 템플릿 변수 |
137
- | [설정 레퍼런스](docs/ko/configuration.md) | `generator-simplix.json`과 엔티티 yml의 키 |
138
- | [전환 가이드](docs/ko/migration-guide.md) | `generator-simplix` 프로젝트에서 사용하는 방법 |
63
+ [Getting started](docs/en/getting-started.md) walks through the same steps with the configuration file, the yml edits and the output of each command.
139
64
 
140
- ## 요구 사항
65
+ ## Documentation
141
66
 
142
- - Node.js 20 이상
143
- - Git (`promote`의 3방향 병합에 `git merge-file`을 사용합니다)
67
+ | If you want to | Read |
68
+ |---|---|
69
+ | generate your first API step by step | [Getting started](docs/en/getting-started.md) |
70
+ | change what the generated code looks like | [Customizing templates](docs/en/customizing-templates.md) |
71
+ | regenerate after a template or yml change without losing edits | [Updating generated code](docs/en/updating-generated-code.md) |
72
+ | install the right line, pin a version, link a checkout | [Managing versions](docs/en/managing-versions.md) |
73
+ | move a project from generator-simplix | [Migrating from generator-simplix](docs/en/migrating-from-generator-simplix.md) |
74
+ | look up a command or an option | [Command reference](docs/en/command-reference.md) |
75
+ | look up a key of the configuration file or the entity yml | [Configuration reference](docs/en/configuration-reference.md) |
76
+ | look up a template variable or a built-in template | [Template reference](docs/en/template-reference.md) |
77
+ | understand what happens inside each command | [How it works](docs/en/how-it-works.md) |
78
+ | fix an error | [Troubleshooting](docs/en/troubleshooting.md) |
144
79
 
145
- ## 라이선스
80
+ ## License
146
81
 
147
- SimpleCORE License 1.0 (SCL-1.0)
82
+ SimpleCORE License 1.0 (SCL-1.0). See [LICENSE](../LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplix-boot/cli",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Command line tool that generates SimpliX Spring Boot code (services, controllers, DTOs, tests) from JPA entities",
5
5
  "type": "module",
6
6
  "bin": {
@@ -250,9 +250,9 @@ class <%= classPrefix %>ServiceTest {
250
250
  entity.set<%= setterSuffix %>(true);
251
251
  <% }
252
252
  }
253
- }); %>
254
- entity.setCreatedAt(Instant.now());
255
- entity.setUpdatedAt(Instant.now());
253
+ }); %><% if (ymlConfig.fields?.createdAt) { %>
254
+ entity.setCreatedAt(Instant.now());<% } %><% if (ymlConfig.fields?.updatedAt) { %>
255
+ entity.setUpdatedAt(Instant.now());<% } %>
256
256
 
257
257
  // Setup DTOs
258
258
  createDto = new <%= classPrefix %>CreateDTO();
@@ -161,9 +161,9 @@ class <%= classPrefix %>TreeServiceTest {
161
161
  entity.set<%= field.name.charAt(0).toUpperCase() + field.name.slice(1) %>(true);
162
162
  <% }
163
163
  }
164
- }); %>
165
- entity.setCreatedAt(Instant.now());
166
- entity.setUpdatedAt(Instant.now());
164
+ }); %><% if (ymlConfig.fields?.createdAt) { %>
165
+ entity.setCreatedAt(Instant.now());<% } %><% if (ymlConfig.fields?.updatedAt) { %>
166
+ entity.setUpdatedAt(Instant.now());<% } %>
167
167
 
168
168
  // Setup child entity
169
169
  childEntity = new <%= entityName %>();
@@ -185,9 +185,9 @@ class <%= classPrefix %>TreeServiceTest {
185
185
  childEntity.set<%= field.name.charAt(0).toUpperCase() + field.name.slice(1) %>(true);
186
186
  <% }
187
187
  }
188
- }); %>
189
- childEntity.setCreatedAt(Instant.now());
190
- childEntity.setUpdatedAt(Instant.now());
188
+ }); %><% if (ymlConfig.fields?.createdAt) { %>
189
+ childEntity.setCreatedAt(Instant.now());<% } %><% if (ymlConfig.fields?.updatedAt) { %>
190
+ childEntity.setUpdatedAt(Instant.now());<% } %>
191
191
 
192
192
  // Setup DTOs
193
193
  createDto = new <%= classPrefix %>CreateDTO();