Skip to content

Commit

Permalink
Update to new UIX version
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasstrehle committed Oct 25, 2023
1 parent 5eb161a commit 4e39fc5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 47 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/uix-deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# This file was auto generated by the uix git_deploy plugin. Do not manually edit.

name: Deploy prod
on: push
on:
push:
branches:
- main
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
Expand All @@ -27,5 +30,5 @@ jobs:
- name: Setup Deno
uses: "denoland/setup-deno@v1"
- name: Deploy UIX App
run: "deno run --importmap https://dev.cdn.unyt.org/importmap.json -Aqr https://dev.cdn.unyt.org/uix/run.ts --stage prod --detach "
run: "deno run --importmap https://dev.cdn.unyt.org/uix1/importmap.json -Aqr https://dev.cdn.unyt.org/uix1/run.ts --stage prod --detach "
needs: test
11 changes: 6 additions & 5 deletions backend/entrypoint.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Logger } from "unyt_core/utils/logger.ts";
import { UIX } from "uix/uix.ts";
import { Main } from "../common/components/Main.tsx";
import { Entrypoint } from "uix/html/entrypoints.ts";
import { renderBackend, renderHybrid, renderStatic } from "uix/base/render-methods.ts";

export default {
'/': null,
'/static': () => UIX.renderStatic(<Main/>),
'/hybrid': <Main/>,
} satisfies UIX.Entrypoint;
'/static': () => renderStatic(<Main/>),
'/backend': () => renderBackend(<Main/>),
'/hybrid': () => renderHybrid(<Main/>),
} satisfies Entrypoint;
10 changes: 6 additions & 4 deletions common/components/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { UIX } from "uix";
// import data from "common/data.dx";
import { Component } from "uix/components/Component.ts";
import { template } from "uix/html/template.ts";
import { always, Datex } from "unyt_core/datex.ts";
import { use } from "uix/base/decorators.ts";

const languages = {
"en": "🇺🇸",
"de": "🇩🇪",
"fr": "🇫🇷"
}
@UIX.template(function(this: Main) {
@template(function(this: Main) {
const ENV = Datex.Runtime.ENV;
return <div class="main">
<h1>{this.strings.title}</h1>
Expand All @@ -23,6 +25,6 @@ const languages = {
</div>
</div>
})
export class Main extends UIX.BaseComponent {
export class Main extends Component {
@use("../data.dx") declare strings: {[key: string]: string};
}
36 changes: 3 additions & 33 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
{
"imports": {
"unyt/": "https://cdn.unyt.org/uix-components/",
"unyt_core": "https://dev.cdn.unyt.org/unyt_core/datex.ts",
"uix": "https://dev.cdn.unyt.org/uix/uix.ts",
"unyt_core/": "https://dev.cdn.unyt.org/unyt_core/",
"uix/": "https://dev.cdn.unyt.org/uix/",
"uix_std/": "https://dev.cdn.unyt.org/uix/uix_std/",
"unyt_tests/": "https://dev.cdn.unyt.org/unyt_tests/",
"unyt_web/": "https://dev.cdn.unyt.org/unyt_web/",
"unyt_node/": "https://dev.cdn.unyt.org/unyt_node/",
"unyt_cli/": "https://dev.cdn.unyt.org/unyt_cli/",
"supranet/": "https://portal.unyt.org/ts_module_resolver/",
"uix/jsx-runtime": "https://dev.cdn.unyt.org/uix/jsx-runtime/jsx.ts",
"backend/": "./backend/",
"common/": "./common/",
"frontend/": "./frontend/"
},
"_publicImportMap": "./importmap.json",
"importMap": "./.datex-cache/importmap.lock.json",
"compilerOptions": {
"module": "esnext",
"target": "es2022",
"noImplicitOverride": true,
"removeComments": true,
"preserveConstEnums": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"jsx": "react-jsx",
"jsxImportSource": "uix",
"lib": [
"deno.window",
"dom",
"esnext"
"deno.window"
]
},
"tasks": {
"run": "uix",
"run-dev": "uix -wr",
"run-uixdev": "deno run -Aqr http://localhost:4200/run.ts -wr --import-map importmap.uixdev.json"
}
}
7 changes: 4 additions & 3 deletions frontend/entrypoint.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { UIX } from 'uix/uix.ts';
import { Main } from '../common/components/Main.tsx';
import { Entrypoint } from "uix/html/entrypoints.ts";

export default {
'/': <Main/>,
'/static': null,
'/hybrid': null
} satisfies UIX.Entrypoint;
'/hybrid': null,
'/backend': null
} satisfies Entrypoint;
12 changes: 12 additions & 0 deletions importmap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"imports": {
"datex-core-legacy": "https://dev.cdn.unyt.org/unyt_core/datex.ts",
"datex-core-legacy/": "https://dev.cdn.unyt.org/unyt_core/",
"unyt_core": "https://dev.cdn.unyt.org/unyt_core/datex.ts",
"unyt_core/": "https://dev.cdn.unyt.org/unyt_core/",
"uix": "https://dev.cdn.unyt.org/uix1/uix.ts",
"uix/": "https://dev.cdn.unyt.org/uix1/src/",
"uix/jsx-runtime": "https://dev.cdn.unyt.org/uix1/src/jsx-runtime/jsx.ts",
"unyt-tests/": "https://dev.cdn.unyt.org/unyt_tests/"
}
}

0 comments on commit 4e39fc5

Please sign in to comment.