dbmate 1.0.2 → 1.16.0

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.
Binary file
Binary file
Binary file
Binary file
package/dist/DbMate.d.ts CHANGED
@@ -1,9 +1,14 @@
1
+ declare type Args = {
2
+ migrationsDir?: string;
3
+ };
1
4
  declare class DbMate {
2
5
  private binaryPath;
3
6
  private dbUrl;
4
- constructor(dbUrl: string);
7
+ private args;
8
+ constructor(dbUrl: string, args?: Args);
5
9
  up(): Promise<void>;
6
10
  down(): Promise<void>;
7
11
  drop(): Promise<void>;
12
+ private buildCliArgs;
8
13
  }
9
14
  export default DbMate;
package/dist/DbMate.js CHANGED
@@ -39,14 +39,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var child_process_1 = require("child_process");
40
40
  var resolve_1 = require("./resolve");
41
41
  var DbMate = /** @class */ (function () {
42
- function DbMate(dbUrl) {
42
+ function DbMate(dbUrl, args) {
43
43
  this.binaryPath = resolve_1.calculateBinaryPath();
44
44
  this.dbUrl = dbUrl;
45
+ this.args = args;
45
46
  }
46
47
  DbMate.prototype.up = function () {
47
48
  return __awaiter(this, void 0, void 0, function () {
49
+ var cmd;
48
50
  return __generator(this, function (_a) {
49
- child_process_1.execSync(this.binaryPath + " --env DB_URL up", {
51
+ cmd = this.binaryPath + " --env DB_URL " + this.buildCliArgs() + " up";
52
+ child_process_1.execSync(cmd, {
50
53
  env: {
51
54
  DB_URL: this.dbUrl,
52
55
  },
@@ -57,8 +60,10 @@ var DbMate = /** @class */ (function () {
57
60
  };
58
61
  DbMate.prototype.down = function () {
59
62
  return __awaiter(this, void 0, void 0, function () {
63
+ var cmd;
60
64
  return __generator(this, function (_a) {
61
- child_process_1.execSync(this.binaryPath + " --env DB_URL down", {
65
+ cmd = this.binaryPath + " --env DB_URL " + this.buildCliArgs() + " down";
66
+ child_process_1.execSync(cmd, {
62
67
  env: {
63
68
  DB_URL: this.dbUrl,
64
69
  },
@@ -69,8 +74,10 @@ var DbMate = /** @class */ (function () {
69
74
  };
70
75
  DbMate.prototype.drop = function () {
71
76
  return __awaiter(this, void 0, void 0, function () {
77
+ var cmd;
72
78
  return __generator(this, function (_a) {
73
- child_process_1.execSync(this.binaryPath + " --env DB_URL drop", {
79
+ cmd = this.binaryPath + " --env DB_URL " + this.buildCliArgs() + " drop";
80
+ child_process_1.execSync(cmd, {
74
81
  env: {
75
82
  DB_URL: this.dbUrl,
76
83
  },
@@ -79,6 +86,15 @@ var DbMate = /** @class */ (function () {
79
86
  });
80
87
  });
81
88
  };
89
+ DbMate.prototype.buildCliArgs = function () {
90
+ var _a;
91
+ // additional cli args
92
+ var cliArgs = [];
93
+ if (((_a = this.args) === null || _a === void 0 ? void 0 : _a.migrationsDir) != undefined) {
94
+ cliArgs.push("-d \"" + this.args.migrationsDir + "\"");
95
+ }
96
+ return cliArgs.join(' ');
97
+ };
82
98
  return DbMate;
83
99
  }());
84
100
  exports.default = DbMate;
package/dist/cli.js CHANGED
File without changes
package/dist/resolve.js CHANGED
@@ -1,12 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var child_process_1 = require("child_process");
4
3
  var path_1 = require("path");
5
4
  var fs_1 = require("fs");
6
- function isMusl() {
7
- var output = child_process_1.spawnSync('ldd', ['--version']).stderr.toString();
8
- return output.indexOf('musl') >= 0;
9
- }
10
5
  function archName() {
11
6
  switch (process.arch) {
12
7
  case 'x64':
@@ -22,7 +17,7 @@ function platformName() {
22
17
  case 'darwin':
23
18
  return 'macos';
24
19
  case 'linux':
25
- return isMusl ? 'linux-musl' : 'linux';
20
+ return 'linux';
26
21
  default:
27
22
  throw new Error("Unsupported platform: " + process.platform);
28
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbmate",
3
- "version": "1.0.2",
3
+ "version": "1.16.0",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "build:docs": "typedoc ./src/*.ts",
Binary file