This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
840092e
commit 7e37eff
Showing
6 changed files
with
60 additions
and
111 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
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as fs from 'node:fs/promises'; | ||
import * as path from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
try { | ||
const distDir = path.resolve(__dirname, '../dist'); | ||
const assetsDir = path.join(distDir, 'assets'); | ||
|
||
// HTML | ||
const panel = path.join(distDir, 'panel.html'); | ||
const windows = path.join(distDir, 'windows.html'); | ||
const ui = path.join(distDir, 'ui.html'); | ||
await Promise.all([panel, windows, ui].map(html)); | ||
|
||
// CSS | ||
const style = path.join(distDir, 'style.css'); | ||
const browser = path.join(distDir, 'browser.css'); | ||
await fs.rename(style, browser); | ||
|
||
// Fontes | ||
const regex = /url\s*\(\/?fonts/g; | ||
const replacement = 'url(../fonts'; | ||
|
||
const files = await fs.readdir(assetsDir); | ||
const cssFiles = files.filter((file) => { | ||
return path.extname(file) === '.css' && file.startsWith('ui'); | ||
}); | ||
|
||
for (const file of cssFiles) { | ||
const cssFile = path.join(assetsDir, file); | ||
let fileContent = await fs.readFile(cssFile, { encoding: 'utf-8' }); | ||
fileContent = fileContent.replace(regex, replacement); | ||
await fs.writeFile(cssFile, fileContent, { encoding: 'utf-8' }); | ||
}; | ||
|
||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
}; | ||
|
||
async function html(file) { | ||
let content = await fs.readFile(file, { encoding: 'utf-8' }); | ||
content = content.replace(/\"\/assets\//g, '\"assets\/'); | ||
await fs.writeFile(file, content, { encoding: 'utf-8' }); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.