Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate demo applications to playground #4116

Merged
merged 6 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions .github/contributing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Contributing Guide
# Vben Admin Contributing Guide

1. Make sure you put things in the right category!
2. Always add your items to the end of a list. To be fair, the order is first-come-first-serve.
3. If you think something belongs in the wrong category, or think there needs to be a new category, feel free to edit things too.
Hi! We're really excited that you are interested in contributing to Vben Admin. Before submitting your contribution, please make sure to take a moment and read through the following guidelines:

- [Pull Request Guidelines](#pull-request-guidelines)

## Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of the level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

## Pull Request Guidelines

- Checkout a topic branch from the relevant branch, e.g. main, and merge back against that branch.

- If adding a new feature:

- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first and have it approved before working on it.

- If fixing bug:

- Provide a detailed description of the bug in the PR. Live demo preferred.

- It's OK to have multiple small commits as you work on the PR - GitHub can automatically squash them before merging.

## Development Setup

You will need [pnpm](https://pnpm.io/)

After cloning the repo, run:

```bash
# install the dependencies of the project
$ pnpm install
# start the project
$ pnpm run dev
```
5 changes: 2 additions & 3 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ categories:
- "perf"
- "chore"
- "dependencies"
collapse-after: 5
# collapse-after: 12
- title: 🚦 Tests
labels:
- "tests"
Expand All @@ -40,11 +40,10 @@ version-resolver:
minor:
labels:
- "minor"
# - "feature"
- "feature"
patch:
labels:
- "patch"
- "feature"
- "bug"
- "maintenance"
- "docs"
Expand Down
109 changes: 90 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,46 @@ on:
- main

jobs:
deploy-push-ftp:
deploy-push-playground-ftp:
name: Deploy Push Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Sed Config Base
shell: bash
run: |
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./playground/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./playground/.env.production
cat ./playground/.env.production

- name: Setup Node
uses: ./.github/actions/setup-node

- name: Build
run: pnpm run build

- name: Sync Playground files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEB_PLAYGROUND_FTP_ACCOUNT }}
password: ${{ secrets.WEB_PLAYGROUND_FTP_PWSSWORD }}
local-dir: ./playground/dist/

- name: Sync Docs files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEBSITE_FTP_ACCOUNT }}
password: ${{ secrets.WEBSITE_FTP_PASSWORD }}
local-dir: ./docs/.vitepress/dist/

deploy-push-antd-ftp:
name: Deploy Push Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
Expand All @@ -22,47 +61,79 @@ jobs:
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-antd/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-antd/.env.production
cat ./apps/web-antd/.env.production
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-ele/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-ele/.env.production
cat ./apps/web-ele/.env.production
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-naive/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-naive/.env.production
cat ./apps/web-naive/.env.production

- name: Setup Node
uses: ./.github/actions/setup-node

- name: Build
run: pnpm run build

- name: Sync Web Antd files
- name: Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEB_ANTD_FTP_ACCOUNT }}
password: ${{ secrets.WEB_ANTD_FTP_PASSWORD }}
local-dir: ./apps/web-antd/dist/

- name: Sync Web Naive files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
deploy-push-ele-ftp:
name: Deploy Push Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEB_NAIVE_FTP_ACCOUNT }}
password: ${{ secrets.WEB_NAIVE_FTP_PASSWORD }}
local-dir: ./apps/web-naive/dist/
fetch-depth: 0

- name: Sed Config Base
shell: bash
run: |
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-ele/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-ele/.env.production
cat ./apps/web-ele/.env.production

- name: Sync Web Ele files
- name: Setup Node
uses: ./.github/actions/setup-node

- name: Build
run: pnpm run build

- name: Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEB_ELE_FTP_ACCOUNT }}
password: ${{ secrets.WEB_ELE_FTP_PASSWORD }}
local-dir: ./apps/web-ele/dist/

- name: Sync Docs files
deploy-push-naive-ftp:
name: Deploy Push Ftp
if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Sed Config Base
shell: bash
run: |
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-naive/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-naive/.env.production
cat ./apps/web-naive/.env.production

- name: Setup Node
uses: ./.github/actions/setup-node

- name: Build
run: pnpm run build

- name: Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.PRO_FTP_HOST }}
username: ${{ secrets.WEBSITE_FTP_ACCOUNT }}
password: ${{ secrets.WEBSITE_FTP_PASSWORD }}
local-dir: ./docs/.vitepress/dist/
username: ${{ secrets.WEB_NAIVE_FTP_ACCOUNT }}
password: ${{ secrets.WEB_NAIVE_FTP_PASSWORD }}
local-dir: ./apps/web-naive/dist/
4 changes: 0 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
"esbenp.prettier-vscode",
// 支持 dotenv 文件语法
"mikestead.dotenv",
// 获取每个 CSS 属性的初始值。
"dzhavat.css-initial-value",
// 使 VSCode 中的 TypeScript 错误更漂亮、更易于理解
"yoavbls.pretty-ts-errors",
// 源代码的拼写检查器
"streetsidesoftware.code-spell-checker",
// Tailwind CSS 的官方 VS Code 插件
Expand Down
15 changes: 12 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@
"configurations": [
{
"type": "chrome",
"name": "vben admin antd dev",
"name": "vben admin playground dev",
"request": "launch",
"url": "http://localhost:5555",
"env": { "NODE_ENV": "development" },
"sourceMaps": true,
"webRoot": "${workspaceFolder}/playground/src"
},
{
"type": "chrome",
"name": "vben admin antd dev",
"request": "launch",
"url": "http://localhost:5666",
"env": { "NODE_ENV": "development" },
"sourceMaps": true,
"webRoot": "${workspaceFolder}/apps/web-antd/src"
},
{
"type": "chrome",
"name": "vben admin ele dev",
"request": "launch",
"url": "http://localhost:5666",
"url": "http://localhost:5777",
"env": { "NODE_ENV": "development" },
"sourceMaps": true,
"webRoot": "${workspaceFolder}/apps/web-ele/src"
Expand All @@ -24,7 +33,7 @@
"type": "chrome",
"name": "vben admin naive dev",
"request": "launch",
"url": "http://localhost:5777",
"url": "http://localhost:5888",
"env": { "NODE_ENV": "development" },
"sourceMaps": true,
"webRoot": "${workspaceFolder}/apps/web-naive/src"
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@

"i18n-ally.localesPaths": [
"packages/locales/src/langs",
"playground/src/langs",
"apps/*/src/locales/langs"
],
"i18n-ally.enabledParsers": ["json", "ts", "js", "yaml"],
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN echo "Builder Success 🎉"
FROM nginx:stable-alpine as production

RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf
COPY --from=builder /app/apps/web-antd/dist /usr/share/nginx/html
COPY --from=builder /app/playground/dist /usr/share/nginx/html

COPY ./nginx.conf /etc/nginx/nginx.conf

Expand Down
3 changes: 2 additions & 1 deletion README.ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ pnpm build
## 貢献者

<a href="https://github.com/vbenjs/vue-vben-admin/graphs/contributors">
<img src="https://contrib.rocks/image?repo=vbenjs/vue-vben-admin" />
<img alt="Contributors"
src="https://opencollective.com/vbenjs/contributors.svg?button=false" />
</a>

## Discord
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ If you think this project is helpful to you, you can help the author buy a cup o
## Contributor

<a href="https://github.com/vbenjs/vue-vben-admin/graphs/contributors">
<img src="https://contrib.rocks/image?repo=vbenjs/vue-vben-admin" />
<img alt="Contributors"
src="https://opencollective.com/vbenjs/contributors.svg?button=false" />
</a>

## Discord
Expand Down
7 changes: 7 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ pnpm build

<a style="display: block;width: 100px;height: 50px;line-height: 50px; color: #fff;text-align: center; background: #408aed;border-radius: 4px;" href="https://www.paypal.com/paypalme/cvvben">Paypal Me</a>

## Contributor

<a href="https://github.com/vbenjs/vue-vben-admin/graphs/contributors">
<img alt="Contributors"
src="https://opencollective.com/vbenjs/contributors.svg?button=false" />
</a>

## Discord

- [Github Discussions](https://github.com/anncwb/vue-vben-admin/discussions)
Expand Down
2 changes: 1 addition & 1 deletion apps/web-antd/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 应用标题
VITE_APP_TITLE=Vben Admin
VITE_APP_TITLE=Vben Admin Antd

# 应用命名空间,用于缓存、store等功能的前缀,确保隔离
VITE_APP_NAMESPACE=vben-web-antd
2 changes: 1 addition & 1 deletion apps/web-antd/.env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 端口号
VITE_PORT=5555
VITE_PORT=5666

VITE_BASE=/

Expand Down
2 changes: 1 addition & 1 deletion apps/web-antd/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(function () {
var hm = document.createElement('script');
hm.src =
'https://hm.baidu.com/hm.js?d20a01273820422b6aa2ee41b6c9414d';
'https://hm.baidu.com/hm.js?b38e689f40558f20a9a686d7f6f33edf';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();
Expand Down
1 change: 0 additions & 1 deletion apps/web-antd/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './core';
export * from './demos';
2 changes: 1 addition & 1 deletion apps/web-antd/src/api/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function createRequestClient(baseURL: string) {
if (status >= 200 && status < 400 && code === 0) {
return data;
}
throw new Error(msg);
throw new Error(`Error ${status}: ${msg}`);
});
return client;
}
Expand Down
6 changes: 5 additions & 1 deletion apps/web-antd/src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) {
locale = await import('dayjs/locale/en');
}
}
dayjs.locale(locale);
if (locale) {
dayjs.locale(locale);
} else {
console.error(`Failed to load dayjs locale for ${lang}`);
}
}

/**
Expand Down
Loading
Loading