Skip to content

Commit

Permalink
frontend: code style
Browse files Browse the repository at this point in the history
executed prettier to format code
  • Loading branch information
ErvinRacz committed Dec 11, 2024
1 parent 4f3a658 commit e9f0ab8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 44 deletions.
9 changes: 6 additions & 3 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.png" type="image/png"/>
<link rel="icon" href="%PUBLIC_URL%/favicon.png" type="image/png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Update monitor & manager for applications using the Omaha protocol, optimized for Flatcar Container Linux."
/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
<link href="https://fonts.googleapis.com/css?family=Overpass&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Overpass&display=swap" rel="stylesheet" />
<title>Nebraska</title>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ i18next
read<Namespace extends keyof typeof en>(
language: string | any,
namespace: Namespace,
callback: (errorValue: unknown, translations: null | typeof en[Namespace]) => void
callback: (errorValue: unknown, translations: null | (typeof en)[Namespace]) => void
) {
import(`./locales/${language}/${namespace}.json`)
.then(resources => {
Expand Down
68 changes: 37 additions & 31 deletions frontend/tools/build-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @todo: Make this a webpack loader.
*/
"use strict";
'use strict';

const fs = require('fs');
const path = require('path');
Expand All @@ -18,60 +18,66 @@ let sourceDir = args[0];
let destDir = args[1];

if (!fs.existsSync(sourceDir)) {
console.log(`Input folder ${sourceDir} does not exist; quitting...`);
process.exit(1);
console.log(`Input folder ${sourceDir} does not exist; quitting...`);
process.exit(1);
}

// Create directories
try {
fs.mkdirSync(destDir);
fs.mkdirSync(destDir);
} catch (err) {
if (err.code !== 'EEXIST') {
console.log(err);
}
if (err.code !== 'EEXIST') {
console.log(err);
}
}

// Do stuff
tools.ImportDir(sourceDir).then(result => {
tools
.ImportDir(sourceDir)
.then(result => {
collection = result;
console.log('Found ' + collection.length() + ' icons.');

// SVGO optimization
return collection.promiseAll(svg => tools.SVGO(svg));
}).then(() => {
})
.then(() => {
// Clean up tags
return collection.promiseAll(svg => tools.Tags(svg));
}).then(() => {
})
.then(() => {
// SVGO optimization again. Might make files smaller after color/tags changes
return collection.promiseAll(svg => tools.SVGO(svg));
}).then(() => {
})
.then(() => {
// Export each icon as JSON
collection.forEach((item, key) => {
let json = {
body: item.getBody().replace(/\s*\n\s*/g, ''),
width: item.width,
height: item.height
};
let content = JSON.stringify(json, null, '\t');
let target = path.join(destDir, `${key}.json`);
let json = {
body: item.getBody().replace(/\s*\n\s*/g, ''),
width: item.width,
height: item.height,
};
let content = JSON.stringify(json, null, '\t');
let target = path.join(destDir, `${key}.json`);

try {
try {
try {
fs.mkdirSync(destDir);
} catch (err) {
if (err.code !== 'EEXIST') {
console.log(err);
process.exit(1);
}
}

fs.writeFileSync(target, content, 'utf8');
console.log(`Created ${target}`);
fs.mkdirSync(destDir);
} catch (err) {
if (err.code !== 'EEXIST') {
console.log(err);
process.exit(1);
}
}

fs.writeFileSync(target, content, 'utf8');
console.log(`Created ${target}`);
} catch (err) {
console.log(err);
process.exit(1);
}
});
}).catch(err => {
})
.catch(err => {
console.log(err);
});
});
12 changes: 3 additions & 9 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -20,7 +16,5 @@
"jsx": "react-jsx",
"noFallthroughCasesInSwitch": true
},
"include": [
"src"
]
}
"include": ["src"]
}

0 comments on commit e9f0ab8

Please sign in to comment.