Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
style: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusCemes committed Mar 23, 2019
1 parent 4900d3e commit 2b8571b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export const SUPPORTED_EXTENSIONS = [
];

/** Used to wrap/centre content in the terminal */
export const WRAP_WIDTH = 40;
export const WRAP_WIDTH = 40;
33 changes: 17 additions & 16 deletions src/Main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import boxen from 'boxen';
import chalk from 'chalk';
import boxen from "boxen";
import chalk from "chalk";

import { IConfig } from './Config';
import { WRAP_WIDTH } from './Constants';
import { Controller } from './Controller';
import { IResult, PreparationError } from './Interfaces';
import { Logger } from './Logger';
import { IFile, Preparation } from './Preparation';
import { centreText } from './Utility';
import { IConfig } from "./Config";
import { WRAP_WIDTH } from "./Constants";
import { Controller } from "./Controller";
import { IResult, PreparationError } from "./Interfaces";
import { Logger } from "./Logger";
import { IFile, Preparation } from "./Preparation";
import { centreText } from "./Utility";

export async function main(config: IConfig): Promise<IResult> {
const logger = new Logger(config.verbosity);
Expand Down Expand Up @@ -60,25 +60,26 @@ export async function main(config: IConfig): Promise<IResult> {
padding: { top: 0, left: 2, right: 2, bottom: 0 },
borderColor: "redBright"
}) + "\n",
WRAP_WIDTH),
WRAP_WIDTH
),
Logger.VERBOSE
);
throw err;
}
}

function showBanner(logger: Logger) {
logger.log(chalk.bold.white(`
logger.log(
chalk.bold.white(`
______ _____ _______
(, / ) (, / (, / )
/__ / / /---(
) / \\____/__ ) / ____)
(_/ (__ / (_/ (`), 10);
(_/ (__ / (_/ (`),
10
);
logger.log(
centreText(
"\n\n A WebP build pipeline\n https://git.io/fjvL7\n",
WRAP_WIDTH
),
centreText("\n\n A WebP build pipeline\n https://git.io/fjvL7\n", WRAP_WIDTH),
Logger.VERBOSE
);
}
Expand Down
30 changes: 15 additions & 15 deletions src/Preparation.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import chalk from 'chalk';
import { DynamicTerminal, ILine } from 'dynamic-terminal';
import { prompt } from 'enquirer';
import figures from 'figures';
import fs from 'fs-extra';
import os from 'os';
import path from 'path';
import slash from 'slash';
import glob from 'tiny-glob';

import { IConfig } from './Config';
import { SUPPORTED_EXTENSIONS, WRAP_WIDTH } from './Constants';
import { PreparationError } from './Interfaces';
import { Logger } from './Logger';
import { centreText } from './Utility';
import chalk from "chalk";
import { DynamicTerminal, ILine } from "dynamic-terminal";
import { prompt } from "enquirer";
import figures from "figures";
import fs from "fs-extra";
import os from "os";
import path from "path";
import slash from "slash";
import glob from "tiny-glob";

import { IConfig } from "./Config";
import { SUPPORTED_EXTENSIONS, WRAP_WIDTH } from "./Constants";
import { PreparationError } from "./Interfaces";
import { Logger } from "./Logger";
import { centreText } from "./Utility";

export interface IFile {
base: string;
Expand Down
4 changes: 2 additions & 2 deletions src/Utility.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sharp, { Sharp } from "sharp";
import ansiAlign from "ansi-align";
import sharp, { Sharp } from "sharp";
import wrapAnsi from "wrap-ansi";

export function isSharpInstance(instance: object): instance is Sharp {
Expand All @@ -10,4 +10,4 @@ export function isSharpInstance(instance: object): instance is Sharp {
export function centreText(text: string, width: number): string {
const wrappedLine: string = ansiAlign.center(wrapAnsi(text, width) + "\n" + " ".repeat(width));
return wrappedLine.substring(0, wrappedLine.lastIndexOf("\n"));
}
}

0 comments on commit 2b8571b

Please sign in to comment.