@emigrate/cli
Advanced tools
Comparing version 0.16.1 to 0.16.2
@@ -1,2 +0,1 @@ | ||
import { extname } from 'node:path'; | ||
import { toMigrationMetadata } from './to-migration-metadata.js'; | ||
@@ -7,10 +6,11 @@ import { getMigrations as getMigrationsOriginal } from './get-migrations.js'; | ||
const seen = new Set(); | ||
for await (const entry_ of history) { | ||
const entry = extname(entry_.name) === '' ? { ...entry_, name: `${entry_.name}.js` } : entry_; | ||
const index = allMigrations.findIndex((migrationFile) => migrationFile.name === entry.name); | ||
if (index === -1) { | ||
for await (const entry of history) { | ||
const migration = allMigrations.find((migrationFile) => { | ||
return migrationFile.name === entry.name || migrationFile.name === `${entry.name}.js`; | ||
}); | ||
if (!migration) { | ||
continue; | ||
} | ||
yield toMigrationMetadata(entry, { cwd, directory }); | ||
seen.add(entry.name); | ||
yield toMigrationMetadata({ ...entry, name: migration.name }, { cwd, directory }); | ||
seen.add(migration.name); | ||
} | ||
@@ -17,0 +17,0 @@ yield* allMigrations.filter((migration) => !seen.has(migration.name)); |
import { describe, it, mock } from 'node:test'; | ||
import assert from 'node:assert'; | ||
import path from 'node:path'; | ||
import { deserializeError, serializeError } from 'serialize-error'; | ||
import { version } from '../get-package-info.js'; | ||
import { BadOptionError, CommandAbortError, ExecutionDesertedError, MigrationHistoryError, MigrationRunError, StorageInitError, } from '../errors.js'; | ||
import { toEntries, toEntry, toMigrations } from '../test-utils.js'; | ||
import upCommand from './up.js'; | ||
@@ -425,36 +425,2 @@ describe('up', () => { | ||
} | ||
function toMigration(cwd, directory, name) { | ||
return { | ||
name, | ||
filePath: `${cwd}/${directory}/${name}`, | ||
relativeFilePath: `${directory}/${name}`, | ||
extension: path.extname(name), | ||
directory, | ||
cwd, | ||
}; | ||
} | ||
function toMigrations(cwd, directory, names) { | ||
return names.map((name) => toMigration(cwd, directory, name)); | ||
} | ||
function toEntry(name, status) { | ||
if (typeof name !== 'string') { | ||
return name.status === 'failed' ? name : name; | ||
} | ||
if (status === 'failed') { | ||
return { | ||
name, | ||
status, | ||
date: new Date(), | ||
error: { name: 'Error', message: 'Failed' }, | ||
}; | ||
} | ||
return { | ||
name, | ||
status: status ?? 'done', | ||
date: new Date(), | ||
}; | ||
} | ||
function toEntries(names, status) { | ||
return names.map((name) => (typeof name === 'string' ? toEntry(name, status) : name)); | ||
} | ||
async function noop() { | ||
@@ -461,0 +427,0 @@ // noop |
{ | ||
"name": "@emigrate/cli", | ||
"version": "0.16.1", | ||
"version": "0.16.2", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
264788
112
2776