From 4e8c2170f0142954a5cfec928424364e2cf7eec4 Mon Sep 17 00:00:00 2001 From: Jeroen Knoops Date: Tue, 23 Feb 2021 16:01:34 +0100 Subject: [PATCH 1/2] bugfix: Use action-docs- keyword --- .github/workflows/ci.yml | 2 +- README.md | 18 +++++++++--------- __tests__/fixtures/all_fields_readme copy 2.md | 12 ++++++------ __tests__/fixtures/all_fields_readme.input | 8 ++++---- __tests__/fixtures/all_fields_readme.output | 16 ++++++++-------- .../fixtures/all_fields_readme_filled.input | 16 ++++++++-------- .../fixtures/all_fields_readme_filled.output | 16 ++++++++-------- src/{terraform-docs.ts => action-docs.ts} | 4 ++-- src/cli.ts | 4 ---- src/index.ts | 2 +- 10 files changed, 47 insertions(+), 51 deletions(-) rename src/{terraform-docs.ts => action-docs.ts} (95%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcdd97d1..16d199ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,4 +41,4 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc - find lib \ No newline at end of file + find lib diff --git a/README.md b/README.md index d1d4fdb3..c694f1ba 100644 --- a/README.md +++ b/README.md @@ -14,20 +14,20 @@ cd action-docs # update reamde -action-ducs --update-readme +action-docs --update-readme ``` Update your README.md ``` ## Add the following comment blocks to your README.md - + - + - + - + ## Run the cli action-docs -u @@ -56,13 +56,13 @@ Options: Action-docs can update your README based on the `action.yml`. The following sections can be updated: description, inputs, outputs and runs. Add the following tags to your README and run `actiond-docs -u`. ``` - + - + - + - + ``` For updating other Markdown files add the name of the file to the command `action-docs -u `. diff --git a/__tests__/fixtures/all_fields_readme copy 2.md b/__tests__/fixtures/all_fields_readme copy 2.md index 27dfcc48..95bb3bbe 100644 --- a/__tests__/fixtures/all_fields_readme copy 2.md +++ b/__tests__/fixtures/all_fields_readme copy 2.md @@ -1,12 +1,12 @@ - + ## Description Default test - + - + ## Inputs | parameter | description | required | default | @@ -18,9 +18,9 @@ Default test - + - + ## Outputs | parameter | description | @@ -30,4 +30,4 @@ Default test - + diff --git a/__tests__/fixtures/all_fields_readme.input b/__tests__/fixtures/all_fields_readme.input index b28187c6..d805e25a 100644 --- a/__tests__/fixtures/all_fields_readme.input +++ b/__tests__/fixtures/all_fields_readme.input @@ -1,7 +1,7 @@ - + - + - + - + diff --git a/__tests__/fixtures/all_fields_readme.output b/__tests__/fixtures/all_fields_readme.output index 48f5f20a..ef6b92d9 100644 --- a/__tests__/fixtures/all_fields_readme.output +++ b/__tests__/fixtures/all_fields_readme.output @@ -1,12 +1,12 @@ - + ## Description Default test - + - + ## Inputs | parameter | description | required | default | @@ -18,9 +18,9 @@ Default test - + - + ## Outputs | parameter | description | @@ -30,12 +30,12 @@ Default test - + - + ## Runs This action is an `node12` action. - + diff --git a/__tests__/fixtures/all_fields_readme_filled.input b/__tests__/fixtures/all_fields_readme_filled.input index 099bcaf1..830fdb61 100644 --- a/__tests__/fixtures/all_fields_readme_filled.input +++ b/__tests__/fixtures/all_fields_readme_filled.input @@ -1,12 +1,12 @@ - + ## Description Default test abc - + - + ## Inputs | parameter | description | required | default | @@ -17,9 +17,9 @@ Default test abc - + - + ## Outputs | parameter | description | @@ -28,12 +28,12 @@ Default test abc - + - + ## Run This action is an `docker` action. - + diff --git a/__tests__/fixtures/all_fields_readme_filled.output b/__tests__/fixtures/all_fields_readme_filled.output index 48f5f20a..ef6b92d9 100644 --- a/__tests__/fixtures/all_fields_readme_filled.output +++ b/__tests__/fixtures/all_fields_readme_filled.output @@ -1,12 +1,12 @@ - + ## Description Default test - + - + ## Inputs | parameter | description | required | default | @@ -18,9 +18,9 @@ Default test - + - + ## Outputs | parameter | description | @@ -30,12 +30,12 @@ Default test - + - + ## Runs This action is an `node12` action. - + diff --git a/src/terraform-docs.ts b/src/action-docs.ts similarity index 95% rename from src/terraform-docs.ts rename to src/action-docs.ts index 8624074a..96829123 100644 --- a/src/terraform-docs.ts +++ b/src/action-docs.ts @@ -83,13 +83,13 @@ async function updateReadme( section: string ): Promise { const to = new RegExp( - `(?:(?:\n.*)+)?` + `(?:(?:\n.*)+)?` ); await replaceInFile.replaceInFile({ files: file, from: to, - to: `\n${text}\n`, + to: `\n${text}\n`, }); } diff --git a/src/cli.ts b/src/cli.ts index fee33b68..2d7f5eae 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -53,7 +53,3 @@ generateActionMarkdownDocs({ .catch((e) => console.error(e.message)); /* eslint-enable */ -// if (args["update-readme"]) { -// console.log("--------ddd-"); -// } -// console.log(args); diff --git a/src/index.ts b/src/index.ts index c665e248..6078b5f6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,4 +2,4 @@ export { generateActionMarkdownDocs, Options, defaultOptions, -} from "./terraform-docs"; +} from "./action-docs"; From 13c7ba1d9ba0d76b75ae38d49dd5bf4c058fd6cf Mon Sep 17 00:00:00 2001 From: Jeroen Knoops Date: Tue, 23 Feb 2021 19:35:37 +0100 Subject: [PATCH 2/2] chore: prettier --- src/cli.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 2d7f5eae..f842915c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -52,4 +52,3 @@ generateActionMarkdownDocs({ }) .catch((e) => console.error(e.message)); /* eslint-enable */ -