ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.136.3

This commit is contained in:
speakeasybot
2024-01-12 15:00:59 +00:00
parent 65d6ae7566
commit a7571169c9
8 changed files with 66 additions and 115 deletions

View File

@@ -5,7 +5,8 @@ management:
docVersion: 0.0.3
speakeasyVersion: internal
generationVersion: 2.231.0
configChecksum: d210bf572a517293dd9174bc846ad612
releaseVersion: 0.0.1
configChecksum: 88bdac673170dbc3b42817fc60e8a98a
published: true
features:
docs:
@@ -2566,7 +2567,6 @@ generatedFiles:
- Makefile
- src/components/customRedirects.tsx
- next.config.js
- server.go
- Dockerfile
- src/pages/_app.mdx
- src/pages/python/[[...rest]].mdx

View File

@@ -1,26 +1,31 @@
FROM golang:1.21-alpine as builder
# Get NPM packages
FROM node:14-alpine AS dependencies
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --only=production
# Rebuild the source code only when needed
FROM node:14-alpine AS builder
WORKDIR /app
COPY . .
COPY --from=dependencies /app/node_modules ./node_modules
RUN npm run build
# Production image, copy all the files and run next
FROM node:14-alpine AS runner
WORKDIR /app
RUN go mod init server
ENV NODE_ENV production
# Copy the server.go file.
COPY server.go ./
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
# Copy the 'out' directory
COPY out/ ./out/
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
RUN go build -o /server
USER nextjs
EXPOSE 3000
FROM gcr.io/distroless/base
WORKDIR /
COPY --from=builder /server /server
COPY --from=builder /app/out/ /out/
ENV PORT=8080
EXPOSE 8080
ENTRYPOINT ["/server"]
CMD ["npm", "start"]

View File

@@ -5,3 +5,9 @@
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.136.1 (2.231.0) https://github.com/speakeasy-api/speakeasy
## 2024-01-12 14:59:14
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.136.3 (2.231.0) https://github.com/speakeasy-api/speakeasy

View File

@@ -7,7 +7,7 @@ generation:
fixes:
nameResolutionDec2023: false
docs:
version: ""
version: 0.0.1
defaultLanguage: go
imports:
option: openapi

View File

@@ -20,14 +20,37 @@ module.exports = withPlugins([], {
sassOptions: {
importer: jsonImporter(),
},
...withNextra({
output: 'export',
distDir: 'out',
images: {
unoptimized: true,
},
}),
...withNextra(),
eslint: {
ignoreDuringBuilds: true,
},
async redirects() {
return [
{
source: '/',
destination: '/go/client_sdks/',
permanent: true,
},
{
source: '/python',
destination: '/python/client_sdks/',
permanent: true,
},
{
source: '/typescript',
destination: '/typescript/client_sdks/',
permanent: true,
},
{
source: '/go',
destination: '/go/client_sdks/',
permanent: true,
},
{
source: '/curl',
destination: '/curl/client_sdks/',
permanent: true,
},
]
},
});

View File

@@ -1,6 +1,6 @@
{
"name": "sdk-docs",
"version": "",
"version": "0.0.1",
"description": "Nextra docs template",
"private": true,
"scripts": {

View File

@@ -1,73 +0,0 @@
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
)
func handler(fs http.Handler, language string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
baseRoute := fmt.Sprintf("/%s/", language)
if !strings.HasPrefix(r.URL.Path, baseRoute) {
http.NotFound(w, r)
return
}
r.URL.Path = baseRoute + "[[...rest]].html"
fs.ServeHTTP(w, r)
}
}
func rootHandler(fs http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// There is nothing at /, so redirect to the client SDKs page for the default language
// We need to check for this explicitly because mux matches / to every route
if r.URL.Path == "/" {
http.RedirectHandler("/go/client_sdks", http.StatusSeeOther).ServeHTTP(w, r)
return
}
// Files from public end up in the root of the build directory
if isPublicFile(r.URL.Path) {
fs.ServeHTTP(w, r)
return
}
http.NotFound(w, r)
}
}
func isPublicFile(path string) bool {
return strings.Count(path, "/") == 1 && strings.Count(path, ".") == 1
}
func main() {
fs := http.FileServer(http.Dir("./out"))
// Serve static files generated by Next
http.Handle("/_next/", fs)
languages := []string{"python", "typescript", "go", "curl"}
for _, language := range languages {
route := fmt.Sprintf("/%s/", language)
http.Handle(route, handler(fs, language))
}
// Mux will match / to every other route, so we need to handle it carefully
http.Handle("/", rootHandler(fs))
listeningPort := os.Getenv("PORT")
if listeningPort == "" {
// Default locally to port 3000
listeningPort = "3000"
}
log.Print(fmt.Sprintf("Listening on :%s...", listeningPort))
err := http.ListenAndServe(fmt.Sprintf(":%s", listeningPort), nil)
if err != nil {
log.Fatal(err)
}
}

View File

@@ -1,6 +1,5 @@
import { useLayoutEffect } from 'react';
import { useRouter } from 'next/router';
import { Languages, DefaultLanguage } from '@/content/languages';
type Redirect = {
from: string;
@@ -11,16 +10,7 @@ export const CustomRedirects = () => {
const router = useRouter();
// Static redirects + custom redirects defined in theme.yaml
const redirects: Redirect[] = [
{
from: '/',
to: `/${DefaultLanguage}/client_sdks/`,
},
...Languages.map((lang) => ({
from: `/${lang}`,
to: `/${lang}/client_sdks/`,
})),
];
const redirects: Redirect[] = [];
useLayoutEffect(() => {
const currentPath = window.location.pathname;