Skip to content
This repository was archived by the owner on Jul 26, 2023. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
itxve committed Dec 10, 2022
0 parents commit 54c3f76
Show file tree
Hide file tree
Showing 55 changed files with 7,073 additions and 0 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# 可选,将显示在 GitHub 存储库的“操作”选项卡中的工作流名称
name: Release CI

# 指定此工作流的触发器
on:
push:
# 匹配特定标签 (refs/tags)
tags:
- 'v*' # 推送事件匹配 v*, 例如 v1.0,v20.15.10 等来触发工作流

# 需要运行的作业组合
jobs:
# 任务:创建 release 版本
create-release:
runs-on: ubuntu-latest
outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}

steps:
- uses: actions/checkout@v3
# 查询版本号(tag)
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=version::"${GITHUB_REF:10}"
# 根据查询到的版本号创建 release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: '${{ steps.get_version.outputs.VERSION }}'
release_name: 'app ${{ steps.get_version.outputs.VERSION }}'
body: 'See the assets to download this version and install.'

# 编译 Tauri
build-tauri:
needs: create-release
strategy:
fail-fast: false
matrix:
platform: [macos-latest, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3

# 安装 Node.js
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
# 安装 Rust
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

# 使用 Rust 缓存,加快安装速度
# - uses: Swatinem/rust-cache@v1
# - name: install dependencies (ubuntu only)
# if: matrix.platform == 'ubuntu-latest'
# run: |
# sudo apt-get update
# sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf

# 使用 Rust 缓存,加快安装速度 (没感觉快)
- name: Rust-cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ runner.os }}-Rust

# 安装依赖执行构建,以及推送 github release
- name: Install app dependencies and build it
run: pnpm i && pnpm build
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}

updater:
runs-on: ubuntu-latest
needs: [create-release, build-tauri]
steps:
- uses: actions/checkout@v3
- run: yarn && yarn updater
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy install.json
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./updater
force_orphan: true

25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.history
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 第一次尝试 Rust写个小程序

# 踩坑
#### Js参数使用驼峰命名调用 (找了1个小时😂😂😂)
```
Rust
`pub fn projects(app_config_path: &str)`
Js Call
`invoke('projects',{appConfigPath:''})`
```

#### Rust vec<u8> 不能直接转 JS Uint8Array类型 (天真以为能直接转,结果找了3个小时😂😂😂)
```
Rust
`
fn read_file(file_path: std::path::PathBuf) -> Rt<Vec<u8>>
`
JS 错误🙅
`
RustCallResult<Uint8Array> = await invoke("read_file");
`
JS 正确🙆
`
RustCallResult<number[]> = await invoke("read_file");
Uint8Array::form(number[])
`
```

## [tarui图标生成](https://tauri.app/v1/guides/features/icons/#creating-the-icons-manually)

# 突然不能打包了 (未获得授权将Apple事件发送给Finder) 可能我装的totalfinder有问题
`
tccutil reset AppleEvents com.binaryage.totalfinder.agent
`
https://totalfinder.binaryage.com/injection-troubles

# 鸣谢
[📚 Tauri Tutorial (系列教程 - 打造属于自己的跨端应用)](https://github.com/lencx/tauri-tutorial)


# 免责声明
### 该软件仅用于个人学习使用
- 禁止商用或者非法用途.
- 禁止商用或者非法用途.
- 禁止商用或者非法用途.
8 changes: 8 additions & 0 deletions UPDATE_LOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Updater Log

## v1.1.0
增加系统托盘及快捷键退出,模块目录变更🚗

## v1.0.9
使用文件监视器更新列表

60 changes: 60 additions & 0 deletions auto-imports.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Generated by 'unplugin-auto-import'
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const resolveDirective: typeof import('vue')['resolveDirective']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useDialog: typeof import('naive-ui')['useDialog']
const useLoadingBar: typeof import('naive-ui')['useLoadingBar']
const useMessage: typeof import('naive-ui')['useMessage']
const useNotification: typeof import('naive-ui')['useNotification']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
15 changes: 15 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'

export {}

declare module '@vue/runtime-core' {
export interface GlobalComponents {
DraftItem: typeof import('./src/components/DraftItem.vue')['default']
NEmpty: typeof import('naive-ui')['NEmpty']
NSpace: typeof import('naive-ui')['NSpace']
RmMain: typeof import('./src/components/RmMain.vue')['default']
}
}
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri + Vue + TS</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "my-tauri-app",
"private": true,
"version": "1.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"tauri": "tauri",
"tauri:dev": "RUST_BACKTRACE=1 tauri dev",
"updater": "node scripts/updater.mjs",
"release": "node scripts/release.mjs"
},
"dependencies": {
"@tauri-apps/api": "^1.1.0",
"vue": "^3.2.37"
},
"devDependencies": {
"@actions/github": "^5.1.0",
"@rollup/plugin-alias": "^4.0.2",
"@tauri-apps/cli": "^1.1.0",
"@types/node": "^18.7.10",
"@vitejs/plugin-vue": "^3.0.1",
"naive-ui": "^2.34.2",
"typescript": "^4.6.4",
"unplugin-auto-import": "^0.12.0",
"unplugin-vue-components": "^0.22.11",
"vite": "^3.0.2",
"node-fetch": "^3.2.10",
"vue-tsc": "^1.0.0"
}
}
Loading

0 comments on commit 54c3f76

Please sign in to comment.