@noego/proper 0.2.0 → 0.2.1
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/cli.js +7 -3
- package/bin/cli.js.map +1 -1
- package/bin/cli.mjs +8 -3
- package/bin/cli.mjs.map +1 -1
- package/bin/index.js +7 -3
- package/bin/index.js.map +1 -1
- package/bin/index.mjs +7 -3
- package/bin/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +5 -0
package/bin/cli.js
CHANGED
|
@@ -454,8 +454,12 @@ var SqlMigrationBuilder = class {
|
|
|
454
454
|
// framework/MigrationManifest.ts
|
|
455
455
|
var import_fs = __toESM(require("fs"));
|
|
456
456
|
var import_path = __toESM(require("path"));
|
|
457
|
+
var MIGRATION_FILE_REGEX = /(?:\.(mysql|sqlite|pg))?\.(up|down)\.(sql|js)$/i;
|
|
458
|
+
function isMigrationFile(fileName) {
|
|
459
|
+
return MIGRATION_FILE_REGEX.test(fileName);
|
|
460
|
+
}
|
|
457
461
|
function canonicalMigrationKey(value) {
|
|
458
|
-
return value.replace(
|
|
462
|
+
return value.replace(MIGRATION_FILE_REGEX, "").toLowerCase();
|
|
459
463
|
}
|
|
460
464
|
function resolveMigrationFile(directory, baseName, direction, dialect) {
|
|
461
465
|
const dialectExt = dialect === "sql" ? "mysql" : dialect;
|
|
@@ -468,7 +472,7 @@ function resolveMigrationFile(directory, baseName, direction, dialect) {
|
|
|
468
472
|
function loadMigrationManifest(directory, dialect) {
|
|
469
473
|
const manifest = /* @__PURE__ */ new Map();
|
|
470
474
|
if (!import_fs.default.existsSync(directory)) return manifest;
|
|
471
|
-
const files = import_fs.default.readdirSync(directory, { withFileTypes: true }).filter((f) => f.isFile()).map((f) => f.name);
|
|
475
|
+
const files = import_fs.default.readdirSync(directory, { withFileTypes: true }).filter((f) => f.isFile()).map((f) => f.name).filter(isMigrationFile);
|
|
472
476
|
const uniqueKeys = /* @__PURE__ */ new Set();
|
|
473
477
|
files.forEach((file) => uniqueKeys.add(canonicalMigrationKey(file)));
|
|
474
478
|
uniqueKeys.forEach((key) => {
|
|
@@ -505,7 +509,7 @@ var MigrationDirectoryReader = class {
|
|
|
505
509
|
}
|
|
506
510
|
loadMigrations(table, connection) {
|
|
507
511
|
import_fs2.default.existsSync(this.directory) || import_fs2.default.mkdirSync(this.directory);
|
|
508
|
-
const dir_content = import_fs2.default.readdirSync(this.directory, { withFileTypes: true }).filter((file) => file.isFile()).map((file) => file.name);
|
|
512
|
+
const dir_content = import_fs2.default.readdirSync(this.directory, { withFileTypes: true }).filter((file) => file.isFile()).map((file) => file.name).filter(isMigrationFile);
|
|
509
513
|
const uniqueKeys = /* @__PURE__ */ new Set();
|
|
510
514
|
dir_content.forEach((file) => {
|
|
511
515
|
const key = canonicalMigrationKey(file);
|