Skip to content

Commit

Permalink
fixing chalk references
Browse files Browse the repository at this point in the history
  • Loading branch information
Alisha Robinson committed Aug 15, 2024
1 parent e332521 commit 338beaa
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readJsonFile } from '@nx/devkit';
import { green, blue, red, yellow } from 'chalk';
import chalk from 'chalk';
import { watch } from 'chokidar';
import { glob } from 'fast-glob';
import {
@@ -85,7 +85,7 @@ export class DocPageLoadersCompiler {
);

handledFileEvents.pipe(take(1)).subscribe(() => {
console.log(blue('Watching doc-portal files for changes...\n'));
console.log(chalk.blue('Watching doc-portal files for changes...\n'));
});

return handledFileEvents;
@@ -114,7 +114,7 @@ export class DocPageLoadersCompiler {
* @private
*/
private buildInitialFileEvent(): Observable<RawInitEvent> {
this.log(blue('Searching for component document page files...'));
this.log(chalk.blue('Searching for component document page files...'));
const startTime = Date.now();

const patternStrings = convertPatternOrGlobPatternArray(this.globPatterns);
@@ -130,7 +130,7 @@ export class DocPageLoadersCompiler {
map((filePaths): RawInitEvent => ({ type: 'init', filePaths })),
tap(() => {
const endTime = Date.now();
this.log(green(`Searching complete in ${endTime - startTime}ms\n`));
this.log(chalk.green(`Searching complete in ${endTime - startTime}ms\n`));
})
);
}
@@ -172,13 +172,13 @@ export class DocPageLoadersCompiler {
): RawFileEvent {
const filePath = rawFilePath.replace(/\\/g, '/');
if (event === 'add' || event === 'addDir') {
this.log(green(`${timeNow()} - ADDED - ${filePath}`));
this.log(chalk.green(`${timeNow()} - ADDED - ${filePath}`));
return { type: 'add', filePath };
} else if (event === 'unlink' || event === 'unlinkDir') {
this.log(red(`${timeNow()} - DELETED - ${filePath}`));
this.log(chalk.red(`${timeNow()} - DELETED - ${filePath}`));
return { type: 'unlink', filePath };
} else {
this.log(yellow(`${timeNow()} - CHANGED - ${filePath}`));
this.log(chalk.yellow(`${timeNow()} - CHANGED - ${filePath}`));
return { type: 'change', filePath };
}
}
@@ -196,7 +196,7 @@ export class DocPageLoadersCompiler {
try {
if (fileEvent.type === 'init') {
const payload: EventPayload[] = [];
this.log(blue('Compiling component document page files...'));
this.log(chalk.blue('Compiling component document page files...'));
const startTime = Number(new Date());
for (const filePath of fileEvent.filePaths) {
const title = await extractTitleFromDocPageFile(
@@ -207,7 +207,7 @@ export class DocPageLoadersCompiler {
}
const endTime = Number(new Date());
this.log(
green(
chalk.green(
`Finished compiling component document page files in ${
endTime - startTime
}ms\n`
@@ -222,7 +222,7 @@ export class DocPageLoadersCompiler {
);
const endTime = Date.now();
this.log(
blue(
chalk.blue(
`${timeNow()} - COMPILE - recompiled in ${endTime - startTime}ms`
)
);
@@ -231,7 +231,7 @@ export class DocPageLoadersCompiler {
return fileEvent;
}
} catch (error) {
this.log(red(`Unexpected error occurred while compiling...\n${error}`));
this.log(chalk.red(`Unexpected error occurred while compiling...\n${error}`));
return null;
}
}
@@ -243,7 +243,7 @@ export class DocPageLoadersCompiler {
if (titles[payload.title] !== undefined) {
duplicatesDetected = true;
this.log(
yellow(
chalk.yellow(
`Duplicated title of "${payload.title}" detected in file '${payload.filePath}'`
)
);
@@ -253,7 +253,7 @@ export class DocPageLoadersCompiler {
}
if (duplicatesDetected) {
this.log(
yellow('\nPlease resolve duplicated titles before publishing!\n')
chalk.yellow('\nPlease resolve duplicated titles before publishing!\n')
);
}
return eventPayloads;
@@ -271,7 +271,7 @@ export class DocPageLoadersCompiler {
} catch (e) {
console.error(e);
this.log(
red(
chalk.red(
`\n\nUnexpected error occurred while generating doc-page-loaders.ts\n`
)
);

0 comments on commit 338beaa

Please sign in to comment.