mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 03:55:37 +01:00
refactor: remove svgr
This commit is contained in:
parent
910f165103
commit
b37f39fbb4
89 changed files with 5614 additions and 6397 deletions
22
scripts/build-svg.js
Normal file
22
scripts/build-svg.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
const { readdir, readFileSync, writeFileSync, unlinkSync } = require('fs-extra');
|
||||
|
||||
async function main() {
|
||||
const dir = 'assets';
|
||||
|
||||
/**
|
||||
* @type {string[]}
|
||||
*/
|
||||
const files = await readdir(dir);
|
||||
|
||||
for (const file of files) {
|
||||
if (file.endsWith('.svg')) {
|
||||
const content = readFileSync(`${dir}/${file}`, {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
writeFileSync(`${dir}/${file.replace('.svg', '.jsx')}`, `export default () => ${content}`);
|
||||
unlinkSync(`${dir}/${file}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Loading…
Add table
Add a link
Reference in a new issue