Skip to content

Commit

Permalink
feature: initialize deploying to git
Browse files Browse the repository at this point in the history
  • Loading branch information
hayzamjs committed Sep 6, 2024
1 parent 5d83af1 commit a21e7f3
Show file tree
Hide file tree
Showing 9 changed files with 422 additions and 12 deletions.
5 changes: 5 additions & 0 deletions db/models/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ type Documentation struct {
PageGroups []PageGroup `gorm:"foreignKey:DocumentationID;constraint:OnDelete:CASCADE" json:"pageGroups,omitempty"`
Pages []Page `gorm:"foreignKey:DocumentationID;constraint:OnDelete:CASCADE" json:"pages,omitempty"`
RequireAuth bool `json:"requireAuth" gorm:"default:false"`
GitRepo string `json:"gitRepo,omitempty"`
GitEmail string `json:"gitEmail,omitempty"`
GitUser string `json:"gitUser,omitempty"`
GitPassword string `json:"gitPassword,omitempty"`
GitBranch string `json:"gitBranch,omitempty"`
}

func (s Documentation) MarshalJSON() ([]byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion embedded/rspress/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
mediumZoom: {
selector: '.rspress-doc img',
},
outDir: 'build_tmp',
outDir: '__OUT_DIR__',
plugins: [],
builderConfig: {
source: {
Expand Down
9 changes: 7 additions & 2 deletions embedded/rspress/src/components/Redirect.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect } from 'react';
import { useNavigate, useLocation } from 'rspress/runtime';
import { useNavigate, useLocation, usePageData } from 'rspress/runtime';

interface RedirectProps {
to: string;
Expand All @@ -9,10 +9,15 @@ interface RedirectProps {
export const Redirect: React.FC<RedirectProps> = ({ to, from }) => {
const navigate = useNavigate();
const location = useLocation();
const pageData = usePageData();

useEffect(() => {
if (!from || location.pathname === from) {
navigate(to, { replace: true });
if (pageData.siteData.base === "/") {
navigate(`/guides/index.html`, { replace: true });
} else {
navigate(to, { replace: true });
}
}
}, [to, from, navigate, location]);

Expand Down
28 changes: 23 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,58 @@ require (
github.com/google/go-github/v39 v39.2.0
github.com/gorilla/mux v1.8.1
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.26.0
golang.org/x/mod v0.20.0
golang.org/x/crypto v0.27.0
golang.org/x/mod v0.21.0
golang.org/x/oauth2 v0.22.0
golang.org/x/text v0.17.0
golang.org/x/text v0.18.0
gorm.io/driver/postgres v1.5.9
gorm.io/gorm v1.25.11
)

require (
cloud.google.com/go/compute/metadata v0.5.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/cloudflare/circl v1.4.0 // indirect
github.com/cyphar/filepath-securejoin v0.3.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.5 // indirect
github.com/glebarez/go-sqlite v1.22.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-git/v5 v5.12.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.6.0 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
modernc.org/libc v1.59.9 // indirect
modernc.org/mathutil v1.6.0 // indirect
Expand Down
Loading

0 comments on commit a21e7f3

Please sign in to comment.