mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
run typescript check as part of ci (#503)
* run typescript check as part of ci * fix compilation
This commit is contained in:
parent
c1c626cc80
commit
7c9aabd013
17 changed files with 74 additions and 71 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -45,6 +45,8 @@ jobs:
|
|||
with:
|
||||
version: 0.26.2
|
||||
- uses: actions/checkout@v3
|
||||
- name: env file
|
||||
run: cp modules/desktop/.env.example modules/desktop/.env
|
||||
- name: install app dependencies
|
||||
run: tea -E xc setup
|
||||
# TODO: fix
|
||||
|
@ -52,6 +54,8 @@ jobs:
|
|||
# run: pnpm --filter desktop run coverage
|
||||
- name: lint
|
||||
run: tea -E pnpm -r lint
|
||||
- name: chec
|
||||
run: tea -E pnpm -r check
|
||||
build_svelte:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
|
|
15
README.md
15
README.md
|
@ -54,11 +54,16 @@ contribute to them:
|
|||
The following can be run with [`xc`], eg. `xc build`
|
||||
|
||||
## Setup
|
||||
Setup ensures that required configuration placeholder files are present and installs dependencies.
|
||||
|
||||
```sh
|
||||
if [ ! -e modules/desktop/electron/config.json ]; then
|
||||
echo '{}' > modules/desktop/electron/config.json
|
||||
fi
|
||||
|
||||
if [ ! -e modules/desktop/.env ]; then
|
||||
cp modules/desktop/.env.example modules/desktop/.env
|
||||
fi
|
||||
pnpm install
|
||||
```
|
||||
|
||||
|
@ -90,6 +95,14 @@ pnpm --filter tea exec pnpm predist
|
|||
pnpm --filter tea exec pnpm dist
|
||||
```
|
||||
|
||||
## Check
|
||||
Runs the typescript compiler and linter.
|
||||
|
||||
```sh
|
||||
pnpm run -r check
|
||||
pnpm run -r lint
|
||||
```
|
||||
|
||||
# Dependencies
|
||||
|
||||
| Project | Version |
|
||||
|
@ -103,4 +116,4 @@ pnpm --filter tea exec pnpm dist
|
|||
[`xc`]: https://xcfile.dev
|
||||
[semver]: https://semver.org
|
||||
[notion]: https://www.notion.so/teaxyz/tea-gui-fdd9f50aa980432fa370b2cf6a03cb50
|
||||
[discussion]: https://github.com/orgs/teaxyz/discussions
|
||||
[discussion]: https://github.com/orgs/teaxyz/discussions
|
||||
|
|
2
modules/desktop/.env.example
Normal file
2
modules/desktop/.env.example
Normal file
|
@ -0,0 +1,2 @@
|
|||
PUBLIC_VERSION: dev
|
||||
PUBLIC_MIXPANEL_TOKEN: <token>
|
|
@ -135,7 +135,7 @@ export async function openPackageEntrypointInTerminal(pkg: string) {
|
|||
});
|
||||
|
||||
child.on("exit", (code) => {
|
||||
console.info("exit:", code, `\`${stdout}\``);
|
||||
log.info("exit:", code, `\`${stdout}\``);
|
||||
if (code == 0) {
|
||||
resolve(stdout);
|
||||
} else {
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
"unit:test": "vitest",
|
||||
"coverage": "vitest run --coverage",
|
||||
"test": "playwright test",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --compiler-warnings \"css-unused-selector:ignore\"",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --compiler-warnings \"css-unused-selector:ignore\" --watch",
|
||||
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
||||
"format": "prettier --plugin-search-dir . --write ."
|
||||
},
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<script lang="ts">
|
||||
import '$appcss';
|
||||
import Button from '@tea/ui/button/button.svelte';
|
||||
import { openTerminal } from '@native';
|
||||
|
||||
let copyButtonText = 'COPY';
|
||||
const copyValue = `sh <(curl https://tea.xyz)`;
|
||||
|
||||
const onCopy = () => {
|
||||
copyButtonText = 'COPIED!';
|
||||
navigator.clipboard.writeText(copyValue);
|
||||
};
|
||||
|
||||
const onInstall = () => {
|
||||
openTerminal(copyValue);
|
||||
}
|
||||
</script>
|
||||
|
||||
<section class="border-gray mt-4 border bg-black">
|
||||
<header class="flex flex-col items-center py-8">
|
||||
<figure>
|
||||
<img alt="tea" src="/images/tea-icon.png" class="rounded-md" />
|
||||
</figure>
|
||||
<p class="text-primary">tea.cli ver. 0.6.0</p>
|
||||
</header>
|
||||
<footer class="border-gray flex h-20 border-t text-white">
|
||||
<input class="flex-grow bg-black pl-4" disabled value="sh <(curl tea.xyz)>" />
|
||||
<Button class="w-16 border-0 border-l-2 text-sm" onClick={onCopy}>{copyButtonText}</Button>
|
||||
<Button class="w-56 border-0 border-l-2 text-sm" onClick={onInstall}
|
||||
>OPEN IN TERMINAL</Button
|
||||
>
|
||||
</footer>
|
||||
</section>
|
|
@ -9,8 +9,6 @@
|
|||
const bugFormUrl = `https://airtable.com/shravDxWeNwwpPkFV?prefill_log_id=${logId}&hide_log_id=true`;
|
||||
shellOpenExternal(bugFormUrl);
|
||||
};
|
||||
|
||||
const preventDoubleClick = (evt: MouseEvent) => evt.stopPropagation();
|
||||
</script>
|
||||
|
||||
<div class="mr-1 flex h-full items-center justify-end gap-2 p-2">
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<script lang="ts">
|
||||
import { page } from "$app/stores";
|
||||
import { beforeUpdate } from "svelte";
|
||||
import { searchStore } from "$libs/stores";
|
||||
import SearchInput from "@tea/ui/search-input/search-input.svelte";
|
||||
import { navStore } from "$libs/stores";
|
||||
|
@ -10,11 +8,6 @@
|
|||
import { topbarDoubleClick } from "$libs/native-electron";
|
||||
|
||||
let { nextPath, prevPath } = navStore;
|
||||
|
||||
let currentPath: string;
|
||||
beforeUpdate(async () => {
|
||||
currentPath = $page.url.pathname;
|
||||
});
|
||||
</script>
|
||||
|
||||
<header
|
||||
|
|
|
@ -202,7 +202,12 @@ export const openPackageEntrypointInTerminal = (pkg: string) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const shellOpenExternal = (link: string) => shell.openExternal(link);
|
||||
export const shellOpenExternal = (link?: string) => {
|
||||
if (!link) {
|
||||
return;
|
||||
}
|
||||
shell.openExternal(link);
|
||||
};
|
||||
|
||||
export const listenToChannel = (channel: string, callback: (data: any) => void) => {
|
||||
ipcRenderer.on(channel, (_: any, data: any) => callback(data));
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* * make cors work with api.tea.xyz/v1
|
||||
*/
|
||||
import type { Package, Review, AirtablePost, Bottle } from "@tea/ui/types";
|
||||
import type { GUIPackage, Course, Category, Session, Packages, AutoUpdateStatus } from "./types";
|
||||
import type { GUIPackage, Session, Packages, AutoUpdateStatus } from "./types";
|
||||
import { PackageStates } from "./types";
|
||||
import { loremIpsum } from "lorem-ipsum";
|
||||
import _ from "lodash";
|
||||
|
@ -29,7 +29,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/mesonbuild_com.jpg",
|
||||
installs: 0,
|
||||
categories: ["foundation_essentials"],
|
||||
created: "2022-10-06T15:45:08.000Z"
|
||||
created: "2022-10-06T15:45:08.000Z",
|
||||
manual_sorting: 0,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "pixman_org",
|
||||
|
@ -45,7 +47,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/pixman_org.jpg",
|
||||
installs: 0,
|
||||
categories: ["foundation_essentials"],
|
||||
created: "2022-09-26T19:37:47.000Z"
|
||||
created: "2022-09-26T19:37:47.000Z",
|
||||
manual_sorting: 1,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "freedesktop_org_pkg_config",
|
||||
|
@ -61,7 +65,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/freedesktop_org_pkg_config.jpg",
|
||||
installs: 0,
|
||||
categories: ["foundation_essentials"],
|
||||
created: "2022-10-20T01:32:15.000Z"
|
||||
created: "2022-10-20T01:32:15.000Z",
|
||||
manual_sorting: 2,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "gnu_org_gettext",
|
||||
|
@ -77,7 +83,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/gnu_org_gettext.jpg",
|
||||
installs: 0,
|
||||
categories: ["foundation_essentials"],
|
||||
created: "2022-10-20T01:23:46.000Z"
|
||||
created: "2022-10-20T01:23:46.000Z",
|
||||
manual_sorting: 3,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "ipfs_tech",
|
||||
|
@ -93,7 +101,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/ipfs_tech.jpg",
|
||||
installs: 0,
|
||||
categories: ["foundation_essentials"],
|
||||
created: "2022-10-19T21:36:52.000Z"
|
||||
created: "2022-10-19T21:36:52.000Z",
|
||||
manual_sorting: 4,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "nixos_org_patchelf",
|
||||
|
@ -109,7 +119,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/nixos_org_patchelf.jpg",
|
||||
installs: 0,
|
||||
categories: ["top_packages", "foundation_essentials"],
|
||||
created: "2022-09-27T04:50:44.000Z"
|
||||
created: "2022-09-27T04:50:44.000Z",
|
||||
manual_sorting: 5,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "tea_xyz",
|
||||
|
@ -125,7 +137,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/tea_xyz.jpg",
|
||||
installs: 0,
|
||||
categories: ["top_packages", "foundation_essentials"],
|
||||
created: "2022-10-19T19:13:51.000Z"
|
||||
created: "2022-10-19T19:13:51.000Z",
|
||||
manual_sorting: 6,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "charm_sh_gum",
|
||||
|
@ -141,7 +155,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/charm_sh_gum.jpg",
|
||||
installs: 0,
|
||||
categories: ["top_packages", "foundation_essentials"],
|
||||
created: "2022-10-21T02:15:16.000Z"
|
||||
created: "2022-10-21T02:15:16.000Z",
|
||||
manual_sorting: 7,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "pyyaml_org",
|
||||
|
@ -157,7 +173,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/pyyaml_org.jpg",
|
||||
installs: 0,
|
||||
categories: ["top_packages", "foundation_essentials"],
|
||||
created: "2022-10-03T15:35:14.000Z"
|
||||
created: "2022-10-03T15:35:14.000Z",
|
||||
manual_sorting: 8,
|
||||
card_layout: "bottom"
|
||||
},
|
||||
{
|
||||
slug: "tea_xyz_gx_cc",
|
||||
|
@ -173,7 +191,9 @@ const packages: Package[] = [
|
|||
thumb_image_url: "https://tea.xyz/Images/packages/tea_xyz_gx_cc.jpg",
|
||||
installs: 0,
|
||||
categories: ["top_packages", "foundation_essentials"],
|
||||
created: "2022-10-19T16:47:44.000Z"
|
||||
created: "2022-10-19T16:47:44.000Z",
|
||||
manual_sorting: 9,
|
||||
card_layout: "bottom"
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -236,7 +256,7 @@ export async function getPackageReviews(full_name: string): Promise<Review[]> {
|
|||
}
|
||||
|
||||
export async function installPackage(pkg: GUIPackage, version?: string) {
|
||||
console.log("installing: ", pkg.full_name);
|
||||
console.log("installing: ", pkg.full_name, version);
|
||||
await delay(10000);
|
||||
}
|
||||
|
||||
|
@ -338,12 +358,12 @@ export const updateSession = async (session: Partial<Session>) => {
|
|||
|
||||
export const openTerminal = (cmd: string) => console.log(cmd);
|
||||
|
||||
export const shellOpenExternal = (link: string) => {
|
||||
export const shellOpenExternal = (link?: string) => {
|
||||
window.open(link, "_blank");
|
||||
};
|
||||
|
||||
export const listenToChannel = (channel: string, callback: (msg: string, ...args: any) => void) => {
|
||||
console.log("listen to channel", callback);
|
||||
console.log("listen to channel", channel, callback);
|
||||
};
|
||||
|
||||
export const relaunch = () => {
|
||||
|
@ -380,7 +400,7 @@ export const topbarDoubleClick = async () => {
|
|||
console.log("topbar double click");
|
||||
};
|
||||
|
||||
export const cacheImageURL = async (url: string): Promise<string | undefined> => {
|
||||
export const cacheImageURL = async (_url: string): Promise<string | undefined> => {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import type { GUIPackage } from "$libs/types";
|
||||
import type { Package } from "@tea/ui/types";
|
||||
import { clean } from "semver";
|
||||
import semverCompare from "semver/functions/compare";
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import Fuse from "fuse.js";
|
|||
import type { Package, Review, AirtablePost } from "@tea/ui/types";
|
||||
import type { GUIPackage } from "$libs/types";
|
||||
|
||||
import { getFeaturedPackages, getPackageReviews, getAllPosts } from "@native";
|
||||
import { getFeaturedPackages, getPackageReviews } from "@native";
|
||||
import initAuthStore from "./stores/auth";
|
||||
import initNavStore from "./stores/nav";
|
||||
import initPackagesStore from "./stores/pkgs";
|
||||
|
@ -61,7 +61,7 @@ export const packagesReviewStore = initPackagesReviewStore();
|
|||
|
||||
function initPosts() {
|
||||
let initialized = false;
|
||||
const { subscribe, set } = writable<AirtablePost[]>([]);
|
||||
const { subscribe } = writable<AirtablePost[]>([]);
|
||||
const posts: AirtablePost[] = [];
|
||||
let postsIndex: Fuse<AirtablePost>;
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ import type { Developer } from "@tea/ui/types";
|
|||
import type { Session } from "$libs/types";
|
||||
import { getSession as electronGetSession, updateSession as electronUpdateSession } from "@native";
|
||||
|
||||
import { navStore } from "$libs/stores";
|
||||
|
||||
export let session: Session | null = null;
|
||||
export const getSession = async (): Promise<Session | null> => {
|
||||
session = await electronGetSession();
|
||||
|
|
|
@ -38,7 +38,7 @@ export default function initNavStore() {
|
|||
if (currentIndex === 0) prevPathStore.set("");
|
||||
}
|
||||
},
|
||||
setNewPath: (newNextPath: string, newPrevPath: string) => {
|
||||
setNewPath: (newNextPath: string, _newPrevPath: string) => {
|
||||
const oldCurrentPath = history[currentIndex];
|
||||
const isNavArrows = isMovingBack || isMovingNext;
|
||||
if (!isNavArrows && newNextPath !== oldCurrentPath) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
} from "@native";
|
||||
|
||||
import { getReadme, getContributors, getRepoAsPackage } from "$libs/github";
|
||||
import { NotificationType, type Package } from "@tea/ui/types";
|
||||
import { NotificationType } from "@tea/ui/types";
|
||||
import { trackInstall, trackInstallFailed } from "$libs/analytics";
|
||||
import { addInstalledVersion } from "$libs/packages/pkg-utils";
|
||||
import withDebounce from "$libs/utils/debounce";
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
$: needsUpdateCount = pkgsToUpdate.length;
|
||||
|
||||
afterNavigate(({ from, to }) => {
|
||||
afterNavigate(({ to }) => {
|
||||
if (to?.url?.pathname === "/") {
|
||||
const tab = to.url.searchParams.get("tab");
|
||||
sideMenuOption = !tab ? SideMenuOptions.discover : (tab as SideMenuOptions);
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"paths": {},
|
||||
"paths": {
|
||||
"$lib": ["src/lib"],
|
||||
"$lib/*": ["src/lib/*"]
|
||||
},
|
||||
"rootDirs": ["..", "./types"],
|
||||
"importsNotUsedAsValues": "error",
|
||||
"isolatedModules": true,
|
||||
|
|
Loading…
Reference in a new issue