From 4d72952a565d5f133b3aa069062e244bc4dbaeab Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Tue, 8 Jun 2021 16:20:21 -0500 Subject: [PATCH] Don't generate separate completion/functions doc files --- .github/workflows/ci.yml | 2 +- cmd/docgen/docs/base_test.go | 18 ++++++++++-------- cmd/docgen/docs/editor_support.go | 22 ---------------------- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8b6efff7..c01a4349a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: if: success() uses: codecov/codecov-action@v1 with: - fail_ci_if_error: true + fail_ci_if_error: false release: name: Release diff --git a/cmd/docgen/docs/base_test.go b/cmd/docgen/docs/base_test.go index 88bcd60f1..fe3c6385f 100644 --- a/cmd/docgen/docs/base_test.go +++ b/cmd/docgen/docs/base_test.go @@ -37,18 +37,20 @@ func TestGenerateDocs(t *testing.T) { require.NoError(t, err) // check other outputs - completion := readJSONOutput(t, outputDir, "en-us", "completion.json").(map[string]interface{}) - assert.Contains(t, completion, "types") - assert.Contains(t, completion, "root") + completion := readJSONOutput(t, outputDir, "en-us", "editor.json").(map[string]interface{}) + assert.Contains(t, completion, "functions") + assert.Contains(t, completion, "context") - types := completion["types"].([]interface{}) + context := completion["context"].(map[string]interface{}) + functions := completion["functions"].([]interface{}) + + assert.Equal(t, 80, len(functions)) + + types := context["types"].([]interface{}) assert.Equal(t, 16, len(types)) - root := completion["root"].([]interface{}) + root := context["root"].([]interface{}) assert.Equal(t, 14, len(root)) - - functions := readJSONOutput(t, outputDir, "en-us", "functions.json").([]interface{}) - assert.Equal(t, 80, len(functions)) } func readJSONOutput(t *testing.T, file ...string) interface{} { diff --git a/cmd/docgen/docs/editor_support.go b/cmd/docgen/docs/editor_support.go index 31083747d..ff66b067e 100644 --- a/cmd/docgen/docs/editor_support.go +++ b/cmd/docgen/docs/editor_support.go @@ -62,28 +62,6 @@ func (g *editorSupportGenerator) Generate(baseDir, outputDir string, items map[s } fmt.Printf(" > editor support file written to %s\n", outputPath) - // for backwards compatibility, write as two separate files as well - mapPath := path.Join(outputDir, "completion.json") - listingPath := path.Join(outputDir, "functions.json") - - marshaled, err = jsonx.MarshalPretty(es.Context) - if err != nil { - return err - } - if err := ioutil.WriteFile(mapPath, marshaled, 0755); err != nil { - return err - } - fmt.Printf(" > %d completion map written to %s\n", len(items["context"]), mapPath) - - marshaled, err = jsonx.MarshalPretty(es.Functions) - if err != nil { - return err - } - if err := ioutil.WriteFile(listingPath, marshaled, 0755); err != nil { - return err - } - fmt.Printf(" > %d functions written to %s\n", len(es.Functions), listingPath) - // also output list of context paths.. not used by the editor but useful for checking if err := createContextPathListFile(outputDir, es.Context); err != nil { return err