messages.ts — astro Source File
Architecture documentation for messages.ts, a typescript file in the astro codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d28938aa_d420_d4d1_6b36_01f3df03707d["messages.ts"] a92de0dc_dbd8_66cd_eaac_504972b46b30["./actions/context.js"] d28938aa_d420_d4d1_6b36_01f3df03707d --> a92de0dc_dbd8_66cd_eaac_504972b46b30 c7b46054_ae5f_7503_1e47_74f63740b601["./shell.js"] d28938aa_d420_d4d1_6b36_01f3df03707d --> c7b46054_ae5f_7503_1e47_74f63740b601 44da03af_fba3_824c_9c9c_2685d1d33d31["cli-kit"] d28938aa_d420_d4d1_6b36_01f3df03707d --> 44da03af_fba3_824c_9c9c_2685d1d33d31 3b35366d_8979_cafe_57a9_c7ee6fd913bc["utils"] d28938aa_d420_d4d1_6b36_01f3df03707d --> 3b35366d_8979_cafe_57a9_c7ee6fd913bc 61b635e2_549a_1d06_be03_2c8dced634c4["package-manager-detector"] d28938aa_d420_d4d1_6b36_01f3df03707d --> 61b635e2_549a_1d06_be03_2c8dced634c4 05ae5a22_03dc_ffb8_1623_bb1a50959413["terminal-link"] d28938aa_d420_d4d1_6b36_01f3df03707d --> 05ae5a22_03dc_ffb8_1623_bb1a50959413 style d28938aa_d420_d4d1_6b36_01f3df03707d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/* eslint no-console: 'off' */
import { color, label, spinner as load } from '@astrojs/cli-kit';
import { align } from '@astrojs/cli-kit/utils';
import { detect } from 'package-manager-detector';
import terminalLink from 'terminal-link';
import type { PackageInfo } from './actions/context.js';
import { shell } from './shell.js';
// Users might lack access to the global npm registry, this function
// checks the user's project type and will return the proper npm registry
//
// A copy of this function also exists in the astro package
let _registry: string;
export async function getRegistry(): Promise<string> {
if (_registry) return _registry;
const fallback = 'https://registry.npmjs.org';
const packageManager = (await detect())?.name || 'npm';
try {
const { stdout } = await shell(packageManager, ['config', 'get', 'registry']);
_registry = stdout?.trim()?.replace(/\/$/, '') || fallback;
// Detect cases where the shell command returned a non-URL (e.g. a warning)
if (!new URL(_registry).host) _registry = fallback;
} catch {
_registry = fallback;
}
return _registry;
}
let stdout = process.stdout;
/** @internal Used to mock `process.stdout.write` for testing purposes */
export function setStdout(writable: typeof process.stdout) {
stdout = writable;
}
export async function spinner(args: {
start: string;
end: string;
while: (...args: any) => Promise<any>;
}) {
await load(args, { stdout });
}
export function pluralize(word: string | [string, string], n: number) {
const [singular, plural] = Array.isArray(word) ? word : [word, word + 's'];
if (n === 1) return singular;
return plural;
}
export const celebrations = [
'Beautiful.',
'Excellent!',
'Sweet!',
'Nice!',
'Huzzah!',
'Success.',
'Nice.',
'Wonderful.',
'Lovely!',
"Lookin' good.",
'Awesome.',
// ... (161 more lines)
Domain
Subdomains
Functions
Dependencies
- ./actions/context.js
- ./shell.js
- cli-kit
- package-manager-detector
- terminal-link
- utils
Source
Frequently Asked Questions
What does messages.ts do?
messages.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in messages.ts?
messages.ts defines 16 function(s): banner, bannerAbort, changelog, error, getRegistry, info, log, newline, pluralize, printHelp, and 6 more.
What does messages.ts depend on?
messages.ts imports 6 module(s): ./actions/context.js, ./shell.js, cli-kit, package-manager-detector, terminal-link, utils.
Where is messages.ts in the architecture?
messages.ts is located at packages/upgrade/src/messages.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/upgrade/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free