Skip to content

Commit

Permalink
admin: Initialize workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrRip committed Nov 7, 2023
1 parent 1bec3bd commit 9e7988f
Show file tree
Hide file tree
Showing 16 changed files with 260 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-deploy-[all].yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ jobs:
name: Build & Deploy / ${{ matrix.package }}
strategy:
matrix:
package: [home]
include:
- package: home
package_cap: HOME
- package: admin
package_cap: ADMIN
uses: ./.github/workflows/build-deploy.yml
with:
package: ${{ matrix.package }}
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/build-deploy-admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build & Deploy / admin
run-name: Build & Deploy (${{ github.ref_name }}/admin)

on:
push:
paths:
- 'packages/admin/**'

concurrency: build-deploy-admin-${{ github.ref }}

jobs:
build-deploy-admin:
name: Build & Deploy
uses: ./.github/workflows/build-deploy.yml
with:
package: admin
package_cap: ADMIN
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/build-deploy-home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ jobs:
uses: ./.github/workflows/build-deploy.yml
with:
package: home
package_cap: HOME
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
package:
required: true
type: string
package_cap:
required: true
type: string
secrets:
PROD_CLOUD_SSH_URI:
required: true
Expand All @@ -15,6 +18,8 @@ on:
required: true
PROD_CLOUD_PROJECT_ROOT:
required: true
PROD_HOME_PM2_CONF_ENV:
PROD_ADMIN_PM2_CONF_ENV:

jobs:
build:
Expand Down Expand Up @@ -42,6 +47,19 @@ jobs:
run: pnpm -F ${{ inputs.package }} install
- name: Build standalone server
run: 'pnpm run build:${{ inputs.package }}'
- name: Replace environment variables
run: |
[ -z "${{ secrets[format('PROD_{0}_PM2_CONF_ENV', inputs.package_cap)] }}" ] || (
echo "${{ secrets[format('PROD_{0}_PM2_CONF_ENV', inputs.package_cap)] }}" |
awk '
/env: {/,/}/ {
if (/env: {/ || /}/) print;
while((getline < "/dev/stdin") > 0) print;
next
}
{ print }
' packages/${{ inputs.package }}/ecosystem.config.js
)
- name: Package the build
run: |
cd packages/${{ inputs.package }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
!.idea/jsLinters/
!.idea/icon.svg

### Dotenv
.env

### Node.js
# Logs
*.log*
Expand Down
1 change: 1 addition & 0 deletions .idea/dictionaries/thrrip.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .run/build_admin.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="build:admin" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="build:admin" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
12 changes: 12 additions & 0 deletions .run/dev_admin.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="dev:admin" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="dev:admin" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
12 changes: 12 additions & 0 deletions .run/preview_admin.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="preview:admin" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="preview:admin" />
</scripts>
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"postinstall": "nuxt prepare && pnpm -r exec nuxt prepare",
"dev:home": "pnpm -F home exec nuxt dev",
"build:home": "pnpm -F home exec nuxt build",
"preview:home": "pnpm -F home exec nuxt preview"
"preview:home": "pnpm -F home exec nuxt preview",
"dev:admin": "pnpm -F admin exec nuxt dev",
"build:admin": "pnpm -F admin exec nuxt build",
"preview:admin": "pnpm -F admin exec nuxt preview"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.4.2",
Expand Down
1 change: 1 addition & 0 deletions packages/admin/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '../../app.config'
15 changes: 15 additions & 0 deletions packages/admin/ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
apps: [
{
name: 'mzg.fan-admin',
script: './.output/server/index.mjs',
interpreter: 'bun',
port: 22321,
max_memory_restart: '200M',
env: {
'NITRO_PORT': 22321,
'NUXT_BACKEND_API_KEY': ''
}
}
]
}
46 changes: 46 additions & 0 deletions packages/admin/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
app: {
baseURL: '/admin/',
head: {
charset: 'utf-8',
viewport: 'width=device-width, initial-scale=1',
htmlAttrs: {
lang: 'zh'
},
title: '管理面板 | 洺知-故犯',
meta: [
{ name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' },
{ name: 'theme-color', content: '#89c1cf', media: '(prefers-color-scheme: light)' },
{ name: 'theme-color', content: '#89c1cf', media: '(prefers-color-scheme: dark)' }
],
link: [
{ rel: 'icon', href: '/favicon.ico', sizes: '48x48 32x32 16x16' },
{ rel: 'apple-touch-icon', type: 'image/png', href: '/apple-touch-icon.png' },
{ rel: 'manifest', href: '/site.webmanifest' }
]
}
},

css: [
'@/../../assets/css/main.css',
'@fortawesome/fontawesome-svg-core/styles.css'
],

devServer: {
host: '0.0.0.0',
port: 3001
},

postcss: {
plugins: {
'tailwindcss': {},
'autoprefixer': {}
}
},

runtimeConfig: {
backendApiKey: ''
}
})
21 changes: 21 additions & 0 deletions packages/admin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "admin",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/vue-fontawesome": "^3.0.3",
"appwrite": "^13.0.0",
"node-appwrite": "^11.0.0",
"pinyin-pro": "^3.17.0"
},
"devDependencies": {
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@types/node": "^18.18.8",
"autoprefixer": "^10.4.15",
"nuxt": "^3.8.0",
"postcss": "^8.4.31",
"tailwind-scrollbar": "^3.0.5",
"tailwindcss": "^3.3.5"
}
}
1 change: 1 addition & 0 deletions packages/admin/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../tailwind.config')
92 changes: 90 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9e7988f

Please sign in to comment.