dynamo-bao 0.2.5 → 0.2.6

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/bin/codegen.js CHANGED
@@ -100,14 +100,13 @@ function loadModelDefinitions(definitionsPath, fieldResolver) {
100
100
  function main() {
101
101
  const args = process.argv.slice(2);
102
102
 
103
- // Set default paths, but prefer config paths if available
104
- let definitionsPath = config?.paths?.modelsDefinitionPath
105
- ? path.resolve(process.cwd(), config.paths.modelsDefinitionPath)
106
- : path.resolve(process.cwd(), "./models.yaml");
107
-
108
- let outputDir = config?.paths?.modelsDir
109
- ? path.resolve(process.cwd(), config.paths.modelsDir)
110
- : path.resolve(process.cwd(), "./models");
103
+ // Paths should be pre-resolved by the config loader.
104
+ let definitionsPath =
105
+ config?.paths?.modelsDefinitionPath ||
106
+ path.resolve(process.cwd(), "./models.yaml");
107
+
108
+ let outputDir =
109
+ config?.paths?.modelsDir || path.resolve(process.cwd(), "./models");
111
110
 
112
111
  // Override with command line arguments if provided
113
112
  if (args.length >= 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamo-bao",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Simple powerful data modeling primitives for DynamoDB in JavaScript.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/config.js CHANGED
@@ -64,22 +64,22 @@ function normalizeConfig(rawConfig, configDir) {
64
64
  return {
65
65
  ...rawConfig,
66
66
  paths: {
67
- ...rawConfig.paths,
68
- modelsDir: rawConfig.paths.modelsDir
67
+ ...(rawConfig.paths || {}),
68
+ modelsDir: rawConfig.paths?.modelsDir
69
69
  ? path.resolve(configDir, rawConfig.paths.modelsDir)
70
70
  : null,
71
- modelsDefinitionPath: rawConfig.paths.modelsDefinitionPath
71
+ modelsDefinitionPath: rawConfig.paths?.modelsDefinitionPath
72
72
  ? path.resolve(configDir, rawConfig.paths.modelsDefinitionPath)
73
73
  : null,
74
- fieldsDir: rawConfig.paths.fieldsDir
74
+ fieldsDir: rawConfig.paths?.fieldsDir
75
75
  ? path.resolve(configDir, rawConfig.paths.fieldsDir)
76
76
  : null,
77
- generatedModelsManifest: rawConfig.paths.generatedModelsManifest
77
+ generatedModelsManifest: rawConfig.paths?.generatedModelsManifest
78
78
  ? path.resolve(configDir, rawConfig.paths.generatedModelsManifest)
79
79
  : path.resolve(process.cwd(), ".bao/models.js"),
80
80
  },
81
81
  logging: {
82
- ...rawConfig.logging,
82
+ ...(rawConfig.logging || {}),
83
83
  // Allow environment variable to override config file
84
84
  level: process.env.LOG_LEVEL || rawConfig.logging?.level || "ERROR",
85
85
  },