From 15954d00cf7f691d3d23ff9fc64b4d650f8fac04 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Wed, 26 Mar 2025 12:41:32 +0100 Subject: [PATCH] fix: recursive imports by constants --- src/constants/help.constants.ts | 20 ++++++++++++++++++++ src/help/clear.help.ts | 4 +--- src/help/config.help.ts | 3 +-- src/help/deploy.help.ts | 3 +-- src/help/dev.help.ts | 4 +--- src/help/help.ts | 32 +++++++++++++++++--------------- src/help/init.help.ts | 3 +-- src/help/login.help.ts | 4 +--- src/help/logout.help.ts | 4 +--- src/help/open.help.ts | 3 +-- src/help/snapshot.help.ts | 3 +-- src/help/start.help.ts | 3 +-- src/help/stop.help.ts | 3 +-- src/help/upgrade.help.ts | 3 +-- src/help/use.help.ts | 3 +-- src/help/version.help.ts | 3 +-- src/help/whoami.help.ts | 4 +--- 17 files changed, 52 insertions(+), 50 deletions(-) create mode 100644 src/constants/help.constants.ts diff --git a/src/constants/help.constants.ts b/src/constants/help.constants.ts new file mode 100644 index 00000000..f899fa4d --- /dev/null +++ b/src/constants/help.constants.ts @@ -0,0 +1,20 @@ +export const CLEAR_DESCRIPTION = + 'Clear existing dapp code by removing JavaScript, HTML, CSS, and other files from your satellite.'; +export const CONFIG_DESCRIPTION = 'Apply configuration to satellite.'; +export const DEPLOY_DESCRIPTION = 'Deploy your dapp to your satellite.'; +export const DEV_DESCRIPTION = + 'Handle development tasks like building serverless functions or running a local Internet Computer instance.'; +export const INIT_DESCRIPTION = 'Set up your project.'; +export const LOGIN_DESCRIPTION = + 'Generate an authentication for use in non-interactive environments.'; +export const LOGOUT_DESCRIPTION = + 'Log out of the current device. ⚠️ This action does not remove controllers from the module.'; +export const OPEN_DESCRIPTION = 'Open your satellite in your browser.'; +export const SNAPSHOT_DESCRIPTION = 'Handle snapshot-related tasks.'; +export const START_DESCRIPTION = 'Start a module.'; +export const STOP_DESCRIPTION = 'Stop a module.'; +export const UPGRADE_DESCRIPTION = 'Upgrade a module to a new version.'; +export const USE_DESCRIPTION = 'Switch between multiple profiles.'; +export const VERSION_DESCRIPTION = 'Check the version of the modules and CLI.'; +export const WHOAMI_DESCRIPTION = + 'Display your current profile, controller, and links to your satellite.'; diff --git a/src/help/clear.help.ts b/src/help/clear.help.ts index e6f12886..2556fbb6 100644 --- a/src/help/clear.help.ts +++ b/src/help/clear.help.ts @@ -1,10 +1,8 @@ import {cyan, green, yellow} from 'kleur'; +import {CLEAR_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; -export const CLEAR_DESCRIPTION = - 'Clear existing dapp code by removing JavaScript, HTML, CSS, and other files from your satellite.'; - const usage = `Usage: ${green('juno')} ${cyan('clear')} ${yellow('[options]')} Options: diff --git a/src/help/config.help.ts b/src/help/config.help.ts index 1f7aca64..4c2da013 100644 --- a/src/help/config.help.ts +++ b/src/help/config.help.ts @@ -1,9 +1,8 @@ import {cyan, green, yellow} from 'kleur'; +import {CONFIG_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; -export const CONFIG_DESCRIPTION = 'Apply configuration to satellite.'; - const usage = `Usage: ${green('juno')} ${cyan('config')} ${yellow('[options]')} Options: diff --git a/src/help/deploy.help.ts b/src/help/deploy.help.ts index 53b83958..22d9ff47 100644 --- a/src/help/deploy.help.ts +++ b/src/help/deploy.help.ts @@ -1,9 +1,8 @@ import {cyan, green, yellow} from 'kleur'; +import {DEPLOY_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; -export const DEPLOY_DESCRIPTION = 'Deploy your dapp to your satellite.'; - const usage = `Usage: ${green('juno')} ${cyan('deploy')} ${yellow('[options]')} Options: diff --git a/src/help/dev.help.ts b/src/help/dev.help.ts index 3652ca9b..e0f3bb67 100644 --- a/src/help/dev.help.ts +++ b/src/help/dev.help.ts @@ -1,10 +1,8 @@ import {cyan, green, magenta, yellow} from 'kleur'; +import {DEV_DESCRIPTION} from '../constants/help.constants'; import {helpOutput} from './common.help'; import {TITLE} from './help'; -export const DEV_DESCRIPTION = - 'Handle development tasks like building serverless functions or running a local Internet Computer instance.'; - const helpDevStart = `${magenta( 'start' )} Start a local Internet Computer network in a container.`; diff --git a/src/help/help.ts b/src/help/help.ts index 873590ad..75a0b592 100644 --- a/src/help/help.ts +++ b/src/help/help.ts @@ -1,20 +1,22 @@ import {cyan, green, grey} from 'kleur'; import {version} from '../../package.json'; -import {CLEAR_DESCRIPTION} from './clear.help'; -import {CONFIG_DESCRIPTION} from './config.help'; -import {DEPLOY_DESCRIPTION} from './deploy.help'; -import {DEV_DESCRIPTION} from './dev.help'; -import {INIT_DESCRIPTION} from './init.help'; -import {LOGIN_DESCRIPTION} from './login.help'; -import {LOGOUT_DESCRIPTION} from './logout.help'; -import {OPEN_DESCRIPTION} from './open.help'; -import {SNAPSHOT_DESCRIPTION} from './snapshot.help'; -import {START_DESCRIPTION} from './start.help'; -import {STOP_DESCRIPTION} from './stop.help'; -import {UPGRADE_DESCRIPTION} from './upgrade.help'; -import {USE_DESCRIPTION} from './use.help'; -import {VERSION_DESCRIPTION} from './version.help'; -import {WHOAMI_DESCRIPTION} from './whoami.help'; +import { + CLEAR_DESCRIPTION, + CONFIG_DESCRIPTION, + DEPLOY_DESCRIPTION, + DEV_DESCRIPTION, + INIT_DESCRIPTION, + LOGIN_DESCRIPTION, + LOGOUT_DESCRIPTION, + OPEN_DESCRIPTION, + SNAPSHOT_DESCRIPTION, + START_DESCRIPTION, + STOP_DESCRIPTION, + UPGRADE_DESCRIPTION, + USE_DESCRIPTION, + VERSION_DESCRIPTION, + WHOAMI_DESCRIPTION +} from '../constants/help.constants'; const JUNO_LOGO = ` __ __ __ __ _ ____ __) || | || \\| |/ \\ diff --git a/src/help/init.help.ts b/src/help/init.help.ts index b0143000..713058e7 100644 --- a/src/help/init.help.ts +++ b/src/help/init.help.ts @@ -1,9 +1,8 @@ import {cyan, green, yellow} from 'kleur'; +import {INIT_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; -export const INIT_DESCRIPTION = 'Set up your project.'; - const usage = `Usage: ${green('juno')} ${cyan('init')} ${yellow('[options]')} Options: diff --git a/src/help/login.help.ts b/src/help/login.help.ts index e9f7194d..dccf8cc6 100644 --- a/src/help/login.help.ts +++ b/src/help/login.help.ts @@ -1,10 +1,8 @@ import {cyan, green, yellow} from 'kleur'; +import {LOGIN_DESCRIPTION} from '../constants/help.constants'; import {helpOutput} from './common.help'; import {TITLE} from './help'; -export const LOGIN_DESCRIPTION = - 'Generate an authentication for use in non-interactive environments.'; - const usage = `Usage: ${green('juno')} ${cyan('login')} ${yellow('[options]')} Options: diff --git a/src/help/logout.help.ts b/src/help/logout.help.ts index 0a724bc3..e34aee90 100644 --- a/src/help/logout.help.ts +++ b/src/help/logout.help.ts @@ -1,8 +1,6 @@ +import {LOGOUT_DESCRIPTION} from '../constants/help.constants'; import {logHelp} from './generic.help'; -export const LOGOUT_DESCRIPTION = - 'Log out of the current device. ⚠️ This action does not remove controllers from the module.'; - export const logHelpLogout = (args?: string[]) => { logHelp({args, command: 'logout', description: LOGOUT_DESCRIPTION}); }; diff --git a/src/help/open.help.ts b/src/help/open.help.ts index 8e95b708..550d0347 100644 --- a/src/help/open.help.ts +++ b/src/help/open.help.ts @@ -1,9 +1,8 @@ import {cyan, green, yellow} from 'kleur'; +import {OPEN_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; -export const OPEN_DESCRIPTION = 'Open your satellite in your browser.'; - const usage = `Usage: ${green('juno')} ${cyan('open')} ${yellow('[options]')} Options: diff --git a/src/help/snapshot.help.ts b/src/help/snapshot.help.ts index d5b2982b..120e8f2b 100644 --- a/src/help/snapshot.help.ts +++ b/src/help/snapshot.help.ts @@ -1,10 +1,9 @@ import {cyan, green, magenta, yellow} from 'kleur'; +import {SNAPSHOT_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; import {TARGET_OPTION_NOTE, targetOption} from './target.help'; -export const SNAPSHOT_DESCRIPTION = 'Handle snapshot-related tasks.'; - const usage = `Usage: ${green('juno')} ${cyan('snapshot')} ${magenta('')} ${yellow('[options]')} Subcommands: diff --git a/src/help/start.help.ts b/src/help/start.help.ts index 02b2e89e..073dd264 100644 --- a/src/help/start.help.ts +++ b/src/help/start.help.ts @@ -1,9 +1,8 @@ import {cyan, green, magenta, yellow} from 'kleur'; +import {START_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; -export const START_DESCRIPTION = 'Start a module.'; - const usage = `Usage: ${green('juno')} ${cyan('start')} ${yellow('[options]')} Options: diff --git a/src/help/stop.help.ts b/src/help/stop.help.ts index 271e5638..30048382 100644 --- a/src/help/stop.help.ts +++ b/src/help/stop.help.ts @@ -1,9 +1,8 @@ import {cyan, green, magenta, yellow} from 'kleur'; +import {STOP_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; -export const STOP_DESCRIPTION = 'Stop a module.'; - const usage = `Usage: ${green('juno')} ${cyan('stop')} ${yellow('[options]')} Options: diff --git a/src/help/upgrade.help.ts b/src/help/upgrade.help.ts index 5267da30..28d94a0a 100644 --- a/src/help/upgrade.help.ts +++ b/src/help/upgrade.help.ts @@ -1,10 +1,9 @@ import {cyan, green, yellow} from 'kleur'; +import {UPGRADE_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; import {TARGET_OPTION_NOTE, targetOption} from './target.help'; -export const UPGRADE_DESCRIPTION = 'Upgrade a module to a new version.'; - const usage = `Usage: ${green('juno')} ${cyan('upgrade')} ${yellow('[options]')} Options: diff --git a/src/help/use.help.ts b/src/help/use.help.ts index 01f59d2e..0dcacde8 100644 --- a/src/help/use.help.ts +++ b/src/help/use.help.ts @@ -1,9 +1,8 @@ import {cyan, green, yellow} from 'kleur'; +import {USE_DESCRIPTION} from '../constants/help.constants'; import {helpOutput} from './common.help'; import {TITLE} from './help'; -export const USE_DESCRIPTION = 'Switch between multiple profiles.'; - const usage = `Usage: ${green('juno')} ${cyan('use')} ${yellow('[options]')} Options: diff --git a/src/help/version.help.ts b/src/help/version.help.ts index af093118..9dae8465 100644 --- a/src/help/version.help.ts +++ b/src/help/version.help.ts @@ -1,9 +1,8 @@ import {cyan, green, yellow} from 'kleur'; +import {VERSION_DESCRIPTION} from '../constants/help.constants'; import {helpMode, helpOutput} from './common.help'; import {TITLE} from './help'; -export const VERSION_DESCRIPTION = 'Check the version of the modules and CLI.'; - const usage = `Usage: ${green('juno')} ${cyan('init')} ${yellow('[options]')} Options: diff --git a/src/help/whoami.help.ts b/src/help/whoami.help.ts index ffc006b5..cc5ebe97 100644 --- a/src/help/whoami.help.ts +++ b/src/help/whoami.help.ts @@ -1,8 +1,6 @@ +import {WHOAMI_DESCRIPTION} from '../constants/help.constants'; import {logHelpWithMode} from './generic.help'; -export const WHOAMI_DESCRIPTION = - 'Display your current profile, controller, and links to your satellite.'; - export const logHelpWhoAmI = (args?: string[]) => { logHelpWithMode({args, command: 'whoami', description: WHOAMI_DESCRIPTION}); };