Skip to content

Commit

Permalink
chore: Remove outdated local CLI documentation (#1272)
Browse files Browse the repository at this point in the history
Reference:
https://linear.app/speakeasy/issue/GEN-1020/bug-generating-broken-links-in-the-cli-reference
Reference:
https://www.speakeasy.com/docs/speakeasy-reference/cli/getting-started

This change removes the outdated local CLI documentation in the `docs/`
directory and updates the documentation generation script to remove that
now extraneous logic. This also removes the unused Docusaurus
positioning. The CLI documentation will remain and still be updated on
the Speakeasy website.
  • Loading branch information
bflad authored Feb 19, 2025
1 parent 9f501ae commit d20794e
Show file tree
Hide file tree
Showing 52 changed files with 61 additions and 1,907 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ jobs:
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: "speakeasy/go.mod"
- name: Generate speakeasy cli docs
working-directory: speakeasy
run: |
go run cmd/docs/main.go
- name: Generate speakeasy-registry doc-site docs
working-directory: speakeasy
run: |
go run cmd/docs/main.go -out-dir ../speakeasy-registry/web/packages/marketing-site/src/pages/docs/speakeasy-reference/cli -doc-site
go run cmd/docs/main.go -out-dir ../speakeasy-registry/web/packages/marketing-site/src/pages/docs/speakeasy-reference/cli
- name: Create PR against speakeasy-registry
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
/docs/
bin/
.idea/
*.iml
Expand Down
89 changes: 50 additions & 39 deletions README.md

Large diffs are not rendered by default.

32 changes: 1 addition & 31 deletions cmd/docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package main

import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
"regexp"
"slices"
"strings"

"github.com/speakeasy-api/speakeasy/cmd"
"github.com/speakeasy-api/speakeasy/internal/docs"
Expand All @@ -18,7 +16,6 @@ var linkRegex = regexp.MustCompile(`\((.*?\.md)\)`)

func main() {
outDir := flag.String("out-dir", "./docs", "The directory to output the docs to")
docSite := flag.Bool("doc-site", false, "Whether to generate docs for the doc site")
flag.Parse()

cmd.Init("", "")
Expand All @@ -36,34 +33,7 @@ func main() {
log.Fatal(err)
}

if err := docs.GenerateDocs(root, *outDir, *docSite); err != nil {
log.Fatal(err)
}

if *docSite {
return
}

readmeData, err := os.ReadFile("./README.md")
if err != nil {
log.Fatal(err)
}

readme, _, _ := strings.Cut(string(readmeData), "## CLI")

speakeasyData, err := os.ReadFile("./docs/README.md")
if err != nil {
log.Fatal(err)
}

speakeasyDoc := linkRegex.ReplaceAllStringFunc(string(speakeasyData), func(match string) string {
return fmt.Sprintf("(docs/%s)", strings.Trim(match, "()"))
})

speakeasyDoc = strings.ReplaceAll(speakeasyDoc, "## ", "### ")
speakeasyDoc = strings.Replace(speakeasyDoc, "# speakeasy", "## CLI", 1)

if err := os.WriteFile("./README.md", []byte(fmt.Sprintf("%s%s", readme, speakeasyDoc)), 0o644); err != nil {
if err := docs.GenerateDocs(root, *outDir); err != nil {
log.Fatal(err)
}
}
Expand Down
59 changes: 0 additions & 59 deletions docs/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions docs/ask.md

This file was deleted.

36 changes: 0 additions & 36 deletions docs/auth/README.md

This file was deleted.

31 changes: 0 additions & 31 deletions docs/auth/login.md

This file was deleted.

31 changes: 0 additions & 31 deletions docs/auth/logout.md

This file was deleted.

31 changes: 0 additions & 31 deletions docs/auth/switch.md

This file was deleted.

53 changes: 0 additions & 53 deletions docs/bump.md

This file was deleted.

33 changes: 0 additions & 33 deletions docs/clean.md

This file was deleted.

Loading

0 comments on commit d20794e

Please sign in to comment.