Skip to content

Commit

Permalink
Merge pull request #95 from unyt-org/fix-version-patch
Browse files Browse the repository at this point in the history
Fix latest release (import order)
  • Loading branch information
jonasstrehle authored Feb 12, 2024
2 parents 4afd895 + 9739d03 commit da528f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/app/args.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CommandLineOptions } from "https://dev.cdn.unyt.org/command-line-args/main.ts"
import { Path } from "../utils/path.ts";
import { getExistingFile } from "../utils/file-utils.ts";
import { UIX } from "../../uix.ts";
import { ESCAPE_SEQUENCES } from "datex-core-legacy/utils/logger.ts";
import { version as UIX_VERSION } from "../utils/version.ts";

export const command_line_options = new CommandLineOptions("UIX", "Fullstack Web Framework with DATEX Integration.\nVisit https://unyt.org/uix for more information", "../RUN.md");

Expand Down Expand Up @@ -40,7 +40,7 @@ const version = command_line_options.option("version", {type:"boolean", descript
if (version) {
const DATEX_VERSION = (await import("datex-core-legacy/VERSION.ts")).default;

let log = `${ESCAPE_SEQUENCES.BOLD}${ESCAPE_SEQUENCES.UNYT_BLUE}UIX ${UIX.version == "beta" ? "beta" : "v" + UIX.version}${ESCAPE_SEQUENCES.RESET} (${new URL("../../", import.meta.url)})`;
let log = `${ESCAPE_SEQUENCES.BOLD}${ESCAPE_SEQUENCES.UNYT_BLUE}UIX ${UIX_VERSION == "beta" ? "beta" : "v" + UIX_VERSION}${ESCAPE_SEQUENCES.RESET} (${new URL("../../", import.meta.url)})`;
log += `\n\n${ESCAPE_SEQUENCES.BOLD}DATEX Core: ${ESCAPE_SEQUENCES.RESET} ${DATEX_VERSION == "beta" ? "beta" : "v" + DATEX_VERSION} (${import.meta.resolve("datex-core-legacy/")})`
log += `\n${ESCAPE_SEQUENCES.BOLD}Deno: ${ESCAPE_SEQUENCES.RESET} ${Deno.version.deno}`
log += `\n${ESCAPE_SEQUENCES.BOLD}TypeScript: ${ESCAPE_SEQUENCES.RESET} ${Deno.version.typescript}`
Expand Down
12 changes: 12 additions & 0 deletions src/utils/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

/**
* get version from ./version file
*/
let _version = "beta";
try {
_version = (await import("../../VERSION.ts")).default
}
catch {
console.error("Could not determine UIX version")
}
export const version = _version;
26 changes: 6 additions & 20 deletions uix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,15 @@ import { client_type } from "datex-core-legacy/utils/constants.ts";
import { getThemeManager } from "./src/base/theme-manager.ts";
import { UIX_COOKIE, setCookie } from "./src/session/cookies.ts";
import { Path } from "./src/utils/path.ts";
import { Datex } from "datex-core-legacy/mod.ts";
import { Datex } from "datex-core-legacy";
import { cache_path } from "datex-core-legacy/runtime/cache_path.ts";
import { version } from "./src/utils/version.ts";

/**
* get UIX cache path
*/
const cacheDir = client_type == "deno" ? new Path<Path.Protocol.File, true>('./uix/', cache_path) : new Path<Path.Protocol.HTTP|Path.Protocol.HTTPS, true>('/@uix/cache/', location.origin);

/**
* get version from ./version file
*/
let version = "beta";
try {
version = (await import("./VERSION.ts")).default
}
catch {
console.error("Could not determine DATEX version")
}

export const UIX = {
version,
get context() {
Expand All @@ -41,14 +31,10 @@ export const UIX = {

if (client_type == "browser") {
// update uix-language cookie (only works if runtime initialized!)
try {
Datex.Ref.observe(Datex.Runtime.ENV.$.LANG, lang => {
setCookie(UIX_COOKIE.language, lang)
document.documentElement?.setAttribute("lang", lang)
})
} catch (e) {
console.error(e);
}
Datex.Ref.observe(Datex.Runtime.ENV.$.LANG, lang => {
setCookie(UIX_COOKIE.language, lang)
document.documentElement?.setAttribute("lang", lang)
})

// make sure UIX theme manager is activated
getThemeManager();
Expand Down

0 comments on commit da528f7

Please sign in to comment.