mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 15:08:11 +08:00
* Clean up Vue initialization-related code * Rename folder: dispatcher -> interop * Rename folder: state -> providers * Comments and clarification * Rename JS dispatcher to subscription router * Assorted cleanup and renaming * Rename: js-messages.ts -> messages.ts * Comments * Remove unused Vue component injects * Clean up coming soon and add warning about freezing the app * Further cleanup * Dangerous changes * Simplify App.vue code * Move more disparate init code from components into managers * Rename folder: providers -> state-providers * Other * Move Document panel options bar separator to backend * Add destructors to managers to fix HMR * Comments and code style * Rename variable: font -> font_file_url * Fix async font loading; refactor janky floating menu openness and min-width measurement; fix Vetur errors * Fix misaligned canvas in viewport until panning on page (re)load * Add Vue bidirectional props documentation * More folder renaming for better terminology; add some documentation
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { Editor } from "@/wasm-communication/editor";
|
|
|
|
// Gets metadata populated in the `process.env` namespace by code in `frontend/vue.config.js`.
|
|
// TODO: Move that functionality to a build.rs file so our web build system is more lightweight.
|
|
export function createBuildMetadataManager(editor: Editor): void {
|
|
// Release
|
|
const release = process.env.VUE_APP_RELEASE_SERIES;
|
|
|
|
// Timestamp
|
|
const date = new Date(process.env.VUE_APP_COMMIT_DATE || "");
|
|
const timezoneName = Intl.DateTimeFormat(undefined, { timeZoneName: "long" })
|
|
.formatToParts(new Date())
|
|
.find((part) => part.type === "timeZoneName");
|
|
const dateString = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
const timeString = `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
|
const timezoneNameString = timezoneName?.value;
|
|
const timestamp = `${dateString} ${timeString} ${timezoneNameString}`;
|
|
|
|
// Hash
|
|
const hash = (process.env.VUE_APP_COMMIT_HASH || "").substring(0, 8);
|
|
|
|
// Branch
|
|
const branch = process.env.VUE_APP_COMMIT_BRANCH;
|
|
|
|
editor.instance.populate_build_metadata(release || "", timestamp, hash, branch || "");
|
|
}
|