refactor(cli): move commands to a separate folder
This commit is contained in:
parent
4f8fb441f8
commit
d4d87036df
3 changed files with 11 additions and 11 deletions
|
|
@ -70,7 +70,7 @@ Examples:
|
|||
const plugins = [...(config.plugins ?? []), ...(values.plugin ?? [])];
|
||||
|
||||
try {
|
||||
const { default: upCommand } = await import('./up-command.js');
|
||||
const { default: upCommand } = await import('./commands/up.js');
|
||||
await upCommand({ storage, reporter, directory, plugins, dry });
|
||||
} catch (error) {
|
||||
if (error instanceof ShowUsageError) {
|
||||
|
|
@ -160,7 +160,7 @@ Examples:
|
|||
const name = positionals.join(' ').trim();
|
||||
|
||||
try {
|
||||
const { default: newCommand } = await import('./new-command.js');
|
||||
const { default: newCommand } = await import('./commands/new.js');
|
||||
await newCommand({ directory, template, plugins, extension, reporter }, name);
|
||||
} catch (error) {
|
||||
if (error instanceof ShowUsageError) {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ import fs from 'node:fs/promises';
|
|||
import path from 'node:path';
|
||||
import { getTimestampPrefix, sanitizeMigrationName, getOrLoadPlugin, getOrLoadReporter } from '@emigrate/plugin-tools';
|
||||
import { type MigrationMetadata } from '@emigrate/plugin-tools/types';
|
||||
import { BadOptionError, MissingArgumentsError, MissingOptionError, UnexpectedError } from './errors.js';
|
||||
import { type Config } from './types.js';
|
||||
import { withLeadingPeriod } from './with-leading-period.js';
|
||||
import { BadOptionError, MissingArgumentsError, MissingOptionError, UnexpectedError } from '../errors.js';
|
||||
import { type Config } from '../types.js';
|
||||
import { withLeadingPeriod } from '../with-leading-period.js';
|
||||
|
||||
const lazyDefaultReporter = async () => import('./reporters/default.js');
|
||||
const lazyDefaultReporter = async () => import('../reporters/default.js');
|
||||
|
||||
export default async function newCommand(
|
||||
{ directory, template, reporter: reporterConfig, plugins = [], extension }: Config,
|
||||
|
|
@ -13,10 +13,10 @@ import {
|
|||
MigrationLoadError,
|
||||
MigrationRunError,
|
||||
MissingOptionError,
|
||||
} from './errors.js';
|
||||
import { type Config } from './types.js';
|
||||
import { withLeadingPeriod } from './with-leading-period.js';
|
||||
import pluginLoaderJs from './plugin-loader-js.js';
|
||||
} from '../errors.js';
|
||||
import { type Config } from '../types.js';
|
||||
import { withLeadingPeriod } from '../with-leading-period.js';
|
||||
import pluginLoaderJs from '../plugin-loader-js.js';
|
||||
|
||||
type ExtraFlags = {
|
||||
dry?: boolean;
|
||||
|
|
@ -27,7 +27,7 @@ const getDuration = (start: [number, number]) => {
|
|||
return seconds * 1000 + nanoseconds / 1_000_000;
|
||||
};
|
||||
|
||||
const lazyDefaultReporter = async () => import('./reporters/default.js');
|
||||
const lazyDefaultReporter = async () => import('../reporters/default.js');
|
||||
|
||||
export default async function upCommand({
|
||||
storage: storageConfig,
|
||||
Loading…
Add table
Add a link
Reference in a new issue