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

feat/vitepress #514

Merged
merged 19 commits into from
Dec 26, 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
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

39 changes: 0 additions & 39 deletions .eslintrc

This file was deleted.

25 changes: 11 additions & 14 deletions .github/workflows/DevelopServerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: npm run lint

- name: Test
run: npm run test
run: npm run test --workspaces --if-present

build:
needs: test
Expand All @@ -45,23 +45,20 @@ jobs:
- name: Build action runner
run: docker build -t "wgd-action-runner:develop" --build-arg "GIT_SHA=${GITHUB_SHA}" apps/wgd-action-runner

- name: Build hugo docs
run: |
docker run \
-v "${GITHUB_WORKSPACE}/hugo:/site" \
-v "${GITHUB_WORKSPACE}/website:/website" \
-v "/var/www/dev.wikigdrive.com:/dist/hugo" \
--env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://dev.wikigdrive.com" \
wgd-action-runner:develop /steps/step_render_hugo

- name: Copy index for vite
run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/dev.wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo

- uses: docker/build-push-action@v6
with:
tags: "wikigdrive-develop:${{ github.sha }},wikigdrive-develop:latest"
push: false
build-args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}"
build-args: |
GIT_SHA=${{ github.sha }}
BUILD_UI=yes

- name: Build docs
run: |
docker run \
-v "/var/www/dev.wikigdrive.com:/usr/src/app/website/.vitepress/dist" \
-e "GIT_SHA=${{ github.sha }}" \
"wikigdrive-develop:${{ github.sha }}" npm run build --workspace website

- name: Stop and remove
run: docker stop wikigdrive-develop ; docker rm wikigdrive-develop
Expand Down
25 changes: 11 additions & 14 deletions .github/workflows/ProdServerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: npm run lint

- name: Test
run: npm run test
run: npm run test --workspaces --if-present

build:
needs: test
Expand All @@ -46,23 +46,20 @@ jobs:
- name: Build action runner
run: docker build -t "wgd-action-runner:prod" --build-arg "GIT_SHA=${GITHUB_SHA}" apps/wgd-action-runner

- name: Build hugo docs
run: |
docker run \
-v "${GITHUB_WORKSPACE}/hugo:/site" \
-v "${GITHUB_WORKSPACE}/website:/website" \
-v "/var/www/wikigdrive.com:/dist/hugo" \
--env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://wikigdrive.com" \
wgd-action-runner:prod /steps/step_render_hugo

- name: Copy index for vite
run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo

- uses: docker/build-push-action@v6
with:
tags: "wikigdrive-prod:${{ github.sha }},wikigdrive-prod:latest"
push: false
build-args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}"
build-args: |
GIT_SHA=${{ github.sha }}
BUILD_UI=yes

- name: Build docs
run: |
docker run \
-v "/var/www/wikigdrive.com:/usr/src/app/website/.vitepress/dist" \
-e "GIT_SHA=${{ github.sha }}" \
"wikigdrive-prod:${{ github.sha }}" npm run npm run build --workspace website

- name: Stop and remove
run: docker stop wikigdrive-prod ; docker rm wikigdrive-prod
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/feat-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: npm run lint

- name: Test
run: npm run test
run: npm run test --workspaces --if-present

build:
needs: test
Expand Down
33 changes: 16 additions & 17 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: npm run lint

- name: Test
run: npm run test
run: npm run test --workspaces --if-present

build:
if: github.event.pull_request.head.ref != 'develop' && contains( github.event.pull_request.labels.*.name, 'deploy-pr')
Expand All @@ -49,31 +49,29 @@ jobs:
- name: Build action runner
run: docker build -t "wgd-action-runner:pr-${{ github.event.number }}" --build-arg "GIT_SHA=${{ github.sha }}" apps/wgd-action-runner

- name: Build hugo docs
run: |
docker run \
-v "${GITHUB_WORKSPACE}/hugo:/site" \
-v "${GITHUB_WORKSPACE}/website:/website" \
-v "/var/www/pr-${{ github.event.number }}.wikigdrive.com:/dist/hugo" \
--env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://pr-${{ github.event.number }}.wikigdrive.com" \
wgd-action-runner:pr-${{ github.event.number }} /steps/step_render_hugo

- name: Copy index for vite
run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/pr-${{ github.event.number }}.wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo

- name: build
uses: docker/build-push-action@v6
with:
tags: "wikigdrive-feature:${{ github.sha }}"
push: false
build-args: "{'--build-arg': 'GIT_SHA=${{ github.sha }}'}"
build-args: |
GIT_SHA=${{ github.sha }}
BUILD_UI=yes

- name: Build docs
run: |
docker run \
-v "/var/www/pr-${{ github.event.number }}.wikigdrive.com:/usr/src/app/website/.vitepress/dist" \
-e "GIT_SHA=${{ github.sha }}" \
"wikigdrive-feature:${{ github.sha }}" npm run build --workspace website

- name: Stop and remove
run: docker stop "pr-${{ github.event.number }}" ; docker rm "pr-${{ github.event.number }}"
continue-on-error: true

- name: "Create empty volume"
run: docker volume rm -f "pr-${{ github.event.number }}" ; docker volume create "pr-${{ github.event.number }}"
run: docker volume create "pr-${{ github.event.number }}"
continue-on-error: true

- name: Start
run: |
Expand All @@ -83,15 +81,16 @@ jobs:
--tmpfs /tmp \
-v "pr-${{ github.event.number }}":/data \
-v /home/wikigdrive/service_account.json:/service_account.json \
-v /home/wikigdrive/env.develop:/usr/src/app/.env \
-v /home/wikigdrive/env.pr:/usr/src/app/.env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "/var/www/pr-${{ github.event.number }}.wikigdrive.com:/usr/src/app/dist/hugo" \
-e "GIT_SHA=${{ github.sha }}" \
-v "/var/www/pr-${{ github.event.number }}.wikigdrive.com:/usr/src/app/website/.vitepress/dist" \
-e "ZIPKIN_URL=https://pr-${{ github.event.number }}.wikigdrive.com/zipkin" \
-e "ZIPKIN_SERVICE=pr-${{ github.event.number }}" \
-e "AUTH_DOMAIN=https://dev.wikigdrive.com" \
-e "AUTH_INSTANCE=pr-${{ github.event.number }}" \
-e "DOMAIN=https://pr-${{ github.event.number }}.wikigdrive.com" \
-e "ACTION_IMAGE=wgd-action-runner:pr-${{ github.event.number }}" \
"wikigdrive-feature:${{ github.sha }}" wikigdrive \
--service_account /service_account.json \
--share_email [email protected] \
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.10.0
22.10.0
28 changes: 18 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
FROM node:20-alpine
FROM node:22-bookworm-slim

RUN apk add --no-cache bash openssh-keygen git-lfs openssh-client
ARG BUILD_UI
ARG GIT_SHA
EXPOSE 3000
VOLUME /data
WORKDIR /usr/src/app

RUN apt-get update
RUN apt-get install -yq bash git-lfs openssh-client curl unzip socat
RUN curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh

COPY package.json package-lock.json ./
RUN npm install
RUN npm install --location=global ts-node
COPY deno.json deno.lock ./
#RUN npm install
#RUN npm install --location=global ts-node

COPY . ./
RUN npm link --location=user

EXPOSE 3000
VOLUME /data
RUN deno install
#RUN if [ -z "$BUILD_UI" ] ; then cd /usr/src/app/apps/ui && npm run build ; fi
monpie3 marked this conversation as resolved.
Show resolved Hide resolved
#RUN npm link --location=user
RUN ln -sf /usr/src/app/src/wikigdrive.sh /usr/local/bin/wikigdrive
RUN ln -sf /usr/src/app/src/wikigdrivectl.sh /usr/local/bin/wikigdrivectl

RUN cp /usr/src/app/hugo/themes/wgd-bootstrap/layouts/_default/baseof.html /usr/src/app/apps/ui/index.html
RUN if [[ -d /usr/src/app/dist/hugo/ui ]]; then cp /usr/src/app/dist/hugo/ui/index.html /usr/src/app/apps/ui/index.html ; fi
RUN cd /usr/src/app/apps/ui && npm install && npm run build
RUN npm install && npm run build --workspaces

WORKDIR "/usr/src/app"

Expand Down
39 changes: 0 additions & 39 deletions apps/ui/.eslintrc

This file was deleted.

24 changes: 24 additions & 0 deletions apps/ui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!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>WikiGDrive</title>
<meta name="description" content="" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" media="(prefers-color-scheme: light)" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-night.min.css" media="(prefers-color-scheme: dark)" />
<meta name="color-scheme" content="light dark" />
<meta name="theme-color" content="#111111" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#eeeeee" media="(prefers-color-scheme: light)" />
<link rel="stylesheet" type="text/css" href="/assets/main.css?GIT_SHA" />
<link rel="stylesheet" type="text/css" href="/assets/prism.css?GIT_SHA" media="(prefers-color-scheme: light)" />
<link rel="stylesheet" type="text/css" href="/assets/prism-dark.css?GIT_SHA" media="(prefers-color-scheme: dark)" />
<link rel="icon" type="image/svg+xml" href="/images/logo.svg?GIT_SHA" />
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts?GIT_SHA"></script>
</body>
</html>
11 changes: 6 additions & 5 deletions apps/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
},
"homepage": "https://github.com/mieweb/wikiGDrive#readme",
"scripts": {
"build": "vite build"
"build": "vue-tsc -b && vite build"
},
"dependencies": {
"vue": "3.5.12",
"bootstrap": "5.2.3",
"vue": "3.5.13",
"vue-prism-editor": "2.0.0-alpha.2",
"vue-router": "4.4.5"
},
"devDependencies": {
"@vitejs/plugin-vue": "5.1.4",
"eslint-plugin-vue": "8.7.1",
"typescript": "4.9.4",
"vite": "5.4.9"
"eslint-plugin-vue": "9.31.0",
"vite": "5.4.11",
"vue-tsc": "2.1.10"
}
}
File renamed without changes
File renamed without changes
29 changes: 26 additions & 3 deletions apps/ui/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<ErrorView v-if="errorMessage" :errorMessage="errorMessage">
</ErrorView>
<router-view v-else class="router-view"></router-view>
<router-view v-else-if="isReady" class="router-view"></router-view>
<ModalsContainer></ModalsContainer>
<ToastsContainer></ToastsContainer>
</template>
Expand All @@ -12,11 +12,34 @@ import ErrorView from './pages/ErrorView.vue';

export default {
data() {
const el = document.querySelector('meta[name=errorMessage]');
let errorMessage = '';

if (!import.meta.env.SSR) {
const el = document.querySelector('meta[name=errorMessage]');
errorMessage = el ? el.getAttribute('content') : '';
}

return {
errorMessage: el ? el.getAttribute('content') : ''
errorMessage
};
},
computed: {
drive() {
return this.$root.drive || {};
},
driveId() {
return this.drive.id;
},
isReady() {
if (!this.$route.meta?.requireDriveId) {
return true;
}
if (!this.driveId) {
return false;
}
return true;
}
},
components: {
ErrorView,
ModalsContainer, ToastsContainer
Expand Down
Loading
Loading