New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@emigrate/cli

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emigrate/cli - npm Package Compare versions

Comparing version 0.17.2 to 0.18.0

dist/reporters/get.d.ts

70

dist/cli.js

@@ -21,3 +21,2 @@ #!/usr/bin/env node

const up = async (args, abortSignal) => {
const config = await getConfig('up');
const { values } = parseArgs({

@@ -101,3 +100,3 @@ args,

-r, --reporter <name> The reporter to use for reporting the migration progress
-r, --reporter <name> The reporter to use for reporting the migration progress (default: pretty)

@@ -139,3 +138,8 @@ -l, --limit <count> Limit the number of migrations to run

const cwd = process.cwd();
const { directory = config.directory, storage = config.storage, reporter = config.reporter, dry, from, to, limit: limitString, import: imports = [], 'abort-respite': abortRespiteString, 'no-execution': noExecution, } = values;
if (values.import) {
await importAll(cwd, values.import);
}
const forceImportTypeScriptAsIs = values.import?.some((module) => module === 'tsx' || module.startsWith('tsx/'));
const config = await getConfig('up', forceImportTypeScriptAsIs);
const { directory = config.directory, storage = config.storage, reporter = config.reporter, dry, from, to, limit: limitString, 'abort-respite': abortRespiteString, 'no-execution': noExecution, } = values;
const plugins = [...(config.plugins ?? []), ...(values.plugin ?? [])];

@@ -156,3 +160,2 @@ const limit = limitString === undefined ? undefined : Number.parseInt(limitString, 10);

}
await importAll(cwd, imports);
try {

@@ -187,3 +190,2 @@ const { default: upCommand } = await import('./commands/up.js');

const newMigration = async (args) => {
const config = await getConfig('new');
const { values, positionals } = parseArgs({

@@ -218,2 +220,8 @@ args,

},
import: {
type: 'string',
short: 'i',
multiple: true,
default: [],
},
color: {

@@ -239,10 +247,20 @@ type: 'boolean',

-h, --help Show this help message and exit
-d, --directory <path> The directory where the migration files are located (required)
-r, --reporter <name> The reporter to use for reporting the migration file creation progress
-i, --import <module> Additional modules/packages to import before creating the migration (can be specified multiple times)
For example if you want to use Dotenv to load environment variables or when using TypeScript
-r, --reporter <name> The reporter to use for reporting the migration file creation progress (default: pretty)
-p, --plugin <name> The plugin(s) to use (can be specified multiple times)
-t, --template <path> A template file to use as contents for the new migration file
(if the extension option is not provided the template file's extension will be used)
-x, --extension <ext> The extension to use for the new migration file
(if no template or plugin is provided an empty migration file will be created with the given extension)
--color Force color output (this option is passed to the reporter)
--no-color Disable color output (this option is passed to the reporter)

@@ -265,2 +283,7 @@

const cwd = process.cwd();
if (values.import) {
await importAll(cwd, values.import);
}
const forceImportTypeScriptAsIs = values.import?.some((module) => module === 'tsx' || module.startsWith('tsx/'));
const config = await getConfig('new', forceImportTypeScriptAsIs);
const { directory = config.directory, template = config.template, extension = config.extension, reporter = config.reporter, } = values;

@@ -284,3 +307,2 @@ const plugins = [...(config.plugins ?? []), ...(values.plugin ?? [])];

const list = async (args) => {
const config = await getConfig('list');
const { values } = parseArgs({

@@ -327,8 +349,14 @@ args,

-h, --help Show this help message and exit
-d, --directory <path> The directory where the migration files are located (required)
-i, --import <module> Additional modules/packages to import before listing the migrations (can be specified multiple times)
For example if you want to use Dotenv to load environment variables
-r, --reporter <name> The reporter to use for reporting the migrations
-r, --reporter <name> The reporter to use for reporting the migrations (default: pretty)
-s, --storage <name> The storage to use to get the migration history (required)
--color Force color output (this option is passed to the reporter)
--no-color Disable color output (this option is passed to the reporter)

@@ -347,4 +375,8 @@

const cwd = process.cwd();
const { directory = config.directory, storage = config.storage, reporter = config.reporter, import: imports = [], } = values;
await importAll(cwd, imports);
if (values.import) {
await importAll(cwd, values.import);
}
const forceImportTypeScriptAsIs = values.import?.some((module) => module === 'tsx' || module.startsWith('tsx/'));
const config = await getConfig('list', forceImportTypeScriptAsIs);
const { directory = config.directory, storage = config.storage, reporter = config.reporter } = values;
try {

@@ -365,3 +397,2 @@ const { default: listCommand } = await import('./commands/list.js');

const remove = async (args) => {
const config = await getConfig('remove');
const { values, positionals } = parseArgs({

@@ -417,9 +448,16 @@ args,

-h, --help Show this help message and exit
-d, --directory <path> The directory where the migration files are located (required)
-i, --import <module> Additional modules/packages to import before removing the migration (can be specified multiple times)
For example if you want to use Dotenv to load environment variables
-r, --reporter <name> The reporter to use for reporting the removal process
-r, --reporter <name> The reporter to use for reporting the removal process (default: pretty)
-s, --storage <name> The storage to use to get the migration history (required)
-f, --force Force removal of the migration history entry even if the migration is not in a failed state
--color Force color output (this option is passed to the reporter)
--no-color Disable color output (this option is passed to the reporter)

@@ -440,4 +478,8 @@

const cwd = process.cwd();
const { directory = config.directory, storage = config.storage, reporter = config.reporter, force, import: imports = [], } = values;
await importAll(cwd, imports);
if (values.import) {
await importAll(cwd, values.import);
}
const forceImportTypeScriptAsIs = values.import?.some((module) => module === 'tsx' || module.startsWith('tsx/'));
const config = await getConfig('remove', forceImportTypeScriptAsIs);
const { directory = config.directory, storage = config.storage, reporter = config.reporter, force } = values;
try {

@@ -444,0 +486,0 @@ const { default: removeCommand } = await import('./commands/remove.js');

2

dist/commands/list.d.ts

@@ -5,4 +5,4 @@ import { type Config } from '../types.js';

};
export default function listCommand({ directory, reporter: reporterConfig, storage: storageConfig, color, cwd, }: Config & ExtraFlags): Promise<0 | 1>;
export default function listCommand({ directory, reporter: reporterConfig, storage: storageConfig, color, cwd, }: Config & ExtraFlags): Promise<1 | 0>;
export {};
//# sourceMappingURL=list.d.ts.map

@@ -7,3 +7,3 @@ import { getOrLoadReporter, getOrLoadStorage } from '@emigrate/plugin-tools';

import { version } from '../get-package-info.js';
const lazyDefaultReporter = async () => import('../reporters/default.js');
import { getStandardReporter } from '../reporters/get.js';
export default async function listCommand({ directory, reporter: reporterConfig, storage: storageConfig, color, cwd, }) {

@@ -17,3 +17,3 @@ if (!directory) {

}
const reporter = await getOrLoadReporter([reporterConfig ?? lazyDefaultReporter]);
const reporter = getStandardReporter(reporterConfig) ?? (await getOrLoadReporter([reporterConfig]));
if (!reporter) {

@@ -20,0 +20,0 @@ throw BadOptionError.fromOption('reporter', 'No reporter found, please specify an existing reporter using the reporter option');

@@ -10,3 +10,3 @@ import { hrtime } from 'node:process';

import { getDuration } from '../get-duration.js';
const lazyDefaultReporter = async () => import('../reporters/default.js');
import { getStandardReporter } from '../reporters/get.js';
export default async function newCommand({ directory, template, reporter: reporterConfig, plugins = [], cwd, extension, color }, name) {

@@ -22,3 +22,3 @@ if (!directory) {

}
const reporter = await getOrLoadReporter([reporterConfig ?? lazyDefaultReporter]);
const reporter = getStandardReporter(reporterConfig) ?? (await getOrLoadReporter([reporterConfig]));
if (!reporter) {

@@ -25,0 +25,0 @@ throw BadOptionError.fromOption('reporter', 'No reporter found, please specify an existing reporter using the reporter option');

@@ -8,4 +8,4 @@ import { type Config } from '../types.js';

};
export default function removeCommand({ directory, reporter: reporterConfig, storage: storageConfig, color, cwd, force, getMigrations, }: Config & ExtraFlags, name: string): Promise<0 | 1>;
export default function removeCommand({ directory, reporter: reporterConfig, storage: storageConfig, color, cwd, force, getMigrations, }: Config & ExtraFlags, name: string): Promise<1 | 0>;
export {};
//# sourceMappingURL=remove.d.ts.map

@@ -10,3 +10,3 @@ import path from 'node:path';

import { arrayMapAsync } from '../array-map-async.js';
const lazyDefaultReporter = async () => import('../reporters/default.js');
import { getStandardReporter } from '../reporters/get.js';
export default async function removeCommand({ directory, reporter: reporterConfig, storage: storageConfig, color, cwd, force = false, getMigrations, }, name) {

@@ -23,3 +23,3 @@ if (!directory) {

}
const reporter = await getOrLoadReporter([reporterConfig ?? lazyDefaultReporter]);
const reporter = getStandardReporter(reporterConfig) ?? (await getOrLoadReporter([reporterConfig]));
if (!reporter) {

@@ -26,0 +26,0 @@ throw BadOptionError.fromOption('reporter', 'No reporter found, please specify an existing reporter using the reporter option');

@@ -10,3 +10,3 @@ import path from 'node:path';

import { version } from '../get-package-info.js';
const lazyDefaultReporter = async () => import('../reporters/default.js');
import { getStandardReporter } from '../reporters/get.js';
const lazyPluginLoaderJs = async () => import('../plugin-loader-js.js');

@@ -21,3 +21,3 @@ export default async function upCommand({ storage: storageConfig, reporter: reporterConfig, directory, color, limit, from, to, noExecution, abortSignal, abortRespite, dry = false, plugins = [], cwd, getMigrations, }) {

}
const reporter = await getOrLoadReporter([reporterConfig ?? lazyDefaultReporter]);
const reporter = getStandardReporter(reporterConfig) ?? (await getOrLoadReporter([reporterConfig]));
if (!reporter) {

@@ -24,0 +24,0 @@ throw BadOptionError.fromOption('reporter', 'No reporter found, please specify an existing reporter using the reporter option');

import { type Config } from './types.js';
declare const commands: readonly ["up", "list", "new", "remove"];
type Command = (typeof commands)[number];
export declare const getConfig: (command: Command) => Promise<Config>;
export declare const getConfig: (command: Command, forceImportTypeScriptAsIs?: boolean) => Promise<Config>;
export {};
//# sourceMappingURL=get-config.d.ts.map

@@ -1,5 +0,10 @@

import { cosmiconfig } from 'cosmiconfig';
import process from 'node:process';
import { cosmiconfig, defaultLoaders } from 'cosmiconfig';
const commands = ['up', 'list', 'new', 'remove'];
export const getConfig = async (command) => {
const explorer = cosmiconfig('emigrate');
const canImportTypeScriptAsIs = Boolean(process.isBun) || typeof Deno !== 'undefined';
export const getConfig = async (command, forceImportTypeScriptAsIs = false) => {
const explorer = cosmiconfig('emigrate', {
// eslint-disable-next-line @typescript-eslint/naming-convention
loaders: forceImportTypeScriptAsIs || canImportTypeScriptAsIs ? { '.ts': defaultLoaders['.js'] } : undefined,
});
const result = await explorer.search();

@@ -6,0 +11,0 @@ if (!result?.config) {

import { type EmigrateStorage, type Awaitable, type Plugin, type EmigrateReporter } from '@emigrate/types';
import type * as reporters from './reporters/index.js';
export type StandardReporter = keyof typeof reporters;
export type EmigratePlugin = Plugin;

@@ -8,3 +10,3 @@ type StringOrModule<T> = string | T | (() => Awaitable<T>) | (() => Awaitable<{

storage?: StringOrModule<EmigrateStorage>;
reporter?: StringOrModule<EmigrateReporter>;
reporter?: StandardReporter | StringOrModule<EmigrateReporter>;
plugins?: Array<StringOrModule<EmigratePlugin>>;

@@ -11,0 +13,0 @@ directory?: string;

{
"name": "@emigrate/cli",
"version": "0.17.2",
"version": "0.18.0",
"publishConfig": {

@@ -32,2 +32,4 @@ "access": "public",

"devDependencies": {
"@types/bun": "1.0.5",
"bun-types": "1.0.26",
"@emigrate/tsconfig": "1.0.2"

@@ -34,0 +36,0 @@ },

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

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc