rake-db 2.10.26 → 2.10.28

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/dist/index.js CHANGED
@@ -65,6 +65,12 @@ const processRakeDbConfig = (config) => {
65
65
  "Failed to determine path to db script. Please set basePath option of rakeDb"
66
66
  );
67
67
  }
68
+ const ext = path.extname(filePath);
69
+ if (ext !== ".ts" && ext !== ".js" && ext !== ".mjs") {
70
+ throw new Error(
71
+ `Add a .ts suffix to the "${path.basename(filePath)}" when calling it`
72
+ );
73
+ }
68
74
  result.basePath = path.dirname(filePath);
69
75
  result.dbScript = path.basename(filePath);
70
76
  }
@@ -245,11 +251,11 @@ const getMigrations = async (config, up) => {
245
251
  };
246
252
  });
247
253
  };
248
- function checkExt(path2) {
249
- const ext = path2.slice(-3);
250
- if (ext !== ".ts" && ext !== ".js") {
254
+ function checkExt(filePath) {
255
+ const ext = path.extname(filePath);
256
+ if (ext !== ".ts" && ext !== ".js" && ext !== ".mjs") {
251
257
  throw new Error(
252
- `Only .ts and .js files are supported for migration, received: ${path2}`
258
+ `Only .ts and .js files are supported for migration, received: ${path}`
253
259
  );
254
260
  }
255
261
  }