-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add additional ignores/msbuild deletes to icon gen script
- Loading branch information
Showing
4 changed files
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
</PropertyGroup> | ||
|
||
<!-- This is here because I know we have node as a build dep so this just works --> | ||
<Target Name="IconGeneration" BeforeTargets="ResolveAssemblyReferences" Inputs="../../build/logo.svg" Outputs="../../artifacts/tgs.ico;../../artifacts/tgs.png"> | ||
<Target Name="IconGeneration" BeforeTargets="ResolveAssemblyReferences" Inputs="build_logo.js;../../build/logo.svg" Outputs="../../artifacts/tgs.ico;../../artifacts/tgs.png"> | ||
<Message Text="Restoring yarn packages..." Importance="high" /> | ||
<Exec Command="npx --yes yarn add [email protected] [email protected]" /> | ||
<Message Text="Generating icons from SVG..." Importance="high" /> | ||
|
@@ -24,6 +24,6 @@ | |
|
||
<Target Name="IconNodeCleanup" AfterTargets="IconGeneration;IconClean"> | ||
<RemoveDir Directories="node_modules" /> | ||
<Delete Files="package.json;yarn.lock" /> | ||
<Delete Files="package.json;yarn.lock;logo_bg_white.svg;yarn-error.log" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// Prereq packages: [email protected] [email protected] | ||
// Usage: node ./build_logo.js | ||
// Generates ../../artifacts/tgs.ico and ../../artifacts/tgs.ico | ||
// Generates ../../artifacts/tgs.ico and ../../artifacts/tgs.ico | ||
|
||
const svg_to_img = require("svg-to-ico"); | ||
const svg2img = require('svg2img'); | ||
|
@@ -10,12 +10,19 @@ if (!fs.existsSync("../../artifacts")) { | |
fs.mkdirSync("../../artifacts",'0777', true); | ||
} | ||
|
||
const svg_bytes = fs.readFileSync("../../build/logo.svg"); | ||
const svg = svg_bytes.toString(); | ||
const white_bg_svg = svg | ||
.replace("<!-- DO NOT CHANGE THIS LINE, UNCOMMENTING IT ENABLES THE WHITE BACKGROUND FOR THE .ICO--><!--", "") | ||
.replace("SCRIPT_REPLACE_TOKEN", ""); | ||
fs.writeFileSync("logo_white_bg.svg", white_bg_svg); | ||
|
||
svg_to_img({ | ||
input_name: "../../build/logo.svg", | ||
input_name: "logo_white_bg.svg", | ||
output_name: "../../artifacts/tgs.ico", | ||
sizes: [ 160 ] | ||
}).then(() => { | ||
// this package sucks, path separators are fucked | ||
fs.unlinkSync("logo_white_bg.svg"); | ||
svg2img( | ||
"../../build/logo.svg", | ||
{ | ||
|
@@ -35,6 +42,7 @@ svg_to_img({ | |
fs.writeFileSync("../../artifacts/tgs.png", buffer); | ||
}); | ||
}).catch((error) => { | ||
console.error(`ICO conversion failed: ${error}`); | ||
exit(1); | ||
fs.unlinkSync("logo_white_bg.svg"); | ||
console.error(`ICO conversion failed: ${error}`); | ||
exit(1); | ||
}); |