-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from bruno-sartori/BUG-3_as_waifus_nao_estao_se…
…ndo_exibidas BUG-3: As waifus não estao sendo exibidas
- Loading branch information
Showing
29 changed files
with
43 additions
and
20 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ | ||
{ | ||
"name": "@bsartori/weeb-logger", | ||
"version": "1.0.14", | ||
"version": "1.0.16", | ||
"author": "Bruno Sartori <[email protected]>", | ||
"license": "MIT", | ||
"repository": { | ||
|
@@ -14,8 +14,8 @@ | |
"dist" | ||
], | ||
"scripts": { | ||
"prepare-assets": "node ./scripts/generateBase64Assets.js", | ||
"build": "tsc", | ||
"postbuild": "shx mkdir -p dist/assets && shx cp -r ./src/assets/* ./dist/assets", | ||
"prepublishOnly": "yarn build", | ||
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest", | ||
"prepare": "husky" | ||
|
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const fs = require('fs').promises; | ||
const path = require('path'); | ||
|
||
const convertImageToBase64 = async (name, src) => { | ||
console.log(name, src); | ||
const data = await fs.readFile(src); | ||
const base64Image = Buffer.from(data, 'binary').toString('base64'); | ||
return { [name]: base64Image }; | ||
} | ||
|
||
const generateBase64Assets = async () => { | ||
const waifuPath = './docs/waifus' | ||
try { | ||
const filenames = await fs.readdir(waifuPath); | ||
|
||
const promises = filenames.map(async (fileName) => { | ||
const asset = await convertImageToBase64(fileName.split('_')[0], path.join(waifuPath, fileName)); | ||
return asset; | ||
}); | ||
|
||
let base64Assets = await Promise.all(promises); | ||
base64Assets = base64Assets.reduce(((r, c) => Object.assign(r, c)), {}); | ||
|
||
fs.writeFile('src/waifus.json', JSON.stringify(base64Assets)); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
|
||
generateBase64Assets(); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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