dynamo-bao 0.2.5 → 0.2.7

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.7",
4
4
  "description": "Simple powerful data modeling primitives for DynamoDB in JavaScript.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -45,12 +45,13 @@
45
45
  "jest": "^29.7.0",
46
46
  "jsdoc": "^4.0.4",
47
47
  "prettier": "3.4.2",
48
- "serverless": "^3.38.0"
48
+ "serverless": "^3.38.0",
49
+ "eslint-plugin-promise": "^6.1.1"
49
50
  },
50
51
  "bin": {
51
52
  "bao-init": "bin/dynamo-bao-create-table.js",
52
- "bao-codegen": "bin/codegen.js",
53
- "bao-watch": "bin/watch.js",
53
+ "bao-codegen": "./bin/codegen.js",
54
+ "bao-watch": "./bin/watch.js",
54
55
  "bao-delete": "bin/dynamo-bao-delete-table.js"
55
56
  }
56
57
  }
package/src/config.js CHANGED
@@ -18,8 +18,10 @@ function findConfig() {
18
18
 
19
19
  const possibleNames = [
20
20
  "dynamo-bao.config.js",
21
+ "dynamo-bao.config.cjs",
21
22
  ".dynamo-bao/config.js",
22
23
  "config.js",
24
+ "config.cjs",
23
25
  ];
24
26
  const searchPaths = [
25
27
  process.cwd(), // Project root
@@ -64,22 +66,22 @@ function normalizeConfig(rawConfig, configDir) {
64
66
  return {
65
67
  ...rawConfig,
66
68
  paths: {
67
- ...rawConfig.paths,
68
- modelsDir: rawConfig.paths.modelsDir
69
+ ...(rawConfig.paths || {}),
70
+ modelsDir: rawConfig.paths?.modelsDir
69
71
  ? path.resolve(configDir, rawConfig.paths.modelsDir)
70
72
  : null,
71
- modelsDefinitionPath: rawConfig.paths.modelsDefinitionPath
73
+ modelsDefinitionPath: rawConfig.paths?.modelsDefinitionPath
72
74
  ? path.resolve(configDir, rawConfig.paths.modelsDefinitionPath)
73
75
  : null,
74
- fieldsDir: rawConfig.paths.fieldsDir
76
+ fieldsDir: rawConfig.paths?.fieldsDir
75
77
  ? path.resolve(configDir, rawConfig.paths.fieldsDir)
76
78
  : null,
77
- generatedModelsManifest: rawConfig.paths.generatedModelsManifest
79
+ generatedModelsManifest: rawConfig.paths?.generatedModelsManifest
78
80
  ? path.resolve(configDir, rawConfig.paths.generatedModelsManifest)
79
81
  : path.resolve(process.cwd(), ".bao/models.js"),
80
82
  },
81
83
  logging: {
82
- ...rawConfig.logging,
84
+ ...(rawConfig.logging || {}),
83
85
  // Allow environment variable to override config file
84
86
  level: process.env.LOG_LEVEL || rawConfig.logging?.level || "ERROR",
85
87
  },