mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 09:28:29 +00:00
Deep copy function
This commit is contained in:
parent
7d3d1ca229
commit
1401d848b2
@ -9,7 +9,7 @@ import { shortCommit } from "./modules/sub/currentCommit.js";
|
|||||||
import { appName, genericUserAgent, version, internetExplorerRedirect } from "./modules/config.js";
|
import { appName, genericUserAgent, version, internetExplorerRedirect } from "./modules/config.js";
|
||||||
import { getJSON } from "./modules/api.js";
|
import { getJSON } from "./modules/api.js";
|
||||||
import renderPage from "./modules/pageRender.js";
|
import renderPage from "./modules/pageRender.js";
|
||||||
import { apiJSON } from "./modules/sub/utils.js";
|
import { apiJSON, deepCopy } from "./modules/sub/utils.js";
|
||||||
import loc from "./modules/sub/i18n.js";
|
import loc from "./modules/sub/i18n.js";
|
||||||
import { Bright, Cyan } from "./modules/sub/consoleText.js";
|
import { Bright, Cyan } from "./modules/sub/consoleText.js";
|
||||||
import stream from "./modules/stream/stream.js";
|
import stream from "./modules/stream/stream.js";
|
||||||
@ -163,11 +163,7 @@ if (fs.existsSync('./.env')) {
|
|||||||
buildCSS()
|
buildCSS()
|
||||||
]).then(([js, css]) => {
|
]).then(([js, css]) => {
|
||||||
let currentDistUUID = UUID(),
|
let currentDistUUID = UUID(),
|
||||||
// TODO: Move deep copy to utils
|
currentDist = { uuid: currentDistUUID, files: deepCopy(css.fontData) };
|
||||||
currentDist = {
|
|
||||||
uuid: currentDistUUID,
|
|
||||||
files: JSON.parse(JSON.stringify(css.fontData))
|
|
||||||
};
|
|
||||||
|
|
||||||
currentDist.files[`bundle.${commitHash}.js`] = js;
|
currentDist.files[`bundle.${commitHash}.js`] = js;
|
||||||
currentDist.files[`bundle.${commitHash}.css`] = css.code;
|
currentDist.files[`bundle.${commitHash}.css`] = css.code;
|
||||||
|
@ -9,7 +9,6 @@ export async function buildJS () {
|
|||||||
return transformedJS.code
|
return transformedJS.code
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make it work with new fonts
|
|
||||||
export async function buildCSS () {
|
export async function buildCSS () {
|
||||||
let mainCSS = await readFile('./src/static/cobalt.css', { encoding: 'utf-8' }),
|
let mainCSS = await readFile('./src/static/cobalt.css', { encoding: 'utf-8' }),
|
||||||
fontCSS = await readFile('./src/static/fonts/notosansmono/notosansmono.css', { encoding: 'utf-8' }),
|
fontCSS = await readFile('./src/static/fonts/notosansmono/notosansmono.css', { encoding: 'utf-8' }),
|
||||||
|
@ -49,4 +49,7 @@ export function cleanURL(url, host) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
|
}
|
||||||
|
export function deepCopy(object) {
|
||||||
|
return JSON.parse(JSON.stringify(object))
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user