create-backlist 6.2.0 → 6.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-backlist",
3
- "version": "6.2.0",
3
+ "version": "6.2.1",
4
4
  "description": "An advanced, multi-language backend generator based on frontend analysis.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -68,7 +68,6 @@ async function appendApplicationProperties(projectDir, artifactId) {
68
68
  }
69
69
 
70
70
  function buildModelsFromEndpoints(endpoints) {
71
- // Create models even when schemaFields is null (GET-only APIs).
72
71
  const modelsToGenerate = new Map();
73
72
 
74
73
  (Array.isArray(endpoints) ? endpoints : []).forEach((ep) => {
@@ -161,7 +160,6 @@ async function generateJavaProject(options) {
161
160
 
162
161
  const modelsToGenerate = buildModelsFromEndpoints(endpoints);
163
162
 
164
- // Spring Initializr extracts into projectDir directly. Java package folder:
165
163
  const javaSrcRoot = path.join(
166
164
  projectDir,
167
165
  "src",
@@ -171,7 +169,6 @@ async function generateJavaProject(options) {
171
169
  artifactId.replace(/-/g, "")
172
170
  );
173
171
 
174
- // Always ensure base package dirs exist
175
172
  await fs.ensureDir(javaSrcRoot);
176
173
 
177
174
  if (modelsToGenerate.size > 0) {
@@ -186,22 +183,23 @@ async function generateJavaProject(options) {
186
183
  await fs.ensureDir(controllerDir);
187
184
 
188
185
  for (const model of modelsToGenerate.values()) {
186
+ // FIXED: Added 'group' key to all renderAndWrite calls
189
187
  await renderAndWrite(
190
188
  getTemplatePath("java-spring/partials/Entity.java.ejs"),
191
189
  path.join(entityDir, `${model.name}.java`),
192
- { projectName, groupId, artifactId, model }
190
+ { projectName, groupId, artifactId, group: groupId, model }
193
191
  );
194
192
 
195
193
  await renderAndWrite(
196
194
  getTemplatePath("java-spring/partials/Repository.java.ejs"),
197
195
  path.join(repoDir, `${model.name}Repository.java`),
198
- { projectName, groupId, artifactId, model }
196
+ { projectName, groupId, artifactId, group: groupId, model }
199
197
  );
200
198
 
201
199
  await renderAndWrite(
202
200
  getTemplatePath("java-spring/partials/Controller.java.ejs"),
203
201
  path.join(controllerDir, `${model.name}Controller.java`),
204
- { projectName, groupId, artifactId, model }
202
+ { projectName, groupId, artifactId, group: groupId, model }
205
203
  );
206
204
  }
207
205
  } else {
@@ -215,10 +213,8 @@ async function generateJavaProject(options) {
215
213
  console.log(chalk.cyan(` cd ${path.basename(projectDir)}`));
216
214
  console.log(chalk.cyan(" ./mvnw spring-boot:run # or use your IDE to run the Application class"));
217
215
  } catch (error) {
218
- // Better Initializr error print
219
216
  if (error && error.response && error.response.status) {
220
217
  console.error(chalk.red(` -> Initializr error status: ${error.response.status}`));
221
-
222
218
  try {
223
219
  if (error.response.data) {
224
220
  let text = "";
@@ -228,10 +224,8 @@ async function generateJavaProject(options) {
228
224
  } catch {
229
225
  // ignore
230
226
  }
231
-
232
227
  throw new Error(`Failed to download from Spring Initializr. Status: ${error.response.status}`);
233
228
  }
234
-
235
229
  throw error;
236
230
  }
237
231
  }