This commit is contained in:
tangtaoit 2023-07-06 09:30:52 +08:00
commit 5fe77a729c
537 changed files with 37738 additions and 0 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
.git
.gitignore
Dockerfile

10
.eslintrc.js Normal file
View File

@ -0,0 +1,10 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
extends: ["custom"],
settings: {
next: {
rootDir: ["apps/*/"],
},
},
};

42
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: "publish"
on:
push:
branches:
- release
jobs:
publish-tauri:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- 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
- name: install app dependencies and build it
run: yarn && yarn build
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} # 密钥,需要提前配置在 Github Secrets中
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_PRIVATE_KEY_PASSWORD }} # 密钥的加密文本与ssh-keygen时输入的密码一致即可。 需要提前配置在 Github Secrets中
with:
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: "v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true # 不需要 draft 的可以改成 false
prerelease: false

36
.gitignore vendored Normal file
View File

@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
node_modules
.pnp
.pnp.js
# testing
coverage
# next.js
.next/
out/
build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# turbo
.turbo
lib/
out/
build

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM node:16.13.0 as builder
WORKDIR /app
RUN curl -o- -L https://yarnpkg.com/install.sh | bash
RUN yarn config set registry https://registry.npm.taobao.org -g
RUN npm config set registry https://registry.npm.taobao.org
COPY . .
RUN yarn install && yarn build
FROM nginx:latest
COPY --from=builder /app/docker-entrypoint.sh /docker-entrypoint2.sh
COPY --from=builder /app/nginx.conf.template /
COPY --from=builder /app/apps/web/build /usr/share/nginx/html
ENTRYPOINT ["sh", "/docker-entrypoint2.sh"]
CMD ["nginx","-g","daemon off;"]

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
build:
docker build -t tsdaodaoweb .
deploy:
docker build -t tsdaodaoweb .
docker tag tsdaodaoweb registry.cn-shanghai.aliyuncs.com/wukongim/tsdaodaoweb:latest
docker push registry.cn-shanghai.aliyuncs.com/wukongim/tsdaodaoweb:latest

77
README.md Normal file
View File

@ -0,0 +1,77 @@
## 运行
1. yarn install
2. yarn dev
## 发布镜像
修改api地址 packages/tsdaodaoweb/src/index.tsx 修改 WKApp.apiClient.config.apiURL = "/api/v1/"
make deploy
## PC端运行
tauri 环境安装 (https://tauri.app/v1/guides/getting-started/prerequisites)
#### 调试
yarn tauri dev
#### 打包
yarn tauri build
window打包的时候 要去掉package.json里的 build里的REACT_APP_VERSION=$npm_package_version 要不然执行yarn tauri build 会报错)
(如果需要打包M1架构的包 需要安装 aarch64-apple-darwin执行rustup target add aarch64-apple-darwin
yarn tauri build --target aarch64-apple-darwin M1架构的包
yarn tauri build --target universal-apple-darwin (通用架构,生成可在 Apple 芯片和基于 Intel 的 Mac 上运行的通用 macOS 二进制文件。)
## 其他技巧
icon生成
```
npx @tauri-apps/tauricon [ICON-PATH]
```
准备一张1024x1024的icon 执行上面命令 即可生成各种尺寸的icon
```
icon.icns = macOS
icon.ico = MS Windows
*.png = Linux
```
**注意**
添加依赖
yarn workspace @tsdaodao/web add react-avatar-editor
## 使用Github Action 自动构建各端PC版本
需要先全局安装 @tauri-apps/cli
yarn global add @tauri-apps/cli
tauri signer generate -w ~/.tauri/tsdaodao.key
上面 的命令会自动生成一个公钥、私钥对。公钥可以公开分享,私钥必须严密保存。
在Github Secrets中 配置 TAURI_PRIVATE_KEY 和 TAURI_PRIVATE_KEY_PASSWORD
(参考https://www.banyudu.com/posts/tauri-version-release-and-update-guide)
## 自动更新
1. 修改 tauri.conf.json 里的 updater.pubkey的内容上面通过tauri signer generate 生成的公钥)
2. 修改 tauri.conf.json 里的 updater.endpoints 的内容为自己服务器的更新地址

View File

@ -0,0 +1,64 @@
var path = require('path')
const { override, babelInclude, addWebpackPlugin } = require('customize-cra')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
// module.exports = override(
// // 注意是production环境启动该plugin
// process.env.NODE_ENV === 'production' && addWebpackPlugin(
// new UglifyJsPlugin({
// // 开启打包缓存
// cache: true,
// // 开启多线程打包
// parallel: true,
// uglifyOptions: {
// // 删除警告
// warnings: false,
// // 压缩
// compress: {
// // 移除console
// drop_console: true,
// // 移除debugger
// drop_debugger: true
// }
// }
// })
// )
// )
module.exports = function (config, env) {
if (process.env.NODE_ENV === 'production') {
config.devtool = false;
}
return Object.assign(
config,
override(
// 判断环境变量ANALYZER参数的值
process.env.ANALYZER && addWebpackPlugin(new BundleAnalyzerPlugin()),
process.env.NODE_ENV === 'production' && addWebpackPlugin(
new UglifyJsPlugin({
cache: true,
// 开启多线程打包
parallel: true,
uglifyOptions: {
// 删除警告
warnings: false,
// 压缩
compress: {
// 移除console
drop_console: true,
// 移除debugger
drop_debugger: true
}
},
})
),
babelInclude([
/* transpile (converting to es5) code in src/ and shared component library */
path.resolve('src'),
path.resolve('../../packages'),
])
)(config, env)
)
}

59
apps/web/package.json Normal file
View File

@ -0,0 +1,59 @@
{
"name": "@tsdaodao/web",
"version": "1.0.0",
"private": true,
"homepage": "./",
"dependencies": {
"@tsdaodao/base": "*",
"@tsdaodao/contacts": "*",
"@tsdaodao/datasource": "*",
"@tsdaodao/login": "*",
"@tauri-apps/api": "1.1.0",
"@types/react-mentions": "^4.1.5",
"classnames": "^2.3.1",
"react": "^17.0.2",
"react-app-rewired": "^2.1.8",
"react-mentions": "^4.3.1",
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@tauri-apps/cli": "1.1.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/jest": "^24.0.0",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"cross-env": "^7.0.3",
"customize-cra": "^1.0.0",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"typescript": "~3.7.2",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack-bundle-analyzer": "^4.5.0"
},
"scripts": {
"start": "cross-env BROWSER=none REACT_APP_VERSION=$npm_package_version react-app-rewired start",
"dev": "cross-env BROWSER=none REACT_APP_VERSION=$npm_package_version react-app-rewired start",
"build": "cross-env REACT_APP_VERSION=$npm_package_version react-app-rewired build",
"build:analyzer": "cross-env ANALYZER=true REACT_APP_VERSION=$npm_package_version react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject",
"tauri": "tauri"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 944 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1020 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Some files were not shown because too many files have changed in this diff Show More