Skip to content

Commit

Permalink
Workflow improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
PKief committed Mar 7, 2022
1 parent 19eab68 commit 0308c5e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"endOfLine": "auto"
}
Binary file modified images/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
"engines": {
"vscode": "^1.53.0"
},
"scripts": {
"start": "nodemon ./src/index.ts",
"build": "ts-node ./src/index.ts",
"preview": "ts-node ./src/scripts/preview/index.ts",
"changelog": "changelog-machine --config changelog.config.json",
"preversion": "npm run preview && git add images/preview.png",
"version": "npm run changelog && git add CHANGELOG.md"
},
"homepage": "https://github.com/PKief/vscode-material-product-icons/blob/master/README.md",
"repository": {
"url": "https://github.com/PKief/vscode-material-product-icons.git",
Expand Down Expand Up @@ -48,12 +56,5 @@
"ts-node": "^10.4.0",
"typescript": "^4.5.4",
"webfont": "^11.2.26"
},
"scripts": {
"start": "nodemon ./src/index.ts",
"build": "ts-node ./src/index.ts",
"preview": "ts-node ./src/scripts/preview/index.ts",
"changelog": "changelog-machine --config changelog.config.json",
"version": "npm run changelog && git add CHANGELOG.md"
}
}
2 changes: 1 addition & 1 deletion src/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** TitleCase all words in a string */
export const toTitleCase = (str) => {
export const toTitleCase = (str: string): string => {
return str.replace(
/\w\S*/g,
(txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/screenshots.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from "path";
import * as puppeteer from "puppeteer";
import * as path from 'path';
import puppeteer from 'puppeteer';

/**
* Create a screenshot from an HTML file and save it as image.
Expand All @@ -8,7 +8,7 @@ import * as puppeteer from "puppeteer";
*/
export const createScreenshot = async (filePath: string, fileName: string) => {
try {
const htmlFilePath = path.join("file:", filePath);
const htmlFilePath = path.join('file:', filePath);
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({
Expand All @@ -27,6 +27,6 @@ export const createScreenshot = async (filePath: string, fileName: string) => {
await browser.close();
} catch (error) {
console.error(error);
throw Error(error);
throw Error('An error occurred!');
}
};
2 changes: 1 addition & 1 deletion src/scripts/preview/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const createHTMLTableBodyRows = (items: IconDefinition[][]) => {
return rows;
};

const createHTMLTable = (headRow, bodyRows) => `
const createHTMLTable = (headRow: string, bodyRows: string) => `
<table>
${headRow}
${bodyRows}
Expand Down
23 changes: 23 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": ["es6", "dom"],
"strict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noImplicitAny": true,
"sourceMap": true,
"rootDir": "src",
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": [
"src/**/*.ts",
"./node_modules/vscode/vscode.d.ts",
"./node_modules/vscode/lib/*"
]
}

0 comments on commit 0308c5e

Please sign in to comment.