Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
#186 init electron
Browse files Browse the repository at this point in the history
  • Loading branch information
neil authored and neil committed Feb 2, 2023
1 parent ccd00b5 commit 0d6336a
Show file tree
Hide file tree
Showing 26 changed files with 4,933 additions and 61 deletions.
39 changes: 24 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,23 @@ jobs:
changes:
runs-on: ubuntu-latest
outputs:
svelte: ${{steps.svelte.outputs.src}}
tauri: ${{steps.tauri.outputs.src}}
desktop: ${{steps.desktop.outputs.src}}
preview_folder: ${{steps.preview.outputs.folder}}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: svelte
id: desktop
with:
filters: |
src:
- 'modules/gui/src/**'
- 'modules/desktop/**'
- 'modules/ui/**'
- uses: dorny/paths-filter@v2
id: tauri
with:
filters: |
src:
- 'modules/gui/src-tauri/**'
- 'modules/gui/src/**'
- 'modules/ui/src/**'
- name: get s3 preview folder
id: preview
run: echo "folder=${{ github.event.number }}-merge" >> $GITHUB_OUTPUT
no_preview:
needs: changes
if: needs.changes.outputs.svelte == 'false'
if: needs.changes.outputs.desktop == 'false'
runs-on: ubuntu-latest
steps:
- name: comment preview site
Expand Down Expand Up @@ -104,10 +95,28 @@ jobs:
https://${{steps.preview_setup.outputs.domain}}
```
copy-paste into a browser to view
build_desktop:
needs: changes
if: needs.changes.outputs.desktop == 'true'
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- os: macos-11
name: darwin+x86-64
- os: ubuntu-latest
name: linux+x86-64
- os: [self-hosted, macOS, ARM64]
name: darwin+aarch64
# err: Package atk was not found in the pkg-config search path.
# requires atk >= 2.18
# - os: [self-hosted, linux, ARM64]
# name: linux+aarch64
steps:
- uses: actions/checkout@v3
build_tauri:
needs: changes
if: needs.changes.outputs.tauri == 'true'
if: needs.changes.outputs.desktop == 'true'
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
Expand Down
9 changes: 9 additions & 0 deletions modules/desktop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
coverage/*
1 change: 1 addition & 0 deletions modules/desktop/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node-linker=hoisted
61 changes: 61 additions & 0 deletions modules/desktop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# @tea/desktop

Desktop app of [tea](https://tea.xyz) for installing packages/softwares

More interesting and possibly updated documentations are at this [NOTION](https://www.notion.so/teaxyz/tea-gui-fdd9f50aa980432fa370b2cf6a03cb50) page. It is ideal to review it also, its more updated.

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
# use if you need interaction with the rust handlers
pnpm tauri dev

# or if ui dev only
pnpm run dev -- --open
```

## Building

To create a production version of your app:

```bash
pnpm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
## Testing

```bash
pnpm playwright install
pnpm test

```

## Intuition Building Links

- [Rust module system is weird?](https://www.sheshbabu.com/posts/rust-module-system/)

<p align="center">
<img src="https://github.com/Dax89/electron-sveltekit/blob/master/icon.png" width="256">
</p>
<p align="center">
A minimal project template for Electron and SvelteKit configured with <a href="https://www.npmjs.com/package/@sveltejs/adapter-static">adapter-static</a>.
</p>

## Screenshot
![Screenshot](https://github.com/Dax89/electron-sveltekit/blob/master/screenshot.png)



## Commands
- `pnpm dev`: Runs SvelteKit in dev mode
- `pnpm preview`: Runs SvelteKit in production mode
- `pnpm electron`: Runs SvelteKit with electron in dev mode
- `pnpm build`: Runs SvelteKit compiler
- `pnpm dev:package`: Creates an Electron package (you can inspect the contents)
- `pnpm package`: Creates a distributable Electron package
8 changes: 8 additions & 0 deletions modules/desktop/electron-builder.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"asar": false,
"directories": { "output": "dist" },
"files": [
"src/electron.cjs",
{ "from": "build", "to": "" }
]
}
96 changes: 96 additions & 0 deletions modules/desktop/electron_svelte.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/desktop/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions modules/desktop/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "@tea/desktop",
"version": "0.0.0",
"private": true,
"scripts": {
"package": "pnpm build && electron-builder --config electron-builder.config.json",
"dev:package": "pnpm build && electron-builder --config electron-builder.config.json --dir",
"electron": "concurrently --kill-others \"vite dev\" \"electron src/electron.cjs\"",
"dev": "vite dev --port 8080",
"build": "vite build && cp build/app.html build/index.html",
"preview": "vite preview",
"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",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@sveltejs/adapter-node": "^1.0.0-next.101",
"@sveltejs/adapter-static": "^1.0.0-next.48",
"@sveltejs/kit": "^1.0.0-next.562",
"concurrently": "^6.5.1",
"electron": "^22.1.0",
"electron-builder": "^23.6.0",
"electron-reloader": "^1.2.3",
"sass": "^1.56.1",
"svelte": "^3.55.1",
"svelte-preprocess": "^5.0.1",
"vite": "^4.0.4",
"@playwright/experimental-ct-svelte": "^1.29.2",
"@playwright/test": "1.25.0",
"@sveltejs/adapter-auto": "^1.0.0",
"@tea/ui": "workspace:*",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/svelte": "^3.2.2",
"@types/testing-library__jest-dom": "^5.14.5",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"autoprefixer": "^10.4.13",
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-svelte3": "^4.0.0",
"jsdom": "^21.0.0",
"postcss": "^8.4.19",
"prettier": "^2.7.1",
"prettier-plugin-svelte": "^2.7.0",
"prettier-plugin-tailwindcss": "^0.2.0",
"svelte-check": "^2.8.0",
"svelte2tsx": "^0.5.20",
"tailwindcss": "^3.2.4",
"tslib": "^2.3.1",
"typescript": "^4.7.4",
"vitest": "^0.27.1"
},
"type": "module",
"dependencies": {
"electron-log": "^4.4.8",
"electron-serve": "^1.1.0",
"electron-window-state": "^5.0.3",
"@types/bcryptjs": "^2.4.2",
"@types/url-join": "^4.0.1",
"@vitest/coverage-c8": "^0.27.1",
"bcryptjs": "^2.4.3",
"buffer": "^6.0.3",
"fuse.js": "^6.6.2",
"lodash": "^4.17.21",
"lorem-ipsum": "^2.0.8",
"svelte-markdown": "^0.2.3",
"svelte-watch-resize": "^1.0.3",
"url-join": "^5.0.0"
},
"pnpm": {
"onlyBuiltDependencies": [
"@tea/ui"
]
}
}
Loading

0 comments on commit 0d6336a

Please sign in to comment.