Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/cli/env.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const loadEnv = (): JunoCliEnv => {
const [_, ...args] = process.argv.slice(2);

const mode = nextArg({args, option: '-m'}) ?? nextArg({args, option: '--mode'});
const profile = nextArg({args, option: '-p'}) ?? nextArg({args, option: '--profile'});
const containerUrl = nextArg({args, option: '--container-url'});

const envContainerUrl =
Expand All @@ -17,7 +18,7 @@ export const loadEnv = (): JunoCliEnv => {
mode: mode ?? 'production',
containerUrl: envContainerUrl,
console: loadEnvConsole({args, mode}),
config: loadEnvConfig({mode}),
config: loadEnvConfig({mode, profile}),
ci
};
};
Expand All @@ -37,10 +38,21 @@ const loadEnvConsole = ({args, mode}: {args?: string[]; mode: string | undefined
};
};

const loadEnvConfig = ({mode}: {mode: string | undefined}): JunoCliConfig => {
const loadEnvConfig = ({
mode,
profile
}: {
mode: string | undefined;
profile: string | undefined;
}): JunoCliConfig => {
// Historically we used "juno" - without environment reference - for production.
// That is why we keep this approach for backwards compatibility.
const projectName = notEmptyString(mode) && mode !== 'production' ? `juno-${mode}` : 'juno';
// That is why we keep this default approach for backwards compatibility.
const modeSuffix =
notEmptyString(mode) && (mode !== 'production' || notEmptyString(profile)) ? `-${mode}` : '';

const profileSuffix = notEmptyString(profile) ? `-${profile}` : '';

const projectName = `juno${profileSuffix}${modeSuffix}`;

return {
projectName,
Expand Down
5 changes: 4 additions & 1 deletion src/constants/help.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const OPTION_KEEP_STAGED = `${yellow('-k, --keep-staged')} Keep stage
export const OPTION_HASH = `${yellow('--hash')} The expected hash of all included changes (for verification).`;
export const OPTION_HELP = `${yellow('-h, --help')} Output usage information.`;
export const OPTION_MODE = `${yellow('-m, --mode')} Choose which environment to use (production, staging, development). Defaults to production if omitted.`;
export const OPTION_PROFILE = `${yellow('-p, --profile')} Specify an optional profile to use (e.g. personal, team). Useful when managing multiple Mission Controls.`;
export const OPTION_SRC = `${yellow('-s, --src')} A path to a specific local gzipped WASM file to publish.`;

export const OPTIONS_UPGRADE = `${yellow('--clear-chunks')} Clear any previously uploaded WASM chunks (applies if the WASM size is greater than 2MB).
Expand All @@ -52,7 +53,9 @@ export const OPTIONS_UPGRADE = `${yellow('--clear-chunks')} Clear any pre
export const OPTIONS_BUILD = `${yellow('-l, --lang')} Specify the language for building the serverless functions: ${magenta('rust')}, ${magenta('typescript')} or ${magenta('javascript')}.
${yellow('--cargo-path')} Path to the Rust manifest.
${yellow('--source-path')} Optional path to the TypeScript or JavaScript entry file.`;
export const OPTIONS_ENV = `${OPTION_MODE}
export const OPTIONS_CONFIG = `${OPTION_MODE}
${OPTION_PROFILE}`;
export const OPTIONS_ENV = `${OPTIONS_CONFIG}
${yellow('--container-url')} Override a custom container URL. If not provided, defaults to production or the local container in development mode.
${yellow('--console-url')} Specify a custom URL to access the developer Console.`;

Expand Down
4 changes: 2 additions & 2 deletions src/help/login.help.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {cyan, green, yellow} from 'kleur';
import {LOGIN_DESCRIPTION, OPTION_HELP, OPTION_MODE} from '../constants/help.constants';
import {LOGIN_DESCRIPTION, OPTION_HELP, OPTIONS_CONFIG} from '../constants/help.constants';
import {helpOutput} from './common.help';
import {TITLE} from './help';

const usage = `Usage: ${green('juno')} ${cyan('login')} ${yellow('[options]')}

Options:
${yellow('-b, --browser')} A particular browser to open. supported: chrome|firefox|edge.
${OPTION_MODE}
${OPTIONS_CONFIG}
${OPTION_HELP}`;

const doc = `${LOGIN_DESCRIPTION}
Expand Down