Skip to content

Commit

Permalink
Updated log messages of scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
PKief committed Nov 24, 2018
1 parent 6102993 commit 00e4978
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion scripts/icons/checks/checkIconConflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const handleErrors = () => {
...Object.keys(allConflicts.folderIcons),
...Object.keys(allConflicts.languageIcons)].length > 0
) {
console.log(painter.red('> Material Icon Theme: Icon conflicts:'));
console.log('> Material Icon Theme:', painter.red('Icon conflicts:'));
console.log(painter.red('--------------------------------------'));

printErrorMessage(allConflicts.fileIcons.fileExtensions, 'fileExtension');
Expand Down
2 changes: 1 addition & 1 deletion scripts/preview/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const savePreview = (fileName: string, size: number, icons: IconDefinition[][])

// create the images
createScreenshots(filePath, fileName).then(() => {
console.log(painter.green(`Successfully created ${fileName} preview images!`));
console.log('> Material Icon Theme:', painter.green(`Successfully created ${fileName} preview images!`));
}).catch(() => {
throw Error(painter.red(`Error while creating ${fileName} preview images`));
});
Expand Down
33 changes: 19 additions & 14 deletions scripts/preview/screenshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@ import * as path from 'path';
import * as puppeteer from 'puppeteer';

export const createScreenshots = async (filePath: string, fileName: string) => {
const htmlFilePath = path.join('file:', __dirname, '..', '..', filePath);
try {
const htmlFilePath = path.join('file:', __dirname, '..', '..', filePath);

const browser = await puppeteer.launch();
const page = await browser.newPage();
page.setViewport({
height: 100,
width: 100
});
const browser = await puppeteer.launch();
const page = await browser.newPage();
page.setViewport({
height: 100,
width: 100
});

await page.goto(htmlFilePath);
await page.goto(htmlFilePath);

await page.screenshot({
path: `images/${fileName}.png`,
omitBackground: false,
fullPage: true
});
await page.screenshot({
path: `images/${fileName}.png`,
omitBackground: false,
fullPage: true
});

await browser.close();
await browser.close();
} catch (error) {
console.log(error);
throw Error(error);
}
};

0 comments on commit 00e4978

Please sign in to comment.