dynamo-bao 0.2.3 → 0.2.4

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.
@@ -135,21 +135,25 @@ function generateModelClass(
135
135
 
136
136
  logger.debug("fieldResolver customFields", fieldResolver.customFieldsPath);
137
137
 
138
- // get relative path for fieldResolver.customFieldsPath from projectPath
139
- const relativePath = path.relative(outputDir, fieldResolver.customFieldsPath);
140
- logger.debug("relativePath", relativePath);
141
-
142
- // Generate custom field imports
143
- const customFieldImports = Array.from(customFields)
144
- .map((fieldType) => {
145
- // Remove 'Field' suffix before converting to kebab case
146
- const baseName = fieldType.replace(/Field$/, "");
147
- const kebabName = baseName
148
- .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
149
- .toLowerCase();
150
- return `const { ${fieldType} } = require('${relativePath}/${kebabName}-field');`;
151
- })
152
- .join("\n");
138
+ // Generate custom field imports only if we have custom fields and a path
139
+ const customFieldImports =
140
+ customFields.size > 0 && fieldResolver.customFieldsPath
141
+ ? Array.from(customFields)
142
+ .map((fieldType) => {
143
+ // Remove 'Field' suffix before converting to kebab case
144
+ const baseName = fieldType.replace(/Field$/, "");
145
+ const kebabName = baseName
146
+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")
147
+ .toLowerCase();
148
+ // get relative path for fieldResolver.customFieldsPath from projectPath
149
+ const relativePath = path.relative(
150
+ outputDir,
151
+ fieldResolver.customFieldsPath,
152
+ );
153
+ return `const { ${fieldType} } = require('${relativePath}/${kebabName}-field');`;
154
+ })
155
+ .join("\n")
156
+ : "";
153
157
 
154
158
  // Generate the final code with separated imports
155
159
  return `// 🧨 🧨 🧨 🧨 🧨 🧨 🧨 🧨 🧨 🧨 🧨 🧨 🧨 🧨 🧨
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamo-bao",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Simple powerful data modeling primitives for DynamoDB in JavaScript.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {