refactor: console output improvements (#7029)

This commit is contained in:
Alexey Pyltsyn 2022-03-27 14:04:59 +03:00 committed by GitHub
parent 39486682ba
commit 2b58485c83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 18 deletions

View file

@ -69,7 +69,7 @@ export default async function serve(
});
});
logger.success`Serving path=${cliOptions.dir} directory at path=${
logger.success`Serving path=${cliOptions.dir} directory at url=${
servingUrl + baseUrl
}.`;
server.listen(port);

View file

@ -60,7 +60,7 @@ export default async function start(
const urls = prepareUrls(protocol, host, port);
const openUrl = normalizeUrl([urls.localUrlForBrowser, baseUrl]);
logger.success`Docusaurus website is running at path=${openUrl}.`;
logger.success`Docusaurus website is running at url=${openUrl}.`;
// Reload files processing.
const reload = _.debounce(() => {
@ -68,7 +68,7 @@ export default async function start(
.then(({baseUrl: newBaseUrl}) => {
const newOpenUrl = normalizeUrl([urls.localUrlForBrowser, newBaseUrl]);
if (newOpenUrl !== openUrl) {
logger.success`Docusaurus website is running at path=${newOpenUrl}.`;
logger.success`Docusaurus website is running at url=${newOpenUrl}.`;
}
})
.catch((err) => {

View file

@ -47,7 +47,7 @@ exports[`wrap TypeScript wrap ComponentInFolder 2`] = `
import type ComponentInFolderType from '@theme/ComponentInFolder';
import ComponentInFolder from '@theme-original/ComponentInFolder';
type Props = ComponentProps<typeof ComponentInFolderType>
type Props = ComponentProps<typeof ComponentInFolderType>;
export default function ComponentInFolderWrapper(props: Props): JSX.Element {
return (
@ -64,7 +64,7 @@ exports[`wrap TypeScript wrap ComponentInFolder/ComponentInSubFolder 2`] = `
import type ComponentInSubFolderType from '@theme/ComponentInFolder/ComponentInSubFolder';
import ComponentInSubFolder from '@theme-original/ComponentInFolder/ComponentInSubFolder';
type Props = ComponentProps<typeof ComponentInSubFolderType>
type Props = ComponentProps<typeof ComponentInSubFolderType>;
export default function ComponentInSubFolderWrapper(props: Props): JSX.Element {
return (
@ -81,7 +81,7 @@ exports[`wrap TypeScript wrap FirstLevelComponent 2`] = `
import type FirstLevelComponentType from '@theme/FirstLevelComponent';
import FirstLevelComponent from '@theme-original/FirstLevelComponent';
type Props = ComponentProps<typeof FirstLevelComponentType>
type Props = ComponentProps<typeof FirstLevelComponentType>;
export default function FirstLevelComponentWrapper(props: Props): JSX.Element {
return (

View file

@ -275,7 +275,7 @@ exports[`swizzle wrap ComponentInFolder TS: ComponentInFolder/index.tsx 1`] = `
import type ComponentInFolderType from '@theme/ComponentInFolder';
import ComponentInFolder from '@theme-original/ComponentInFolder';
type Props = ComponentProps<typeof ComponentInFolderType>
type Props = ComponentProps<typeof ComponentInFolderType>;
export default function ComponentInFolderWrapper(props: Props): JSX.Element {
return (
@ -319,7 +319,7 @@ exports[`swizzle wrap ComponentInFolder/ComponentInSubFolder TS: ComponentInFold
import type ComponentInSubFolderType from '@theme/ComponentInFolder/ComponentInSubFolder';
import ComponentInSubFolder from '@theme-original/ComponentInFolder/ComponentInSubFolder';
type Props = ComponentProps<typeof ComponentInSubFolderType>
type Props = ComponentProps<typeof ComponentInSubFolderType>;
export default function ComponentInSubFolderWrapper(props: Props): JSX.Element {
return (
@ -363,7 +363,7 @@ exports[`swizzle wrap ComponentInFolder/Sibling TS: ComponentInFolder/Sibling.ts
import type SiblingType from '@theme/ComponentInFolder/Sibling';
import Sibling from '@theme-original/ComponentInFolder/Sibling';
type Props = ComponentProps<typeof SiblingType>
type Props = ComponentProps<typeof SiblingType>;
export default function SiblingWrapper(props: Props): JSX.Element {
return (
@ -405,7 +405,7 @@ exports[`swizzle wrap FirstLevelComponent TS: FirstLevelComponent.tsx 1`] = `
import type FirstLevelComponentType from '@theme/FirstLevelComponent';
import FirstLevelComponent from '@theme-original/FirstLevelComponent';
type Props = ComponentProps<typeof FirstLevelComponentType>
type Props = ComponentProps<typeof FirstLevelComponentType>;
export default function FirstLevelComponentWrapper(props: Props): JSX.Element {
return (

View file

@ -88,7 +88,7 @@ export async function eject({
);
} catch (err) {
throw new Error(
logger.interpolate`Could not copy file from ${sourceFile} to ${targetFile}`,
logger.interpolate`Could not copy file from path=${sourceFile} to path=${targetFile}`,
);
}
return targetFile;
@ -126,7 +126,7 @@ export async function wrap({
import type ${componentName}Type from '@theme/${themeComponentName}';
import ${componentName} from '@theme-${importType}/${themeComponentName}';
type Props = ComponentProps<typeof ${componentName}Type>
type Props = ComponentProps<typeof ${componentName}Type>;
export default function ${wrapperComponentName}(props: Props): JSX.Element {
return (

View file

@ -133,7 +133,7 @@ export default async function swizzle(
typescript,
});
logger.success`
Created wrapper of name=${componentName} from name=${themeName} in path=${result.createdFiles}.
Created wrapper of name=${componentName} from name=${themeName} in path=${result.createdFiles}
`;
return result;
}
@ -144,7 +144,7 @@ Created wrapper of name=${componentName} from name=${themeName} in path=${result
componentName,
});
logger.success`
Ejected name=${componentName} from name=${themeName} to path=${result.createdFiles}.
Ejected name=${componentName} from name=${themeName} to path=${result.createdFiles}
`;
return result;
}

View file

@ -8,7 +8,7 @@ exports[`loadConfig website with incomplete siteConfig 1`] = `
exports[`loadConfig website with useless field (wrong field) in siteConfig 1`] = `
"These field(s) (\\"useLessField\\",) are not recognized in docusaurus.config.js.
If you still want these fields to be in your configuration, put them in the \\"customFields\\" field.
See https://docusaurus.io/docs/docusaurus.config.js/#customfields"
See https://docusaurus.io/docs/api/docusaurus-config/#customfields"
`;
exports[`loadConfig website with valid async config 1`] = `

View file

@ -153,11 +153,11 @@ exports[`normalizeConfig throws error for required fields 1`] = `
\\"stylesheets\\" must be an array
These field(s) (\\"invalidField\\",) are not recognized in docusaurus.config.js.
If you still want these fields to be in your configuration, put them in the \\"customFields\\" field.
See https://docusaurus.io/docs/docusaurus.config.js/#customfields"
See https://docusaurus.io/docs/api/docusaurus-config/#customfields"
`;
exports[`normalizeConfig throws error for unknown field 1`] = `
"These field(s) (\\"invalid\\",) are not recognized in docusaurus.config.js.
If you still want these fields to be in your configuration, put them in the \\"customFields\\" field.
See https://docusaurus.io/docs/docusaurus.config.js/#customfields"
See https://docusaurus.io/docs/api/docusaurus-config/#customfields"
`;

View file

@ -258,7 +258,7 @@ export function validateConfig(
'',
);
formattedError = unknownFields
? `${formattedError}These field(s) (${unknownFields}) are not recognized in ${DEFAULT_CONFIG_FILE_NAME}.\nIf you still want these fields to be in your configuration, put them in the "customFields" field.\nSee https://docusaurus.io/docs/docusaurus.config.js/#customfields`
? `${formattedError}These field(s) (${unknownFields}) are not recognized in ${DEFAULT_CONFIG_FILE_NAME}.\nIf you still want these fields to be in your configuration, put them in the "customFields" field.\nSee https://docusaurus.io/docs/api/docusaurus-config/#customfields`
: formattedError;
throw new Error(formattedError);
} else {