From 9ee808e346ba8b88e260443dcb1121064276039b Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Tue, 6 Sep 2022 17:24:15 -0500 Subject: [PATCH] feat(GHA): workflow file creation onboarding (#577) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: make command type more specific * refactor: consolidate `key` opt definition * fix: stricter type definition * chore: small copy change * refactor: small function change doing this so we can preserve the `this` scope * fix: lint * feat: first pass at GHA generation * feat: add `--github` flag * fix: allow user to not pass in spec path * chore: small copy change * fix: cleaning up a type, adding a smol doc * test: add coverage for if user says no * refactor: new function signature, better typings * test: smol refactor * test: remove unused mock * fix: better type * fix: remove unused async * refactor: remove github API fetch after thinking about it some more, this doesn't feel necessary since we can just grab it from the current package. it also might cause issues if we create a broken workflow file due to breaking changes. instead we should add a dependabot config. * refactor: better command string construction i like this way just in case the opts string is empty (which is unlikely but w/e) * chore: some base file copy updates * refactor: make isGitHub file more generic * refactor: consolidate CI checks into shared function * feat: prevent user from running --github in CI env * feat: first pass at git detection * test: add some test cases not sure why these are failing :thinking: * chore: skip failing tests to see if CI passes * fix: move regex to inside function Tests were failing because we had defined our regex expressions globally * test:: smol refactor * test: refactor to describe.each() this will be a lot faster when writing tests for other suites * test: add test for git check failure * feat: add openapi command extension also some basic tests * fix: shorten github search * test: oops * test: add workflow file schema validation * test: reorganizing test bed a bit * chore: better test coverage, smol nits * fix: better filename input validation also adding some small nits and a few more tests * chore: clean up unused interfaces i really don't understand what's going on here lol * fix(openapi): add `update` param to ignored params * fix: use `.yml` instead of `.yaml` Maybe I'm overthinking this, but I feel like GitHub likes `.yml` more than `.yaml`... my evidence: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file https://docs.github.com/en/actions/using-workflows/about-workflows#create-an-example-workflow In all of these examples, GitHub uses `.yml` either first or exclusively :monocle: * test: more CI tests * refactor: move helper function to separate file * chore: different language updating tests and snapshots * test: stronger test * chore: smol refactor * test(validate): e2e tests * chore: rename function * fix: use JS string instead of YAML file wrote about why we're doing this in the comments, but yay for snapshot testing because this yields the exact same results! * fix: handle directory creation * chore: smol link comment * feat: configstore to ensure we don't ask user too many times * test: fix tests * chore: command comment * chore(openapi): update args * chore: clean up some comments * refactor: stricter types also slightly updating file name question per feedback from @RyanGWU82 * feat: support for docs/index * feat: add GHA functionality for docs-adjacent cmds * fix: clean up command name prior to using as YAML keys g*d bless tests y'all * test: add tests for docs-adjacent cmds * test: consolidate certain test mocks * fix(openapi): parameter logic fixes this also includes E2E tests that ended up exposing some cracks in the `ignoredGHAParameters` logic I had originally written. * fix: lint * fix: console.log that i forgot to commit lol * test: smol refactor * feat: do major version check for configstore * fix: separate out package version retrieval into function this way we can mock out our package version easily and we don't need to update our snapshots every time we bump our package version :grimacing: * chore: error message language * docs: github **actions** workflow, not github action (singular) * docs: better intro language * docs: better success language * chore: fix snapshot, de-localize docs link * chore: smol language update per Spang * test: don't fetch schema from URL https://github.com/readmeio/rdme/pull/577#discussion_r961376601 * test: update broken test * test(GHA): extract setup/teardowns into common lib Feedback: https://github.com/readmeio/rdme/pull/577#discussion_r961377510 * test: better describe.each signature Feedback: https://github.com/readmeio/rdme/pull/577#discussion_r961387961 Co-Authored-By: Jon Ursenbach * chore: debug statements * fix: weird flaky TS error * refactor: use decorator unfortunately this isn't exactly where we want it to be—we still have to manually add the `--github` arg to the command definitions. also adding some tests for this new functionality. feedback: https://github.com/readmeio/rdme/pull/577#discussion_r961393768 Co-Authored-By: Jon Ursenbach * chore(mock/fs): clearer var names also removed the unnecessary boolean return value since it's a void function Co-authored-by: Jon Ursenbach --- .github/workflows/retag-release.yaml | 2 +- __tests__/__snapshots__/index.test.ts.snap | 9 +- .../cmds/__snapshots__/validate.test.ts.snap | 148 ++ .../docs/__snapshots__/index.test.ts.snap | 124 ++ __tests__/cmds/docs/index.test.ts | 197 ++ .../openapi/__snapshots__/index.test.ts.snap | 287 +++ __tests__/cmds/openapi/index.test.ts | 339 ++++ __tests__/cmds/openapi/reduce.test.ts | 17 +- __tests__/cmds/validate.test.ts | 102 + __tests__/helpers/get-gha-setup.ts | 47 + __tests__/helpers/get-git-mock.ts | 40 + __tests__/helpers/github-workflow-schema.json | 1645 +++++++++++++++++ __tests__/helpers/jest.matchers.ts | 54 + __tests__/index.test.ts | 50 + .../lib/__snapshots__/createGHA.test.ts.snap | 649 +++++++ __tests__/lib/createGHA.test.ts | 261 +++ documentation/legacy-github-action.md | 2 +- documentation/rdme.md | 4 +- package-lock.json | 1541 +++++++++++---- package.json | 5 + src/.sink.d.ts | 1 + src/cli.ts | 2 +- src/cmds/categories/create.ts | 6 +- src/cmds/categories/index.ts | 9 +- src/cmds/changelogs/index.ts | 11 +- src/cmds/changelogs/single.ts | 11 +- src/cmds/custompages/index.ts | 11 +- src/cmds/custompages/single.ts | 11 +- src/cmds/docs/edit.ts | 6 +- src/cmds/docs/index.ts | 12 +- src/cmds/docs/single.ts | 12 +- src/cmds/openapi/index.ts | 46 +- src/cmds/validate.ts | 6 +- src/cmds/versions/create.ts | 6 +- src/cmds/versions/delete.ts | 6 +- src/cmds/versions/index.ts | 6 +- src/cmds/versions/update.ts | 6 +- src/index.ts | 14 +- src/lib/baseCommand.ts | 48 +- src/lib/createGHA/baseFile.ts | 36 + src/lib/createGHA/index.ts | 362 ++++ src/lib/decorators/supportsGHA.ts | 13 + src/lib/fetch.ts | 2 +- src/lib/isCI.ts | 21 + src/lib/isGitHub.ts | 10 - src/lib/logger.ts | 2 +- src/lib/prepareOas.ts | 7 +- src/lib/versionSelect.ts | 4 +- tsconfig.json | 3 +- 49 files changed, 5699 insertions(+), 514 deletions(-) create mode 100644 __tests__/cmds/docs/__snapshots__/index.test.ts.snap create mode 100644 __tests__/helpers/get-gha-setup.ts create mode 100644 __tests__/helpers/get-git-mock.ts create mode 100644 __tests__/helpers/github-workflow-schema.json create mode 100644 __tests__/helpers/jest.matchers.ts create mode 100644 __tests__/lib/__snapshots__/createGHA.test.ts.snap create mode 100644 __tests__/lib/createGHA.test.ts create mode 100644 src/lib/createGHA/baseFile.ts create mode 100644 src/lib/createGHA/index.ts create mode 100644 src/lib/decorators/supportsGHA.ts create mode 100644 src/lib/isCI.ts delete mode 100644 src/lib/isGitHub.ts diff --git a/.github/workflows/retag-release.yaml b/.github/workflows/retag-release.yaml index 5f4d26c69..1afbdf4d2 100644 --- a/.github/workflows/retag-release.yaml +++ b/.github/workflows/retag-release.yaml @@ -1,7 +1,7 @@ # This script adds a "vX.Y.Z" tag to every new release. # # Our releases are tagged like "1.2.3" but we want people to be able to write -# GitHub Action workflows to say "uses: readmeio/readme@v1.2.3" because that's +# GitHub Actions workflows to say "uses: readmeio/readme@v1.2.3" because that's # the usual GitHub convention. name: retag-release diff --git a/__tests__/__snapshots__/index.test.ts.snap b/__tests__/__snapshots__/index.test.ts.snap index 4ee64a210..63443fb5e 100644 --- a/__tests__/__snapshots__/index.test.ts.snap +++ b/__tests__/__snapshots__/index.test.ts.snap @@ -15,10 +15,11 @@ Options uploading an existing API definition. --version string Project version. If running command in a CI environment and this option is not passed, the main project version will be used. - --create Bypasses the create/update prompt and creates a new API definition. --useSpecVersion Uses the version listed in the \`info.version\` field in the API definition for the project version parameter. + --github Create a new GitHub Actions workflow for this command. --workingDirectory string Working directory (for usage with relative external references) + --create Bypasses the create/update prompt and creates a new API definition. --update Automatically update an existing API definition in ReadMe if it's the only one associated with the current version. -h, --help Display this usage guide @@ -45,10 +46,11 @@ Options uploading an existing API definition. --version string Project version. If running command in a CI environment and this option is not passed, the main project version will be used. - --create Bypasses the create/update prompt and creates a new API definition. --useSpecVersion Uses the version listed in the \`info.version\` field in the API definition for the project version parameter. + --github Create a new GitHub Actions workflow for this command. --workingDirectory string Working directory (for usage with relative external references) + --create Bypasses the create/update prompt and creates a new API definition. --update Automatically update an existing API definition in ReadMe if it's the only one associated with the current version. -h, --help Display this usage guide @@ -75,10 +77,11 @@ Options uploading an existing API definition. --version string Project version. If running command in a CI environment and this option is not passed, the main project version will be used. - --create Bypasses the create/update prompt and creates a new API definition. --useSpecVersion Uses the version listed in the \`info.version\` field in the API definition for the project version parameter. + --github Create a new GitHub Actions workflow for this command. --workingDirectory string Working directory (for usage with relative external references) + --create Bypasses the create/update prompt and creates a new API definition. --update Automatically update an existing API definition in ReadMe if it's the only one associated with the current version. -h, --help Display this usage guide diff --git a/__tests__/cmds/__snapshots__/validate.test.ts.snap b/__tests__/cmds/__snapshots__/validate.test.ts.snap index 838bbeabc..5baa9f32d 100644 --- a/__tests__/cmds/__snapshots__/validate.test.ts.snap +++ b/__tests__/cmds/__snapshots__/validate.test.ts.snap @@ -1,5 +1,153 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`rdme validate GHA onboarding E2E tests should create GHA workflow if user passes in spec via opt (github flag enabled) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Push your newly created file (.github/workflows/validate-test-opt-spec-github-file.yml) to GitHub and you're all set 🚀 + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme validate GHA onboarding E2E tests should create GHA workflow if user passes in spec via opt (github flag enabled) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`validate-test-opt-spec-github-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - validate-test-opt-spec-github-branch + +jobs: + rdme-validate: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`validate\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: validate __tests__/__fixtures__/petstore-simple-weird-version.json +" +`; + +exports[`rdme validate GHA onboarding E2E tests should create GHA workflow if user passes in spec via opt (including workingDirectory) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Push your newly created file (.github/workflows/validate-test-opt-spec-workdir-file.yml) to GitHub and you're all set 🚀 + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme validate GHA onboarding E2E tests should create GHA workflow if user passes in spec via opt (including workingDirectory) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`validate-test-opt-spec-github-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - validate-test-opt-spec-github-branch + +jobs: + rdme-validate: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`validate\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: validate petstore.json --workingDirectory=./__tests__/__fixtures__/relative-ref-oas +" +`; + +exports[`rdme validate GHA onboarding E2E tests should create GHA workflow if user passes in spec via opt 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Push your newly created file (.github/workflows/validate-test-opt-spec-file.yml) to GitHub and you're all set 🚀 + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme validate GHA onboarding E2E tests should create GHA workflow if user passes in spec via opt 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`validate-test-opt-spec-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - validate-test-opt-spec-branch + +jobs: + rdme-validate: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`validate\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: validate __tests__/__fixtures__/petstore-simple-weird-version.json +" +`; + +exports[`rdme validate GHA onboarding E2E tests should create GHA workflow if user passes in spec via prompts 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Push your newly created file (.github/workflows/validate-test-file.yml) to GitHub and you're all set 🚀 + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme validate GHA onboarding E2E tests should create GHA workflow if user passes in spec via prompts 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`validate-test-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - validate-test-branch + +jobs: + rdme-validate: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`validate\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: validate __tests__/__fixtures__/petstore-simple-weird-version.json +" +`; + exports[`rdme validate error handling should throw an error if an invalid OpenAPI 3.1 definition is supplied 1`] = ` [SyntaxError: OpenAPI schema validation failed. diff --git a/__tests__/cmds/docs/__snapshots__/index.test.ts.snap b/__tests__/cmds/docs/__snapshots__/index.test.ts.snap new file mode 100644 index 000000000..446aa3cda --- /dev/null +++ b/__tests__/cmds/docs/__snapshots__/index.test.ts.snap @@ -0,0 +1,124 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`rdme docs GHA onboarding E2E tests should create GHA workflow with version passed as opt (github flag enabled) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/docs-test-file-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme docs GHA onboarding E2E tests should create GHA workflow with version passed as opt (github flag enabled) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`docs-test-branch-github-flag\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - docs-test-branch-github-flag + +jobs: + rdme-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`docs\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: docs ./__tests__/__fixtures__/docs/new-docs --key=\${{ secrets.README_API_KEY }} --version=1.0.0 +" +`; + +exports[`rdme docs GHA onboarding E2E tests should create GHA workflow with version passed in via opt 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/docs-test-file.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme docs GHA onboarding E2E tests should create GHA workflow with version passed in via opt 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`docs-test-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - docs-test-branch + +jobs: + rdme-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`docs\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: docs ./__tests__/__fixtures__/docs/new-docs --key=\${{ secrets.README_API_KEY }} --version=1.0.0 +" +`; + +exports[`rdme docs GHA onboarding E2E tests should create GHA workflow with version passed in via prompt 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/docs-test-file.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme docs GHA onboarding E2E tests should create GHA workflow with version passed in via prompt 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`docs-test-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - docs-test-branch + +jobs: + rdme-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`docs\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: docs ./__tests__/__fixtures__/docs/new-docs --key=\${{ secrets.README_API_KEY }} --version=1.0.1 +" +`; diff --git a/__tests__/cmds/docs/index.test.ts b/__tests__/cmds/docs/index.test.ts index 6c250539a..b2ed13fde 100644 --- a/__tests__/cmds/docs/index.test.ts +++ b/__tests__/cmds/docs/index.test.ts @@ -1,13 +1,16 @@ +/* eslint-disable no-console */ import fs from 'fs'; import path from 'path'; import chalk from 'chalk'; import frontMatter from 'gray-matter'; import nock from 'nock'; +import prompts from 'prompts'; import DocsCommand from '../../../src/cmds/docs'; import APIError from '../../../src/lib/apiError'; import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock'; +import { after, before } from '../../helpers/get-gha-setup'; import hashFileContents from '../../helpers/hash-file-contents'; const docs = new DocsCommand(); @@ -20,6 +23,8 @@ const version = '1.0.0'; const category = 'CATEGORY_ID'; const apiSetting = 'API_SETTING_ID'; +const testWorkingDir = process.cwd(); + describe('rdme docs', () => { beforeAll(() => nock.disableNetConnect()); @@ -411,4 +416,196 @@ describe('rdme docs', () => { versionMock.done(); }); }); + + describe('GHA onboarding E2E tests', () => { + let consoleInfoSpy; + let yamlOutput; + + const getCommandOutput = () => { + return [consoleInfoSpy.mock.calls.join('\n\n')].filter(Boolean).join('\n\n'); + }; + + beforeEach(() => { + consoleInfoSpy = jest.spyOn(console, 'info').mockImplementation(); + + before((fileName, data) => { + yamlOutput = data; + }); + }); + + afterEach(() => { + after(); + + consoleInfoSpy.mockRestore(); + process.chdir(testWorkingDir); + }); + + it('should create GHA workflow with version passed in via prompt', async () => { + expect.assertions(6); + + const altVersion = '1.0.1'; + const slug = 'new-doc'; + const id = '1234'; + const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); + const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); + + const versionsMock = getAPIMock() + .get('/api/v1/version') + .basicAuth({ user: key }) + .reply(200, [{ version: altVersion }]); + + const getMock = getAPIMockWithVersionHeader(altVersion) + .get(`/api/v1/docs/${slug}`) + .basicAuth({ user: key }) + .reply(404, { + error: 'DOC_NOTFOUND', + message: `The doc with the slug '${slug}' couldn't be found`, + suggestion: '...a suggestion to resolve the issue...', + help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', + }); + + const postMock = getAPIMockWithVersionHeader(altVersion) + .post('/api/v1/docs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) + .basicAuth({ user: key }) + .reply(201, { id, slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }); + + const fileName = 'docs-test-file'; + prompts.inject([altVersion, true, 'docs-test-branch', fileName]); + + await expect(docs.run({ folder: `./__tests__/${fixturesBaseDir}/new-docs`, key })).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${fileName}.yml`, expect.any(String)); + expect(console.info).toHaveBeenCalledTimes(2); + const output = getCommandOutput(); + expect(output).toMatch("Looks like you're running this command in a GitHub Repository!"); + expect(output).toMatch(`successfully created '${slug}' (ID: ${id}) with contents from`); + + versionsMock.done(); + getMock.done(); + postMock.done(); + }); + + it('should create GHA workflow with version passed in via opt', async () => { + expect.assertions(3); + + const slug = 'new-doc'; + const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); + const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); + + const getMock = getAPIMockWithVersionHeader(version) + .get(`/api/v1/docs/${slug}`) + .basicAuth({ user: key }) + .reply(404, { + error: 'DOC_NOTFOUND', + message: `The doc with the slug '${slug}' couldn't be found`, + suggestion: '...a suggestion to resolve the issue...', + help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', + }); + + const postMock = getAPIMockWithVersionHeader(version) + .post('/api/v1/docs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) + .basicAuth({ user: key }) + .reply(201, { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }); + + const versionMock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version }); + + const fileName = 'docs-test-file'; + prompts.inject([true, 'docs-test-branch', fileName]); + + await expect( + docs.run({ folder: `./__tests__/${fixturesBaseDir}/new-docs`, key, version }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${fileName}.yml`, expect.any(String)); + + getMock.done(); + postMock.done(); + versionMock.done(); + }); + + it('should create GHA workflow with version passed as opt (github flag enabled)', async () => { + expect.assertions(3); + + const slug = 'new-doc'; + const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); + const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); + + const getMock = getAPIMockWithVersionHeader(version) + .get(`/api/v1/docs/${slug}`) + .basicAuth({ user: key }) + .reply(404, { + error: 'DOC_NOTFOUND', + message: `The doc with the slug '${slug}' couldn't be found`, + suggestion: '...a suggestion to resolve the issue...', + help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', + }); + + const postMock = getAPIMockWithVersionHeader(version) + .post('/api/v1/docs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) + .basicAuth({ user: key }) + .reply(201, { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }); + + const versionMock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version }); + + const fileName = 'docs-test-file-github-flag'; + prompts.inject(['docs-test-branch-github-flag', fileName]); + + await expect( + docs.run({ folder: `./__tests__/${fixturesBaseDir}/new-docs`, github: true, key, version }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${fileName}.yml`, expect.any(String)); + + getMock.done(); + postMock.done(); + versionMock.done(); + }); + + it('should reject if user says no to creating GHA workflow', async () => { + const slug = 'new-doc'; + const doc = frontMatter(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); + const hash = hashFileContents(fs.readFileSync(path.join(fullFixturesDir, `/new-docs/${slug}.md`))); + + const getMock = getAPIMockWithVersionHeader(version) + .get(`/api/v1/docs/${slug}`) + .basicAuth({ user: key }) + .reply(404, { + error: 'DOC_NOTFOUND', + message: `The doc with the slug '${slug}' couldn't be found`, + suggestion: '...a suggestion to resolve the issue...', + help: 'If you need help, email support@readme.io and mention log "fake-metrics-uuid".', + }); + + const postMock = getAPIMockWithVersionHeader(version) + .post('/api/v1/docs', { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }) + .basicAuth({ user: key }) + .reply(201, { slug, body: doc.content, ...doc.data, lastUpdatedHash: hash }); + + const versionMock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version }); + + prompts.inject([false]); + + await expect(docs.run({ folder: `./__tests__/${fixturesBaseDir}/new-docs`, key, version })).rejects.toStrictEqual( + new Error( + 'GitHub Actions workflow creation cancelled. If you ever change your mind, you can run this command again with the `--github` flag.' + ) + ); + + getMock.done(); + postMock.done(); + versionMock.done(); + }); + }); }); diff --git a/__tests__/cmds/openapi/__snapshots__/index.test.ts.snap b/__tests__/cmds/openapi/__snapshots__/index.test.ts.snap index d3c52f14b..3270ca530 100644 --- a/__tests__/cmds/openapi/__snapshots__/index.test.ts.snap +++ b/__tests__/cmds/openapi/__snapshots__/index.test.ts.snap @@ -1,5 +1,292 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (--create flag enabled with ignored id opt) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/openapi-file-create-flag-id-opt.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (--create flag enabled with ignored id opt) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`openapi-branch-create-flag-id-opt\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - openapi-branch-create-flag-id-opt + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi ./__tests__/__fixtures__/ref-oas/petstore.json --key=\${{ secrets.README_API_KEY }} --version=1.0.0 --create +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (--create flag enabled) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/openapi-file-create-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (--create flag enabled) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`openapi-branch-create-flag\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - openapi-branch-create-flag + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi ./__tests__/__fixtures__/ref-oas/petstore.json --key=\${{ secrets.README_API_KEY }} --version=1.0.1 --create +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (--github flag enabled) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/openapi-file-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (--github flag enabled) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`openapi-branch-github-flag\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - openapi-branch-github-flag + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi ./__tests__/__fixtures__/ref-oas/petstore.json --key=\${{ secrets.README_API_KEY }} --id=1 +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (--update flag enabled) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/openapi-file-update-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (--update flag enabled) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`openapi-branch-update-flag\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - openapi-branch-update-flag + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi ./__tests__/__fixtures__/ref-oas/petstore.json --key=\${{ secrets.README_API_KEY }} --id=1 +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (create spec) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/openapi-file.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (create spec) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`openapi-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - openapi-branch + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi ./__tests__/__fixtures__/ref-oas/petstore.json --key=\${{ secrets.README_API_KEY }} --id=1 +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (including workingDirectory) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/openapi-file-workingdirectory.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (including workingDirectory) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`openapi-branch-workingdirectory\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - openapi-branch-workingdirectory + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi petstore.json --key=\${{ secrets.README_API_KEY }} --id=1 --workingDirectory=./__tests__/__fixtures__/relative-ref-oas +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (update spec via prompt) 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/openapi-file-update-prompt.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`rdme openapi GHA onboarding E2E tests should create GHA workflow (update spec via prompt) 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`openapi-branch-update-prompt\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - openapi-branch-update-prompt + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi ./__tests__/__fixtures__/ref-oas/petstore.json --key=\${{ secrets.README_API_KEY }} --id=spec2 +" +`; + exports[`rdme openapi error handling should throw an error if an invalid OpenAPI 3.1 definition is supplied 1`] = ` [SyntaxError: OpenAPI schema validation failed. diff --git a/__tests__/cmds/openapi/index.test.ts b/__tests__/cmds/openapi/index.test.ts index 6725cfafe..310658ecb 100644 --- a/__tests__/cmds/openapi/index.test.ts +++ b/__tests__/cmds/openapi/index.test.ts @@ -1,4 +1,6 @@ /* eslint-disable no-console */ +import fs from 'fs'; + import chalk from 'chalk'; import config from 'config'; import nock from 'nock'; @@ -8,6 +10,7 @@ import OpenAPICommand from '../../../src/cmds/openapi'; import SwaggerCommand from '../../../src/cmds/swagger'; import APIError from '../../../src/lib/apiError'; import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock'; +import { after, before } from '../../helpers/get-gha-setup'; const openapi = new OpenAPICommand(); const swagger = new SwaggerCommand(); @@ -982,6 +985,342 @@ describe('rdme openapi', () => { return mock.done(); }); }); + + describe('GHA onboarding E2E tests', () => { + let yamlOutput; + + beforeEach(() => { + before((fileName, data) => { + yamlOutput = data; + }); + }); + + afterEach(() => { + after(); + }); + + it('should create GHA workflow (create spec)', async () => { + expect.assertions(6); + const yamlFileName = 'openapi-file'; + prompts.inject(['create', true, 'openapi-branch', yamlFileName]); + const registryUUID = getRandomRegistryId(); + + const mock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version }) + .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) + .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); + + const mockWithHeader = getAPIMockWithVersionHeader(version) + .get('/api/v1/api-specification') + .basicAuth({ user: key }) + .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) + .post('/api/v1/api-specification', { registryUUID }) + .delayConnection(1000) + .basicAuth({ user: key }) + .reply(201, { _id: 1 }, { location: exampleRefLocation }); + + const spec = './__tests__/__fixtures__/ref-oas/petstore.json'; + + await expect( + openapi.run({ + key, + version, + spec, + }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${yamlFileName}.yml`, expect.any(String)); + expect(console.info).toHaveBeenCalledTimes(2); + const output = getCommandOutput(); + expect(output).toMatch("Looks like you're running this command in a GitHub Repository!"); + expect(output).toMatch('successfully uploaded a new OpenAPI file to your ReadMe project'); + + mockWithHeader.done(); + return mock.done(); + }); + + it('should create GHA workflow (--github flag enabled)', async () => { + expect.assertions(6); + const yamlFileName = 'openapi-file-github-flag'; + prompts.inject(['create', 'openapi-branch-github-flag', yamlFileName]); + const registryUUID = getRandomRegistryId(); + + const mock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version }) + .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) + .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); + + const mockWithHeader = getAPIMockWithVersionHeader(version) + .get('/api/v1/api-specification') + .basicAuth({ user: key }) + .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) + .post('/api/v1/api-specification', { registryUUID }) + .delayConnection(1000) + .basicAuth({ user: key }) + .reply(201, { _id: 1 }, { location: exampleRefLocation }); + + const spec = './__tests__/__fixtures__/ref-oas/petstore.json'; + + await expect( + openapi.run({ + key, + version, + spec, + github: true, + }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${yamlFileName}.yml`, expect.any(String)); + expect(console.info).toHaveBeenCalledTimes(2); + const output = getCommandOutput(); + expect(output).toMatch("Let's get you set up with GitHub Actions!"); + expect(output).toMatch('successfully uploaded a new OpenAPI file to your ReadMe project'); + + mockWithHeader.done(); + return mock.done(); + }); + + it('should create GHA workflow (update spec via prompt)', async () => { + expect.assertions(3); + const yamlFileName = 'openapi-file-update-prompt'; + prompts.inject(['update', 'spec2', true, 'openapi-branch-update-prompt', yamlFileName]); + const registryUUID = getRandomRegistryId(); + + const mock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version }) + .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) + .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); + + const mockWithHeader = getAPIMockWithVersionHeader(version) + .get('/api/v1/api-specification') + .basicAuth({ user: key }) + .reply(200, [ + { _id: 'spec1', title: 'spec1_title' }, + { _id: 'spec2', title: 'spec2_title' }, + ]) + .put('/api/v1/api-specification/spec2', { registryUUID }) + .delayConnection(1000) + .basicAuth({ user: key }) + .reply(201, { _id: 'spec2' }, { location: exampleRefLocation }); + + const spec = './__tests__/__fixtures__/ref-oas/petstore.json'; + + await expect( + openapi.run({ + key, + version, + spec, + }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${yamlFileName}.yml`, expect.any(String)); + + mockWithHeader.done(); + return mock.done(); + }); + + it('should create GHA workflow (--create flag enabled)', async () => { + expect.assertions(3); + const yamlFileName = 'openapi-file-create-flag'; + const altVersion = '1.0.1'; + prompts.inject([true, 'openapi-branch-create-flag', yamlFileName]); + const registryUUID = getRandomRegistryId(); + + const mock = getAPIMock() + .get(`/api/v1/version/${altVersion}`) + .basicAuth({ user: key }) + .reply(200, { version: altVersion }) + .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) + .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); + + const mockWithHeader = getAPIMockWithVersionHeader(altVersion) + .post('/api/v1/api-specification', { registryUUID }) + .delayConnection(1000) + .basicAuth({ user: key }) + .reply(201, { _id: 1 }, { location: exampleRefLocation }); + + const spec = './__tests__/__fixtures__/ref-oas/petstore.json'; + + await expect( + openapi.run({ + key, + version: altVersion, + spec, + create: true, + }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${yamlFileName}.yml`, expect.any(String)); + + mockWithHeader.done(); + return mock.done(); + }); + + it('should create GHA workflow (--create flag enabled with ignored id opt)', async () => { + expect.assertions(3); + const yamlFileName = 'openapi-file-create-flag-id-opt'; + prompts.inject(['update', version, true, 'openapi-branch-create-flag-id-opt', yamlFileName]); + const registryUUID = getRandomRegistryId(); + + const mock = getAPIMock() + .get('/api/v1/version') + .basicAuth({ user: key }) + .reply(200, [{ version }]) + .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) + .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); + + const postMock = getAPIMockWithVersionHeader(version) + .post('/api/v1/api-specification', { registryUUID }) + .delayConnection(1000) + .basicAuth({ user: key }) + .reply(201, { _id: 1 }, { location: exampleRefLocation }); + + const spec = './__tests__/__fixtures__/ref-oas/petstore.json'; + + await expect( + openapi.run({ + key, + spec, + id: 'some-id', + create: true, + }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${yamlFileName}.yml`, expect.any(String)); + + postMock.done(); + return mock.done(); + }); + + it('should create GHA workflow (--update flag enabled)', async () => { + expect.assertions(3); + const yamlFileName = 'openapi-file-update-flag'; + prompts.inject([true, 'openapi-branch-update-flag', yamlFileName]); + const registryUUID = getRandomRegistryId(); + + const mock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version }) + .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) + .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); + + const mockWithHeader = getAPIMockWithVersionHeader(version) + .get('/api/v1/api-specification') + .basicAuth({ user: key }) + .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) + .put('/api/v1/api-specification/spec1', { registryUUID }) + .delayConnection(1000) + .basicAuth({ user: key }) + .reply(201, { _id: 1 }, { location: exampleRefLocation }); + + const spec = './__tests__/__fixtures__/ref-oas/petstore.json'; + + await expect( + openapi.run({ + key, + version, + spec, + update: true, + }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${yamlFileName}.yml`, expect.any(String)); + + mockWithHeader.done(); + return mock.done(); + }); + + it('should create GHA workflow (including workingDirectory)', async () => { + expect.assertions(4); + const yamlFileName = 'openapi-file-workingdirectory'; + prompts.inject([true, 'openapi-branch-workingdirectory', yamlFileName]); + const registryUUID = getRandomRegistryId(); + + const mock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version: '1.0.0' }) + .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) + .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); + + const mockWithHeader = getAPIMockWithVersionHeader(version) + .get('/api/v1/api-specification') + .basicAuth({ user: key }) + .reply(200, []) + .post('/api/v1/api-specification', { registryUUID }) + .basicAuth({ user: key }) + .reply(201, { _id: 1 }, { location: exampleRefLocation }); + + const spec = 'petstore.json'; + + await expect( + openapi.run({ + spec, + key, + version, + workingDirectory: './__tests__/__fixtures__/relative-ref-oas', + }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledTimes(2); + expect(fs.writeFileSync).toHaveBeenNthCalledWith(2, `.github/workflows/${yamlFileName}.yml`, expect.any(String)); + + mockWithHeader.done(); + return mock.done(); + }); + + it('should reject if user says no to creating GHA workflow', async () => { + prompts.inject(['create', false]); + const registryUUID = getRandomRegistryId(); + + const mock = getAPIMock() + .get(`/api/v1/version/${version}`) + .basicAuth({ user: key }) + .reply(200, { version }) + .post('/api/v1/api-registry', body => body.match('form-data; name="spec"')) + .reply(201, { registryUUID, spec: { openapi: '3.0.0' } }); + + const mockWithHeader = getAPIMockWithVersionHeader(version) + .get('/api/v1/api-specification') + .basicAuth({ user: key }) + .reply(200, [{ _id: 'spec1', title: 'spec1_title' }]) + .post('/api/v1/api-specification', { registryUUID }) + .delayConnection(1000) + .basicAuth({ user: key }) + .reply(201, { _id: 1 }, { location: exampleRefLocation }); + + const spec = './__tests__/__fixtures__/ref-oas/petstore.json'; + + await expect( + openapi.run({ + key, + version, + spec, + }) + ).rejects.toStrictEqual( + new Error( + 'GitHub Actions workflow creation cancelled. If you ever change your mind, you can run this command again with the `--github` flag.' + ) + ); + + mockWithHeader.done(); + return mock.done(); + }); + }); }); describe('rdme swagger', () => { diff --git a/__tests__/cmds/openapi/reduce.test.ts b/__tests__/cmds/openapi/reduce.test.ts index 10d2a1235..e003e4e72 100644 --- a/__tests__/cmds/openapi/reduce.test.ts +++ b/__tests__/cmds/openapi/reduce.test.ts @@ -17,8 +17,6 @@ const getCommandOutput = () => consoleInfoSpy.mock.calls.join('\n\n'); describe('rdme openapi:reduce', () => { beforeEach(() => { - jest.mock('fs'); - consoleInfoSpy = jest.spyOn(console, 'info').mockImplementation(); }); @@ -41,9 +39,8 @@ describe('rdme openapi:reduce', () => { const spec = require.resolve(`@readme/oas-examples/${specVersion}/${format}/petstore.${format}`); let reducedSpec; - fs.writeFileSync = jest.fn((f, d) => { - reducedSpec = JSON.parse(d as string); - return true; + fs.writeFileSync = jest.fn((fileName, data) => { + reducedSpec = JSON.parse(data as string); }); prompts.inject(['tags', ['pet'], 'output.json']); @@ -69,9 +66,8 @@ describe('rdme openapi:reduce', () => { const spec = 'petstore.json'; let reducedSpec; - fs.writeFileSync = jest.fn((f, d) => { - reducedSpec = JSON.parse(d as string); - return true; + fs.writeFileSync = jest.fn((fileName, data) => { + reducedSpec = JSON.parse(data as string); }); prompts.inject(['tags', ['user'], 'output.json']); @@ -101,9 +97,8 @@ describe('rdme openapi:reduce', () => { const spec = require.resolve(`@readme/oas-examples/${specVersion}/${format}/petstore.${format}`); let reducedSpec; - fs.writeFileSync = jest.fn((f, d) => { - reducedSpec = JSON.parse(d as string); - return true; + fs.writeFileSync = jest.fn((fileName, data) => { + reducedSpec = JSON.parse(data as string); }); prompts.inject(['paths', ['/pet', '/pet/findByStatus'], ['get', 'post'], 'output.json']); diff --git a/__tests__/cmds/validate.test.ts b/__tests__/cmds/validate.test.ts index b127d1c4e..605e5a29c 100644 --- a/__tests__/cmds/validate.test.ts +++ b/__tests__/cmds/validate.test.ts @@ -5,6 +5,7 @@ import chalk from 'chalk'; import prompts from 'prompts'; import Command from '../../src/cmds/validate'; +import { after, before } from '../helpers/get-gha-setup'; const testWorkingDir = process.cwd(); @@ -105,4 +106,105 @@ describe('rdme validate', () => { return expect(validate.run({ spec: './__tests__/__fixtures__/invalid-swagger.json' })).rejects.toMatchSnapshot(); }); }); + + describe('CI tests', () => { + beforeEach(() => { + process.env.TEST_CI = 'true'; + }); + + afterEach(() => { + delete process.env.TEST_CI; + }); + + it('should successfully validate prompt and not run GHA onboarding', async () => { + process.env.TEST_CREATEGHA = 'true'; + const spec = '__tests__/__fixtures__/petstore-simple-weird-version.json'; + await expect(validate.run({ spec })).resolves.toBe(chalk.green(`${spec} is a valid OpenAPI API definition!`)); + delete process.env.TEST_CREATEGHA; + }); + + it('should fail if user attempts to pass `--github` flag in CI environment', () => { + return expect( + validate.run({ github: true, spec: '__tests__/__fixtures__/petstore-simple-weird-version.json' }) + ).rejects.toStrictEqual(new Error('The `--github` flag is only for usage in non-CI environments.')); + }); + }); + + describe('GHA onboarding E2E tests', () => { + let yamlOutput; + + beforeEach(() => { + before((fileName, data) => { + yamlOutput = data; + }); + }); + + afterEach(() => { + after(); + }); + + it('should create GHA workflow if user passes in spec via prompts', async () => { + expect.assertions(6); + const spec = '__tests__/__fixtures__/petstore-simple-weird-version.json'; + const fileName = 'validate-test-file'; + prompts.inject([spec, true, 'validate-test-branch', fileName]); + + await expect(validate.run({})).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${fileName}.yml`, expect.any(String)); + expect(console.info).toHaveBeenCalledTimes(2); + const output = getCommandOutput(); + expect(output).toMatch("Looks like you're running this command in a GitHub Repository!"); + expect(output).toMatch('is a valid OpenAPI API definition!'); + }); + + it('should create GHA workflow if user passes in spec via opt', async () => { + expect.assertions(3); + const spec = '__tests__/__fixtures__/petstore-simple-weird-version.json'; + const fileName = 'validate-test-opt-spec-file'; + prompts.inject([true, 'validate-test-opt-spec-branch', fileName]); + + await expect(validate.run({ spec })).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${fileName}.yml`, expect.any(String)); + }); + + it('should create GHA workflow if user passes in spec via opt (github flag enabled)', async () => { + expect.assertions(3); + const spec = '__tests__/__fixtures__/petstore-simple-weird-version.json'; + const fileName = 'validate-test-opt-spec-github-file'; + prompts.inject(['validate-test-opt-spec-github-branch', fileName]); + + await expect(validate.run({ spec, github: true })).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${fileName}.yml`, expect.any(String)); + }); + + it('should create GHA workflow if user passes in spec via opt (including workingDirectory)', async () => { + expect.assertions(3); + const spec = 'petstore.json'; + const fileName = 'validate-test-opt-spec-workdir-file'; + prompts.inject([true, 'validate-test-opt-spec-github-branch', fileName]); + + await expect( + validate.run({ spec, workingDirectory: './__tests__/__fixtures__/relative-ref-oas' }) + ).resolves.toMatchSnapshot(); + + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(`.github/workflows/${fileName}.yml`, expect.any(String)); + }); + + it('should reject if user says no to creating GHA workflow', () => { + const spec = '__tests__/__fixtures__/petstore-simple-weird-version.json'; + prompts.inject([spec, false]); + return expect(validate.run({})).rejects.toStrictEqual( + new Error( + 'GitHub Actions workflow creation cancelled. If you ever change your mind, you can run this command again with the `--github` flag.' + ) + ); + }); + }); }); diff --git a/__tests__/helpers/get-gha-setup.ts b/__tests__/helpers/get-gha-setup.ts new file mode 100644 index 000000000..406589f6c --- /dev/null +++ b/__tests__/helpers/get-gha-setup.ts @@ -0,0 +1,47 @@ +import type { Response } from 'simple-git'; + +import fs from 'fs'; + +import configstore from '../../src/lib/configstore'; +import * as createGHAObject from '../../src/lib/createGHA'; +import { git } from '../../src/lib/createGHA'; + +import getGitRemoteMock from './get-git-mock'; + +/** + * A helper function for setting up tests for our GitHub Action onboarding. + * + * @param writeFileSyncCb the mock function that should be called + * in place of `fs.writeFileSync` + * @see {@link __tests__/lib/createGHA.test.ts} + */ +export function before(writeFileSyncCb) { + fs.writeFileSync = jest.fn(writeFileSyncCb); + + git.checkIsRepo = jest.fn(() => { + return Promise.resolve(true) as unknown as Response; + }); + + git.remote = getGitRemoteMock(); + + // global Date override to handle timestamp generation + // stolen from here: https://github.com/facebook/jest/issues/2234#issuecomment-294873406 + const DATE_TO_USE = new Date('2022'); + // @ts-expect-error we're just overriding the constructor for tests, + // no need to construct everything + global.Date = jest.fn(() => DATE_TO_USE); + + process.env.TEST_CREATEGHA = 'true'; + + const spy = jest.spyOn(createGHAObject, 'getPkgVersion'); + spy.mockReturnValue('7.8.9'); +} + +/** + * A helper function for tearing down tests for our GitHub Action onboarding. + */ +export function after() { + configstore.clear(); + delete process.env.TEST_CREATEGHA; + jest.clearAllMocks(); +} diff --git a/__tests__/helpers/get-git-mock.ts b/__tests__/helpers/get-git-mock.ts new file mode 100644 index 000000000..6c1ecb9e1 --- /dev/null +++ b/__tests__/helpers/get-git-mock.ts @@ -0,0 +1,40 @@ +import type { Response } from 'simple-git'; + +/** + * Creates a Jest mock function for testing `git.remote` + * @param remote remote to return (usually `origin`) + * @param remoteUrl git URL for the given remote + * @param defaultBranch the HEAD branch + */ +export default function getGitRemoteMock( + remote = 'origin', + remoteUrl = 'https://github.com/readmeio/rdme.git', + defaultBranch = 'main' +) { + return jest.fn(arr => { + // first call (used to grab remote for usage in subsequent commands) + if (!arr.length) { + if (!remote) return Promise.reject(new Error('Bad mock uh oh')) as unknown as Response; + return Promise.resolve(remote) as unknown as Response; + } + // second call (used to grab default branch) + if (arr.length === 2 && arr[0] === 'show' && arr[1] === remote) { + if (!defaultBranch) return Promise.reject(new Error('Bad mock uh oh')) as unknown as Response; + return Promise.resolve(`* remote origin + Fetch URL: ${remoteUrl} + Push URL: ${remoteUrl} + HEAD branch: ${defaultBranch} +`) as unknown as Response; + } + + // third call (used to grab remote URLs) + if (arr.length === 1 && arr[0] === '-v') { + if (!remoteUrl) return Promise.reject(new Error('Bad mock uh oh')) as unknown as Response; + return Promise.resolve(`origin ${remoteUrl} (fetch) +origin ${remoteUrl} (push) + `) as unknown as Response; + } + + return Promise.reject(new Error('Bad mock uh oh')) as unknown as Response; + }); +} diff --git a/__tests__/helpers/github-workflow-schema.json b/__tests__/helpers/github-workflow-schema.json new file mode 100644 index 000000000..cc63334e8 --- /dev/null +++ b/__tests__/helpers/github-workflow-schema.json @@ -0,0 +1,1645 @@ +{ + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions", + "$schema": "http://json-schema.org/draft-07/schema", + "additionalProperties": false, + "definitions": { + "architecture": { + "type": "string", + "enum": ["ARM32", "x64", "x86"] + }, + "branch": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestbranchestags", + "$ref": "#/definitions/globs", + "description": "When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. If you only define only tags or only branches, the workflow won't run for events affecting the undefined Git ref.\nThe branches, branches-ignore, tags, and tags-ignore keywords accept glob patterns that use the * and ** wildcard characters to match more than one branch or tag name. For more information, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet.\nThe patterns defined in branches and tags are evaluated against the Git ref's name. For example, defining the pattern mona/octocat in branches will match the refs/heads/mona/octocat Git ref. The pattern releases/** will match the refs/heads/releases/10 Git ref.\nYou can use two types of filters to prevent a workflow from running on pushes and pull requests to tags and branches:\n- branches or branches-ignore - You cannot use both the branches and branches-ignore filters for the same event in a workflow. Use the branches filter when you need to filter branches for positive matches and exclude branches. Use the branches-ignore filter when you only need to exclude branch names.\n- tags or tags-ignore - You cannot use both the tags and tags-ignore filters for the same event in a workflow. Use the tags filter when you need to filter tags for positive matches and exclude tags. Use the tags-ignore filter when you only need to exclude tag names.\nYou can exclude tags and branches using the ! character. The order that you define patterns matters.\n- A matching negative pattern (prefixed with !) after a positive match will exclude the Git ref.\n- A matching positive pattern after a negative match will include the Git ref again." + }, + "concurrency": { + "type": "object", + "properties": { + "group": { + "$comment": "https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run-1", + "description": "When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled.", + "type": "string" + }, + "cancel-in-progress": { + "$comment": "https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run-1", + "description": "To cancel any currently running job or workflow in the same concurrency group, specify cancel-in-progress: true.", + "oneOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/expressionSyntax" + } + ] + } + }, + "required": ["group"], + "additionalProperties": false + }, + "configuration": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/configuration" + } + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/configuration" + } + } + ] + }, + "container": { + "type": "object", + "properties": { + "image": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainerimage", + "description": "The Docker image to use as the container to run the action. The value can be the Docker Hub image name or a registry name.", + "type": "string" + }, + "credentials": { + "$comment": "https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainercredentials", + "description": "If the image's container registry requires authentication to pull the image, you can use credentials to set a map of the username and password. The credentials are the same values that you would provide to the `docker login` command.", + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "env": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainerenv", + "$ref": "#/definitions/env", + "description": "Sets an array of environment variables in the container." + }, + "ports": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainerports", + "description": "Sets an array of ports to expose on the container.", + "type": "array", + "items": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "minItems": 1 + }, + "volumes": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainervolumes", + "description": "Sets an array of volumes for the container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.\nTo specify a volume, you specify the source and destination path: :\nThe is a volume name or an absolute path on the host machine, and is an absolute path in the container.", + "type": "array", + "items": { + "type": "string", + "pattern": "^[^:]+:[^:]+$" + }, + "minItems": 1 + }, + "options": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontaineroptions", + "description": "Additional Docker container resource options. For a list of options, see https://docs.docker.com/engine/reference/commandline/create/#options.", + "type": "string" + } + }, + "required": ["image"], + "additionalProperties": false + }, + "defaults": { + "type": "object", + "properties": { + "run": { + "type": "object", + "properties": { + "shell": { + "$ref": "#/definitions/shell" + }, + "working-directory": { + "$ref": "#/definitions/working-directory" + } + }, + "minProperties": 1, + "additionalProperties": false + } + }, + "minProperties": 1, + "additionalProperties": false + }, + "permissions": { + "$comment": "https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions", + "description": "You can modify the default permissions granted to the GITHUB_TOKEN, adding or removing access as required, so that you only allow the minimum required access.", + "oneOf": [ + { + "type": "string", + "enum": ["read-all", "write-all"] + }, + { + "$ref": "#/definitions/permissions-event" + } + ] + }, + "permissions-event": { + "type": "object", + "additionalProperties": false, + "properties": { + "actions": { + "$ref": "#/definitions/permissions-level" + }, + "checks": { + "$ref": "#/definitions/permissions-level" + }, + "contents": { + "$ref": "#/definitions/permissions-level" + }, + "deployments": { + "$ref": "#/definitions/permissions-level" + }, + "discussions": { + "$ref": "#/definitions/permissions-level" + }, + "id-token": { + "$ref": "#/definitions/permissions-level" + }, + "issues": { + "$ref": "#/definitions/permissions-level" + }, + "packages": { + "$ref": "#/definitions/permissions-level" + }, + "pages": { + "$ref": "#/definitions/permissions-level" + }, + "pull-requests": { + "$ref": "#/definitions/permissions-level" + }, + "repository-projects": { + "$ref": "#/definitions/permissions-level" + }, + "security-events": { + "$ref": "#/definitions/permissions-level" + }, + "statuses": { + "$ref": "#/definitions/permissions-level" + } + } + }, + "permissions-level": { + "type": "string", + "enum": ["read", "write", "none"] + }, + "env": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/environment-variables", + "description": "To set custom environment variables, you need to specify the variables in the workflow file. You can define environment variables for a step, job, or entire workflow using the jobs..steps[*].env, jobs..env, and env keywords. For more information, see https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsenv", + "oneOf": [ + { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + }, + { + "$ref": "#/definitions/expressionSyntax", + "$comment": "https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson", + "pattern": "^\\$\\{\\{\\s*fromJSON\\(.*\\)\\s*\\}\\}$" + } + ] + }, + "environment": { + "$comment": "https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idenvironment", + "description": "The environment that the job references", + "type": "object", + "properties": { + "name": { + "$comment": "https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#example-using-a-single-environment-name", + "description": "The name of the environment configured in the repo.", + "type": "string" + }, + "url": { + "$comment": "https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#example-using-environment-name-and-url", + "description": "A deployment URL", + "type": "string" + } + }, + "required": ["name"], + "additionalProperties": false + }, + "event": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows", + "type": "string", + "enum": [ + "branch_protection_rule", + "check_run", + "check_suite", + "create", + "delete", + "deployment", + "deployment_status", + "discussion", + "discussion_comment", + "fork", + "gollum", + "issue_comment", + "issues", + "label", + "member", + "milestone", + "page_build", + "project", + "project_card", + "project_column", + "public", + "pull_request", + "pull_request_review", + "pull_request_review_comment", + "pull_request_target", + "push", + "registry_package", + "release", + "status", + "watch", + "workflow_call", + "workflow_dispatch", + "workflow_run", + "repository_dispatch" + ] + }, + "eventObject": { + "oneOf": [ + { + "type": "object" + }, + { + "type": "null" + } + ], + "additionalProperties": true + }, + "expressionSyntax": { + "type": "string", + "$comment": "escape `{` and `}` in pattern to be unicode compatible (#1360)", + "pattern": "^\\$\\{\\{.*\\}\\}$" + }, + "stringContainingExpressionSyntax": { + "type": "string", + "$comment": "escape `{` and `}` in pattern to be unicode compatible (#1360)", + "pattern": "^.*\\$\\{\\{.*\\}\\}.*$" + }, + "globs": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + }, + "minItems": 1 + }, + "machine": { + "type": "string", + "enum": ["linux", "macos", "windows"] + }, + "name": { + "type": "string", + "pattern": "^[_a-zA-Z][a-zA-Z0-9_-]*$" + }, + "path": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths", + "$ref": "#/definitions/globs", + "description": "When using the push and pull_request events, you can configure a workflow to run when at least one file does not match paths-ignore or at least one modified file matches the configured paths. Path filters are not evaluated for pushes to tags.\nThe paths-ignore and paths keywords accept glob patterns that use the * and ** wildcard characters to match more than one path name. For more information, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet.\nYou can exclude paths using two types of filters. You cannot use both of these filters for the same event in a workflow.\n- paths-ignore - Use the paths-ignore filter when you only need to exclude path names.\n- paths - Use the paths filter when you need to filter paths for positive matches and exclude paths." + }, + "ref": { + "properties": { + "branches": { + "$ref": "#/definitions/branch" + }, + "branches-ignore": { + "$ref": "#/definitions/branch" + }, + "tags": { + "$ref": "#/definitions/branch" + }, + "tags-ignore": { + "$ref": "#/definitions/branch" + }, + "paths": { + "$ref": "#/definitions/path" + }, + "paths-ignore": { + "$ref": "#/definitions/path" + } + }, + "oneOf": [ + { + "type": "object", + "allOf": [ + { + "not": { + "required": ["branches", "branches-ignore"] + } + }, + { + "not": { + "required": ["tags", "tags-ignore"] + } + }, + { + "not": { + "required": ["paths", "paths-ignore"] + } + } + ] + }, + { + "type": "null" + } + ] + }, + "shell": { + "$comment": "https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell", + "description": "You can override the default shell settings in the runner's operating system using the shell keyword. You can use built-in shell keywords, or you can define a custom set of shell options.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "$comment": "https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#custom-shell", + "enum": ["bash", "pwsh", "python", "sh", "cmd", "powershell"] + } + ] + }, + "types": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onevent_nametypes", + "description": "Selects the types of activity that will trigger a workflow run. Most GitHub events are triggered by more than one type of activity. For example, the event for the release resource is triggered when a release is published, unpublished, created, edited, deleted, or prereleased. The types keyword enables you to narrow down activity that causes the workflow to run. When only one activity type triggers a webhook event, the types keyword is unnecessary.\nYou can use an array of event types. For more information about each event and their activity types, see https://help.github.com/en/articles/events-that-trigger-workflows#webhook-events.", + "type": "array", + "minItems": 1 + }, + "working-directory": { + "$comment": "https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun", + "description": "Using the working-directory keyword, you can specify the working directory of where to run the command.", + "type": "string" + }, + "jobNeeds": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idneeds", + "description": "Identifies any jobs that must complete successfully before this job will run. It can be a string or array of strings. If a job fails, all jobs that need it are skipped unless the jobs use a conditional statement that causes the job to continue.", + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/name" + }, + "minItems": 1 + }, + { + "$ref": "#/definitions/name" + } + ] + }, + "reusableWorkflowCallJob": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#calling-a-reusable-workflow", + "description": "Each job must have an id to associate with the job. The key job_id is a string and its value is a map of the job's configuration data. You must replace with a string that is unique to the jobs object. The must start with a letter or _ and contain only alphanumeric characters, -, or _.", + "type": "object", + "properties": { + "name": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idname", + "description": "The name of the job displayed on GitHub.", + "type": "string" + }, + "needs": { + "$ref": "#/definitions/jobNeeds" + }, + "permissions": { + "$ref": "#/definitions/permissions-event" + }, + "if": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idif", + "description": "You can use the if conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.\nExpressions in an if conditional do not require the ${{ }} syntax. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.", + "type": ["boolean", "number", "string"] + }, + "uses": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_iduses", + "description": "The location and version of a reusable workflow file to run as a job, of the form './{path/to}/{localfile}.yml' or '{owner}/{repo}/{path}/{filename}@{ref}'. {ref} can be a SHA, a release tag, or a branch name. Using the commit SHA is the safest for stability and security.", + "type": "string", + "pattern": "^(.+/)+(.+)\\.(ya?ml)(@.+)?$" + }, + "with": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idwith", + "description": "A map of inputs that are passed to the called workflow. Any inputs that you pass must match the input specifications defined in the called workflow. Unlike 'jobs..steps[*].with', the inputs you pass with 'jobs..with' are not be available as environment variables in the called workflow. Instead, you can reference the inputs by using the inputs context.", + "$ref": "#/definitions/env" + }, + "secrets": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idsecrets", + "description": "When a job is used to call a reusable workflow, you can use 'secrets' to provide a map of secrets that are passed to the called workflow. Any secrets that you pass must match the names defined in the called workflow.", + "oneOf": [ + { + "$ref": "#/definitions/env" + }, + { + "type": "string", + "enum": ["inherit"] + } + ] + }, + "strategy": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategy", + "description": "A strategy creates a build matrix for your jobs. You can define different variations of an environment to run each job in.", + "type": "object", + "properties": { + "matrix": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix", + "description": "A build matrix is a set of different configurations of the virtual environment. For example you might run a job against more than one supported version of a language, operating system, or tool. Each configuration is a copy of the job that runs and reports a status.\nYou can specify a matrix by supplying an array for the configuration options. For example, if the GitHub virtual environment supports Node.js versions 6, 8, and 10 you could specify an array of those versions in the matrix.\nWhen you define a matrix of operating systems, you must set the required runs-on keyword to the operating system of the current job, rather than hard-coding the operating system name. To access the operating system name, you can use the matrix.os context parameter to set runs-on. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.", + "oneOf": [ + { + "type": "object" + }, + { + "$ref": "#/definitions/expressionSyntax" + } + ], + "patternProperties": { + "^(in|ex)clude$": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/configuration" + } + }, + "minItems": 1 + } + }, + "additionalProperties": { + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/configuration" + }, + "minItems": 1 + }, + { + "$ref": "#/definitions/expressionSyntax" + } + ] + }, + "minProperties": 1 + }, + "fail-fast": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast", + "description": "When set to true, GitHub cancels all in-progress jobs if any matrix job fails. Default: true", + "type": "boolean", + "default": true + }, + "max-parallel": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymax-parallel", + "description": "The maximum number of jobs that can run simultaneously when using a matrix job strategy. By default, GitHub will maximize the number of jobs run in parallel depending on the available runners on GitHub-hosted virtual machines.", + "type": "number" + } + }, + "required": ["matrix"], + "additionalProperties": false + }, + "concurrency": { + "$comment": "https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency", + "description": "Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the secrets context. \nYou can also specify concurrency at the workflow level. \nWhen a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow in the same concurrency group, specify cancel-in-progress: true.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/concurrency" + } + ] + } + }, + "required": ["uses"], + "additionalProperties": false + }, + "normalJob": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_id", + "description": "Each job must have an id to associate with the job. The key job_id is a string and its value is a map of the job's configuration data. You must replace with a string that is unique to the jobs object. The must start with a letter or _ and contain only alphanumeric characters, -, or _.", + "type": "object", + "properties": { + "name": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idname", + "description": "The name of the job displayed on GitHub.", + "type": "string" + }, + "needs": { + "$ref": "#/definitions/jobNeeds" + }, + "permissions": { + "$ref": "#/definitions/permissions" + }, + "runs-on": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idruns-on", + "description": "The type of machine to run the job on. The machine can be either a GitHub-hosted runner, or a self-hosted runner.", + "oneOf": [ + { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#github-hosted-runners", + "type": "string", + "enum": [ + "macos-10.15", + "macos-11", + "macos-12", + "macos-latest", + "self-hosted", + "ubuntu-18.04", + "ubuntu-20.04", + "ubuntu-22.04", + "ubuntu-latest", + "windows-2019", + "windows-2022", + "windows-latest" + ] + }, + { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#self-hosted-runners", + "type": "array", + "anyOf": [ + { + "items": [ + { + "const": "self-hosted" + } + ], + "minItems": 1, + "additionalItems": { + "type": "string" + } + }, + { + "items": [ + { + "const": "self-hosted" + }, + { + "$ref": "#/definitions/machine" + } + ], + "minItems": 2, + "additionalItems": { + "type": "string" + } + }, + { + "items": [ + { + "const": "self-hosted" + }, + { + "$ref": "#/definitions/architecture" + } + ], + "minItems": 2, + "additionalItems": { + "type": "string" + } + }, + { + "items": [ + { + "const": "self-hosted" + }, + { + "$ref": "#/definitions/machine" + }, + { + "$ref": "#/definitions/architecture" + } + ], + "minItems": 3, + "additionalItems": { + "type": "string" + } + }, + { + "items": [ + { + "const": "self-hosted" + }, + { + "$ref": "#/definitions/architecture" + }, + { + "$ref": "#/definitions/machine" + } + ], + "minItems": 3, + "additionalItems": { + "type": "string" + } + } + ] + }, + { + "$ref": "#/definitions/stringContainingExpressionSyntax" + } + ] + }, + "environment": { + "$comment": "https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idenvironment", + "description": "The environment that the job references.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/environment" + } + ] + }, + "outputs": { + "$comment": "https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjobs_idoutputs", + "description": "A map of outputs for a job. Job outputs are available to all downstream jobs that depend on this job.", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "minProperties": 1 + }, + "env": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idenv", + "$ref": "#/definitions/env", + "description": "A map of environment variables that are available to all steps in the job." + }, + "defaults": { + "$comment": "https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_iddefaults", + "$ref": "#/definitions/defaults", + "description": "A map of default settings that will apply to all steps in the job." + }, + "if": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idif", + "description": "You can use the if conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.\nExpressions in an if conditional do not require the ${{ }} syntax. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.", + "type": ["boolean", "number", "string"] + }, + "steps": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps", + "description": "A job contains a sequence of tasks called steps. Steps can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry. Not all steps run actions, but all actions run as a step. Each step runs in its own process in the virtual environment and has access to the workspace and filesystem. Because steps run in their own process, changes to environment variables are not preserved between steps. GitHub provides built-in steps to set up and complete a job.\n", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsid", + "description": "A unique identifier for the step. You can use the id to reference the step in contexts. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.", + "type": "string" + }, + "if": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsif", + "description": "You can use the if conditional to prevent a step from running unless a condition is met. You can use any supported context and expression to create a conditional.\nExpressions in an if conditional do not require the ${{ }} syntax. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.", + "type": ["boolean", "number", "string"] + }, + "name": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsname", + "description": "A name for your step to display on GitHub.", + "type": "string" + }, + "uses": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsuses", + "description": "Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a published Docker container image (https://hub.docker.com/).\nWe strongly recommend that you include the version of the action you are using by specifying a Git ref, SHA, or Docker tag number. If you don't specify a version, it could break your workflows or cause unexpected behavior when the action owner publishes an update.\n- Using the commit SHA of a released action version is the safest for stability and security.\n- Using the specific major action version allows you to receive critical fixes and security patches while still maintaining compatibility. It also assures that your workflow should still work.\n- Using the master branch of an action may be convenient, but if someone releases a new major version with a breaking change, your workflow could break.\nSome actions require inputs that you must set using the with keyword. Review the action's README file to determine the inputs required.\nActions are either JavaScript files or Docker containers. If the action you're using is a Docker container you must run the job in a Linux virtual environment. For more details, see https://help.github.com/en/articles/virtual-environments-for-github-actions.", + "type": "string" + }, + "run": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsrun", + "description": "Runs command-line programs using the operating system's shell. If you do not provide a name, the step name will default to the text specified in the run command.\nCommands run using non-login shells by default. You can choose a different shell and customize the shell used to run commands. For more information, see https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell.\nEach run keyword represents a new process and shell in the virtual environment. When you provide multi-line commands, each line runs in the same shell.", + "type": "string" + }, + "working-directory": { + "$ref": "#/definitions/working-directory" + }, + "shell": { + "$ref": "#/definitions/shell" + }, + "with": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepswith", + "$ref": "#/definitions/env", + "description": "A map of the input parameters defined by the action. Each input parameter is a key/value pair. Input parameters are set as environment variables. The variable is prefixed with INPUT_ and converted to upper case.", + "properties": { + "args": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepswithargs", + "type": "string" + }, + "entrypoint": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepswithentrypoint", + "type": "string" + } + } + }, + "env": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsenv", + "$ref": "#/definitions/env", + "description": "Sets environment variables for steps to use in the virtual environment. You can also set environment variables for the entire workflow or a job." + }, + "continue-on-error": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error", + "description": "Prevents a job from failing when a step fails. Set to true to allow a job to pass when this step fails.", + "oneOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/expressionSyntax" + } + ], + "default": false + }, + "timeout-minutes": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepstimeout-minutes", + "description": "The maximum number of minutes to run the step before killing the process.", + "type": "number" + } + }, + "dependencies": { + "working-directory": ["run"], + "shell": ["run"] + }, + "additionalProperties": false + }, + "minItems": 1 + }, + "timeout-minutes": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes", + "description": "The maximum number of minutes to let a workflow run before GitHub automatically cancels it. Default: 360", + "type": "number", + "default": 360 + }, + "strategy": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategy", + "description": "A strategy creates a build matrix for your jobs. You can define different variations of an environment to run each job in.", + "type": "object", + "properties": { + "matrix": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix", + "description": "A build matrix is a set of different configurations of the virtual environment. For example you might run a job against more than one supported version of a language, operating system, or tool. Each configuration is a copy of the job that runs and reports a status.\nYou can specify a matrix by supplying an array for the configuration options. For example, if the GitHub virtual environment supports Node.js versions 6, 8, and 10 you could specify an array of those versions in the matrix.\nWhen you define a matrix of operating systems, you must set the required runs-on keyword to the operating system of the current job, rather than hard-coding the operating system name. To access the operating system name, you can use the matrix.os context parameter to set runs-on. For more information, see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.", + "oneOf": [ + { + "type": "object" + }, + { + "$ref": "#/definitions/expressionSyntax" + } + ], + "patternProperties": { + "^(in|ex)clude$": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build", + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/configuration" + } + }, + "minItems": 1 + } + }, + "additionalProperties": { + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/configuration" + }, + "minItems": 1 + }, + { + "$ref": "#/definitions/expressionSyntax" + } + ] + }, + "minProperties": 1 + }, + "fail-fast": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast", + "description": "When set to true, GitHub cancels all in-progress jobs if any matrix job fails. Default: true", + "type": "boolean", + "default": true + }, + "max-parallel": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymax-parallel", + "description": "The maximum number of jobs that can run simultaneously when using a matrix job strategy. By default, GitHub will maximize the number of jobs run in parallel depending on the available runners on GitHub-hosted virtual machines.", + "type": "number" + } + }, + "required": ["matrix"], + "additionalProperties": false + }, + "continue-on-error": { + "$comment": "https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error", + "description": "Prevents a workflow run from failing when a job fails. Set to true to allow a workflow run to pass when this job fails.", + "oneOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/expressionSyntax" + } + ] + }, + "container": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainer", + "description": "A container to run any steps in a job that don't already specify a container. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts.\nIf you do not set a container, all steps will run directly on the host specified by runs-on unless a step refers to an action configured to run in a container.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/container" + } + ] + }, + "services": { + "$comment": "https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idservices", + "description": "Additional containers to host services for a job in a workflow. These are useful for creating databases or cache services like redis. The runner on the virtual machine will automatically create a network and manage the life cycle of the service containers.\nWhen you use a service container for a job or your step uses container actions, you don't need to set port information to access the service. Docker automatically exposes all ports between containers on the same network.\nWhen both the job and the action run in a container, you can directly reference the container by its hostname. The hostname is automatically mapped to the service name.\nWhen a step does not use a container action, you must access the service using localhost and bind the ports.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/container" + } + }, + "concurrency": { + "$comment": "https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency", + "description": "Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the secrets context. \nYou can also specify concurrency at the workflow level. \nWhen a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow in the same concurrency group, specify cancel-in-progress: true.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/concurrency" + } + ] + } + }, + "required": ["runs-on"], + "additionalProperties": false + } + }, + "properties": { + "name": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#name", + "description": "The name of your workflow. GitHub displays the names of your workflows on your repository's actions page. If you omit this field, GitHub sets the name to the workflow's filename.", + "type": "string" + }, + "on": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#on", + "description": "The name of the GitHub event that triggers the workflow. You can provide a single event string, array of events, array of event types, or an event configuration map that schedules a workflow or restricts the execution of a workflow to specific files, tags, or branch changes. For a list of available events, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows.", + "oneOf": [ + { + "$ref": "#/definitions/event" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/event" + }, + "minItems": 1 + }, + { + "type": "object", + "properties": { + "branch_protection_rule": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#branch_protection_rule", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the branch_protection_rule event occurs. More than one activity type triggers this event.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "edited", "deleted"] + }, + "default": ["created", "edited", "deleted"] + } + } + }, + "check_run": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#check-run-event-check_run", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the check_run event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/checks/runs.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "rerequested", "completed", "requested_action"] + }, + "default": ["created", "rerequested", "completed", "requested_action"] + } + } + }, + "check_suite": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#check-suite-event-check_suite", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the check_suite event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/checks/suites/.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["completed", "requested", "rerequested"] + }, + "default": ["completed", "requested", "rerequested"] + } + } + }, + "create": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#create-event-create", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime someone creates a branch or tag, which triggers the create event. For information about the REST API, see https://developer.github.com/v3/git/refs/#create-a-reference." + }, + "delete": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#delete-event-delete", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime someone deletes a branch or tag, which triggers the delete event. For information about the REST API, see https://developer.github.com/v3/git/refs/#delete-a-reference." + }, + "deployment": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#deployment-event-deployment", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime someone creates a deployment, which triggers the deployment event. Deployments created with a commit SHA may not have a Git ref. For information about the REST API, see https://developer.github.com/v3/repos/deployments/." + }, + "deployment_status": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#deployment-status-event-deployment_status", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime a third party provides a deployment status, which triggers the deployment_status event. Deployments created with a commit SHA may not have a Git ref. For information about the REST API, see https://developer.github.com/v3/repos/deployments/#create-a-deployment-status." + }, + "discussion": { + "$comment": "https://docs.github.com/en/actions/reference/events-that-trigger-workflows#discussion", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the discussion event occurs. More than one activity type triggers this event. For information about the GraphQL API, see https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": [ + "created", + "edited", + "deleted", + "transferred", + "pinned", + "unpinned", + "labeled", + "unlabeled", + "locked", + "unlocked", + "category_changed", + "answered", + "unanswered" + ] + }, + "default": [ + "created", + "edited", + "deleted", + "transferred", + "pinned", + "unpinned", + "labeled", + "unlabeled", + "locked", + "unlocked", + "category_changed", + "answered", + "unanswered" + ] + } + } + }, + "discussion_comment": { + "$comment": "https://docs.github.com/en/actions/reference/events-that-trigger-workflows#discussion_comment", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the discussion_comment event occurs. More than one activity type triggers this event. For information about the GraphQL API, see https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "edited", "deleted"] + }, + "default": ["created", "edited", "deleted"] + } + } + }, + "fork": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#fork-event-fork", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime when someone forks a repository, which triggers the fork event. For information about the REST API, see https://developer.github.com/v3/repos/forks/#create-a-fork." + }, + "gollum": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#gollum-event-gollum", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow when someone creates or updates a Wiki page, which triggers the gollum event." + }, + "issue_comment": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#issue-comment-event-issue_comment", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the issue_comment event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/issues/comments/.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "edited", "deleted"] + }, + "default": ["created", "edited", "deleted"] + } + } + }, + "issues": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#issues-event-issues", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the issues event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/issues.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": [ + "opened", + "edited", + "deleted", + "transferred", + "pinned", + "unpinned", + "closed", + "reopened", + "assigned", + "unassigned", + "labeled", + "unlabeled", + "locked", + "unlocked", + "milestoned", + "demilestoned" + ] + }, + "default": [ + "opened", + "edited", + "deleted", + "transferred", + "pinned", + "unpinned", + "closed", + "reopened", + "assigned", + "unassigned", + "labeled", + "unlabeled", + "locked", + "unlocked", + "milestoned", + "demilestoned" + ] + } + } + }, + "label": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#label-event-label", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the label event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/issues/labels/.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "edited", "deleted"] + }, + "default": ["created", "edited", "deleted"] + } + } + }, + "member": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#member-event-member", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the member event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/repos/collaborators/.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["added", "edited", "deleted"] + }, + "default": ["added", "edited", "deleted"] + } + } + }, + "milestone": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#milestone-event-milestone", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the milestone event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/issues/milestones/.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "closed", "opened", "edited", "deleted"] + }, + "default": ["created", "closed", "opened", "edited", "deleted"] + } + } + }, + "page_build": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#page-build-event-page_build", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime someone pushes to a GitHub Pages-enabled branch, which triggers the page_build event. For information about the REST API, see https://developer.github.com/v3/repos/pages/." + }, + "project": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#project-event-project", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the project event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/projects/.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "updated", "closed", "reopened", "edited", "deleted"] + }, + "default": ["created", "updated", "closed", "reopened", "edited", "deleted"] + } + } + }, + "project_card": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#project-card-event-project_card", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the project_card event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/projects/cards.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "moved", "converted", "edited", "deleted"] + }, + "default": ["created", "moved", "converted", "edited", "deleted"] + } + } + }, + "project_column": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#project-column-event-project_column", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the project_column event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/projects/columns.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "updated", "moved", "deleted"] + }, + "default": ["created", "updated", "moved", "deleted"] + } + } + }, + "public": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#public-event-public", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime someone makes a private repository public, which triggers the public event. For information about the REST API, see https://developer.github.com/v3/repos/#edit." + }, + "pull_request": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#pull-request-event-pull_request", + "$ref": "#/definitions/ref", + "description": "Runs your workflow anytime the pull_request event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/pulls.\nNote: Workflows do not run on private base repositories when you open a pull request from a forked repository.\nWhen you create a pull request from a forked repository to the base repository, GitHub sends the pull_request event to the base repository and no pull request events occur on the forked repository.\nWorkflows don't run on forked repositories by default. You must enable GitHub Actions in the Actions tab of the forked repository.\nThe permissions for the GITHUB_TOKEN in forked repositories is read-only. For more information about the GITHUB_TOKEN, see https://help.github.com/en/articles/virtual-environments-for-github-actions.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": [ + "assigned", + "unassigned", + "labeled", + "unlabeled", + "opened", + "edited", + "closed", + "reopened", + "synchronize", + "converted_to_draft", + "ready_for_review", + "locked", + "unlocked", + "review_requested", + "review_request_removed", + "auto_merge_enabled", + "auto_merge_disabled" + ] + }, + "default": ["opened", "synchronize", "reopened"] + } + }, + "patternProperties": { + "^(branche|tag|path)s(-ignore)?$": { + "type": "array" + } + }, + "additionalProperties": false + }, + "pull_request_review": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#pull-request-review-event-pull_request_review", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the pull_request_review event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/pulls/reviews.\nNote: Workflows do not run on private base repositories when you open a pull request from a forked repository.\nWhen you create a pull request from a forked repository to the base repository, GitHub sends the pull_request event to the base repository and no pull request events occur on the forked repository.\nWorkflows don't run on forked repositories by default. You must enable GitHub Actions in the Actions tab of the forked repository.\nThe permissions for the GITHUB_TOKEN in forked repositories is read-only. For more information about the GITHUB_TOKEN, see https://help.github.com/en/articles/virtual-environments-for-github-actions.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["submitted", "edited", "dismissed"] + }, + "default": ["submitted", "edited", "dismissed"] + } + } + }, + "pull_request_review_comment": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#pull-request-review-comment-event-pull_request_review_comment", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime a comment on a pull request's unified diff is modified, which triggers the pull_request_review_comment event. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/pulls/comments.\nNote: Workflows do not run on private base repositories when you open a pull request from a forked repository.\nWhen you create a pull request from a forked repository to the base repository, GitHub sends the pull_request event to the base repository and no pull request events occur on the forked repository.\nWorkflows don't run on forked repositories by default. You must enable GitHub Actions in the Actions tab of the forked repository.\nThe permissions for the GITHUB_TOKEN in forked repositories is read-only. For more information about the GITHUB_TOKEN, see https://help.github.com/en/articles/virtual-environments-for-github-actions.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["created", "edited", "deleted"] + }, + "default": ["created", "edited", "deleted"] + } + } + }, + "pull_request_target": { + "$comment": "https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target", + "$ref": "#/definitions/ref", + "description": "This event is similar to pull_request, except that it runs in the context of the base repository of the pull request, rather than in the merge commit. This means that you can more safely make your secrets available to the workflows triggered by the pull request, because only workflows defined in the commit on the base repository are run. For example, this event allows you to create workflows that label and comment on pull requests, based on the contents of the event payload.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": [ + "assigned", + "unassigned", + "labeled", + "unlabeled", + "opened", + "edited", + "closed", + "reopened", + "synchronize", + "converted_to_draft", + "ready_for_review", + "locked", + "unlocked", + "review_requested", + "review_request_removed", + "auto_merge_enabled", + "auto_merge_disabled" + ] + }, + "default": ["opened", "synchronize", "reopened"] + } + }, + "patternProperties": { + "^(branche|tag|path)s(-ignore)?$": {} + }, + "additionalProperties": false + }, + "push": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#push-event-push", + "$ref": "#/definitions/ref", + "description": "Runs your workflow when someone pushes to a repository branch, which triggers the push event.\nNote: The webhook payload available to GitHub Actions does not include the added, removed, and modified attributes in the commit object. You can retrieve the full commit object using the REST API. For more information, see https://developer.github.com/v3/repos/commits/#get-a-single-commit.", + "patternProperties": { + "^(branche|tag|path)s(-ignore)?$": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false + }, + "registry_package": { + "$comment": "https://help.github.com/en/actions/reference/events-that-trigger-workflows#registry-package-event-registry_package", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime a package is published or updated. For more information, see https://help.github.com/en/github/managing-packages-with-github-packages.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["published", "updated"] + }, + "default": ["published", "updated"] + } + } + }, + "release": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#release-event-release", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the release event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/repos/releases/ in the GitHub Developer documentation.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["published", "unpublished", "created", "edited", "deleted", "prereleased", "released"] + }, + "default": ["published", "unpublished", "created", "edited", "deleted", "prereleased", "released"] + } + } + }, + "status": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#status-event-status", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the status of a Git commit changes, which triggers the status event. For information about the REST API, see https://developer.github.com/v3/repos/statuses/." + }, + "watch": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#watch-event-watch", + "$ref": "#/definitions/eventObject", + "description": "Runs your workflow anytime the watch event occurs. More than one activity type triggers this event. For information about the REST API, see https://developer.github.com/v3/activity/starring/." + }, + "workflow_call": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_call", + "description": "Allows workflows to be reused by other workflows.", + "properties": { + "inputs": { + "$comment": "https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onworkflow_callinputs", + "description": "When using the workflow_call keyword, you can optionally specify inputs that are passed to the called workflow from the caller workflow.", + "type": "object", + "patternProperties": { + "^[_a-zA-Z][a-zA-Z0-9_-]*$": { + "$comment": "https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputsinput_id", + "description": "A string identifier to associate with the input. The value of is a map of the input's metadata. The must be a unique identifier within the inputs object. The must start with a letter or _ and contain only alphanumeric characters, -, or _.", + "type": "object", + "properties": { + "description": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputsinput_iddescription", + "description": "A string description of the input parameter.", + "type": "string" + }, + "deprecationMessage": { + "description": "A string shown to users using the deprecated input.", + "type": "string" + }, + "required": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputsinput_idrequired", + "description": "A boolean to indicate whether the action requires the input parameter. Set to true when the parameter is required.", + "type": "boolean" + }, + "type": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callinput_idtype", + "description": "Required if input is defined for the on.workflow_call keyword. The value of this parameter is a string specifying the data type of the input. This must be one of: boolean, number, or string.", + "type": "string", + "enum": ["boolean", "number", "string"] + }, + "default": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputsinput_iddefault", + "description": "The default value is used when an input parameter isn't specified in a workflow file.", + "type": ["boolean", "number", "string"] + } + }, + "required": ["required", "type"], + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "secrets": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callsecrets", + "description": "A map of the secrets that can be used in the called workflow. Within the called workflow, you can use the secrets context to refer to a secret.", + "patternProperties": { + "^[_a-zA-Z][a-zA-Z0-9_-]*$": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callsecretssecret_id", + "description": "A string identifier to associate with the secret.", + "properties": { + "description": { + "description": "A string description of the secret parameter.", + "type": "string" + }, + "required": { + "$comment": "https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callsecretssecret_idrequired", + "description": "A boolean specifying whether the secret must be supplied." + } + }, + "required": ["required"], + "additionalProperties": false + } + }, + "additionalProperties": false + } + } + }, + "workflow_dispatch": { + "$comment": "https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/", + "description": "You can now create workflows that are manually triggered with the new workflow_dispatch event. You will then see a 'Run workflow' button on the Actions tab, enabling you to easily trigger a run.", + "properties": { + "inputs": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputs", + "description": "Input parameters allow you to specify data that the action expects to use during runtime. GitHub stores input parameters as environment variables. Input ids with uppercase letters are converted to lowercase during runtime. We recommended using lowercase input ids.", + "type": "object", + "patternProperties": { + "^[_a-zA-Z][a-zA-Z0-9_-]*$": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputsinput_id", + "description": "A string identifier to associate with the input. The value of is a map of the input's metadata. The must be a unique identifier within the inputs object. The must start with a letter or _ and contain only alphanumeric characters, -, or _.", + "type": "object", + "properties": { + "description": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputsinput_iddescription", + "description": "A string description of the input parameter.", + "type": "string" + }, + "deprecationMessage": { + "description": "A string shown to users using the deprecated input.", + "type": "string" + }, + "required": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputsinput_idrequired", + "description": "A boolean to indicate whether the action requires the input parameter. Set to true when the parameter is required.", + "type": "boolean" + }, + "default": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#inputsinput_iddefault", + "description": "A string representing the default value. The default value is used when an input parameter isn't specified in a workflow file." + }, + "type": { + "description": "A string representing the type of the input.", + "type": "string", + "enum": ["string", "choice", "boolean", "environment"] + }, + "options": { + "$comment": "https://github.blog/changelog/2021-11-10-github-actions-input-types-for-manual-workflows", + "description": "The options of the dropdown list, if the type is a choice.", + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + }, + "allOf": [ + { + "if": { + "properties": { + "type": { + "const": "boolean" + } + }, + "required": ["type"] + }, + "then": { + "properties": { + "default": { + "type": "boolean" + } + } + }, + "else": { + "properties": { + "default": { + "type": "string" + } + } + } + }, + { + "if": { + "properties": { + "type": { + "const": "choice" + } + }, + "required": ["type"] + }, + "then": { + "required": ["options"] + } + } + ], + "required": ["description", "required"], + "additionalProperties": false + } + }, + "additionalProperties": false + } + } + }, + "workflow_run": { + "$comment": "https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run", + "$ref": "#/definitions/eventObject", + "description": "This event occurs when a workflow run is requested or completed, and allows you to execute a workflow based on the finished result of another workflow. For example, if your pull_request workflow generates build artifacts, you can create a new workflow that uses workflow_run to analyze the results and add a comment to the original pull request.", + "properties": { + "types": { + "$ref": "#/definitions/types", + "items": { + "type": "string", + "enum": ["requested", "completed"] + }, + "default": ["requested", "completed"] + }, + "workflows": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + }, + "patternProperties": { + "^branches(-ignore)?$": {} + } + }, + "repository_dispatch": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#external-events-repository_dispatch", + "$ref": "#/definitions/eventObject", + "description": "You can use the GitHub API to trigger a webhook event called repository_dispatch when you want to trigger a workflow for activity that happens outside of GitHub. For more information, see https://developer.github.com/v3/repos/#create-a-repository-dispatch-event.\nTo trigger the custom repository_dispatch webhook event, you must send a POST request to a GitHub API endpoint and provide an event_type name to describe the activity type. To trigger a workflow run, you must also configure your workflow to use the repository_dispatch event." + }, + "schedule": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#scheduled-events-schedule", + "description": "You can schedule a workflow to run at specific UTC times using POSIX cron syntax (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07). Scheduled workflows run on the latest commit on the default or base branch. The shortest interval you can run scheduled workflows is once every 5 minutes.\nNote: GitHub Actions does not support the non-standard syntax @yearly, @monthly, @weekly, @daily, @hourly, and @reboot.\nYou can use crontab guru (https://crontab.guru/). to help generate your cron syntax and confirm what time it will run. To help you get started, there is also a list of crontab guru examples (https://crontab.guru/examples.html).", + "type": "array", + "items": { + "properties": { + "cron": { + "$comment": "https://stackoverflow.com/a/57639657/4044345", + "type": "string", + "pattern": "^(((\\d+,)+\\d+|((\\d+|\\*)/\\d+|((JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(-(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?))|(\\d+-\\d+)|\\d+|\\*|((MON|TUE|WED|THU|FRI|SAT|SUN)(-(MON|TUE|WED|THU|FRI|SAT|SUN))?)) ?){5}$" + } + }, + "additionalProperties": false + }, + "minItems": 1 + } + }, + "additionalProperties": false + } + ] + }, + "env": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#env", + "$ref": "#/definitions/env", + "description": "A map of environment variables that are available to all jobs and steps in the workflow." + }, + "defaults": { + "$comment": "https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults", + "$ref": "#/definitions/defaults", + "description": "A map of default settings that will apply to all jobs in the workflow." + }, + "concurrency": { + "$comment": "https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency", + "description": "Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the secrets context. \nYou can also specify concurrency at the workflow level. \nWhen a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow in the same concurrency group, specify cancel-in-progress: true.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/concurrency" + } + ] + }, + "jobs": { + "$comment": "https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobs", + "description": "A workflow run is made up of one or more jobs. Jobs run in parallel by default. To run jobs sequentially, you can define dependencies on other jobs using the jobs..needs keyword.\nEach job runs in a fresh instance of the virtual environment specified by runs-on.\nYou can run an unlimited number of jobs as long as you are within the workflow usage limits. For more information, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#usage-limits.", + "type": "object", + "patternProperties": { + "^[_a-zA-Z][a-zA-Z0-9_-]*$": { + "oneOf": [ + { + "$ref": "#/definitions/normalJob" + }, + { + "$ref": "#/definitions/reusableWorkflowCallJob" + } + ] + } + }, + "minProperties": 1, + "additionalProperties": false + }, + "permissions": { + "$ref": "#/definitions/permissions" + } + }, + "required": ["on", "jobs"], + "type": "object" +} diff --git a/__tests__/helpers/jest.matchers.ts b/__tests__/helpers/jest.matchers.ts new file mode 100644 index 000000000..f79f8f843 --- /dev/null +++ b/__tests__/helpers/jest.matchers.ts @@ -0,0 +1,54 @@ +import type { AnySchema } from 'ajv'; + +import betterAjvErrors from '@readme/better-ajv-errors'; +import Ajv from 'ajv'; +import jsYaml from 'js-yaml'; + +interface CustomMatchers { + /** + * Ensures that the expected YAML conforms to the given JSON Schema. + */ + toBeValidSchema(schema: unknown): R; +} + +declare global { + // eslint-disable-next-line @typescript-eslint/no-namespace + namespace jest { + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Matchers extends CustomMatchers {} + } +} + +export default function toBeValidSchema( + this: jest.MatcherUtils, + /** The input YAML, as a string */ + yaml: string, + /** The JSON schema file */ + schema: AnySchema +): { message: () => string; pass: boolean } { + const ajv = new Ajv({ strictTypes: false, strictTuples: false }); + + const data = jsYaml.load(yaml); + + const validate = ajv.compile(schema); + const valid = validate(data); + + if (!valid) { + let output = 'expected YAML to be valid'; + + if (validate.errors) + output = `${output}, here's the validation error\n\n${betterAjvErrors(schema, data, validate.errors)}`; + + return { + message: () => output, + pass: false, + }; + } + + return { + message: () => 'expected YAML to be invalid', + pass: true, + }; +} + +expect.extend({ toBeValidSchema }); diff --git a/__tests__/index.test.ts b/__tests__/index.test.ts index ca3cb8bea..7e8099221 100644 --- a/__tests__/index.test.ts +++ b/__tests__/index.test.ts @@ -1,9 +1,13 @@ import nock from 'nock'; +import prompts from 'prompts'; import { version } from '../package.json'; import cli from '../src'; import conf from '../src/lib/configstore'; +import getAPIMock from './helpers/get-api-mock'; +import { after, before } from './helpers/get-gha-setup'; + describe('cli', () => { it('command not found', async () => { await expect(cli(['no-such-command'])).rejects.toThrow('Command not found'); @@ -116,4 +120,50 @@ describe('cli', () => { it('should error with `rdme oas` arguments passed in', async () => { await expect(cli(['oas', 'endpoint'])).rejects.toThrow(/.*/); }); + + describe('GHA onboarding via @supportsGHA decorator', () => { + let consoleInfoSpy; + const key = '123'; + const slug = 'new-doc'; + + beforeEach(() => { + before(() => true); + consoleInfoSpy = jest.spyOn(console, 'info').mockImplementation(); + }); + + afterEach(() => { + after(); + consoleInfoSpy.mockRestore(); + }); + + const getCommandOutput = () => { + return [consoleInfoSpy.mock.calls.join('\n\n')].filter(Boolean).join('\n\n'); + }; + + it.each([ + ['changelogs', 'changelogs', ''], + ['changelogs:single', 'changelogs', `${slug}.md`], + ['custompages', 'custompages', ''], + ['custompages:single', 'custompages', `${slug}.md`], + ])('should run GHA workflow for the %s command', async (cmd, type, file) => { + expect.assertions(3); + prompts.inject([false]); + + const getMock = getAPIMock().get(`/api/v1/${type}/${slug}`).basicAuth({ user: key }).reply(404, {}); + + await expect( + cli([cmd, '--dryRun', `--key=${key}`, `__tests__/__fixtures__/${type}/new-docs/${file}`]) + ).rejects.toStrictEqual( + new Error( + 'GitHub Actions workflow creation cancelled. If you ever change your mind, you can run this command again with the `--github` flag.' + ) + ); + + const output = getCommandOutput(); + expect(output).toMatch(`dry run! This will create '${slug}'`); + expect(output).toMatch("Looks like you're running this command in a GitHub Repository!"); + + getMock.done(); + }); + }); }); diff --git a/__tests__/lib/__snapshots__/createGHA.test.ts.snap b/__tests__/lib/__snapshots__/createGHA.test.ts.snap new file mode 100644 index 000000000..4593ef6eb --- /dev/null +++ b/__tests__/lib/__snapshots__/createGHA.test.ts.snap @@ -0,0 +1,649 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`#createGHA command inputs changelogs should run GHA creation workflow and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-changelogs.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs changelogs should run GHA creation workflow and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`some-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - some-branch + +jobs: + rdme-changelogs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`changelogs\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: changelogs ./changelogs --key=\${{ secrets.README_API_KEY }} +" +`; + +exports[`#createGHA command inputs changelogs should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-changelogs-with-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs changelogs should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`another-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - another-branch + +jobs: + rdme-changelogs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`changelogs\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: changelogs ./changelogs --key=\${{ secrets.README_API_KEY }} +" +`; + +exports[`#createGHA command inputs changelogs:single should run GHA creation workflow and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-changelogs-single.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs changelogs:single should run GHA creation workflow and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`some-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - some-branch + +jobs: + rdme-changelogs-single: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`changelogs:single\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: changelogs:single ./changelogs/rdme.md --key=\${{ secrets.README_API_KEY }} +" +`; + +exports[`#createGHA command inputs changelogs:single should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-changelogs-single-with-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs changelogs:single should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`another-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - another-branch + +jobs: + rdme-changelogs-single: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`changelogs:single\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: changelogs:single ./changelogs/rdme.md --key=\${{ secrets.README_API_KEY }} +" +`; + +exports[`#createGHA command inputs custompages should run GHA creation workflow and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-custompages.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs custompages should run GHA creation workflow and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`some-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - some-branch + +jobs: + rdme-custompages: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`custompages\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: custompages ./custompages --key=\${{ secrets.README_API_KEY }} +" +`; + +exports[`#createGHA command inputs custompages should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-custompages-with-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs custompages should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`another-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - another-branch + +jobs: + rdme-custompages: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`custompages\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: custompages ./custompages --key=\${{ secrets.README_API_KEY }} +" +`; + +exports[`#createGHA command inputs custompages:single should run GHA creation workflow and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-custompages-single.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs custompages:single should run GHA creation workflow and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`some-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - some-branch + +jobs: + rdme-custompages-single: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`custompages:single\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: custompages:single ./custompages/rdme.md --key=\${{ secrets.README_API_KEY }} +" +`; + +exports[`#createGHA command inputs custompages:single should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-custompages-single-with-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs custompages:single should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`another-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - another-branch + +jobs: + rdme-custompages-single: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`custompages:single\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: custompages:single ./custompages/rdme.md --key=\${{ secrets.README_API_KEY }} +" +`; + +exports[`#createGHA command inputs docs should run GHA creation workflow and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-docs.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs docs should run GHA creation workflow and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`some-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - some-branch + +jobs: + rdme-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`docs\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: docs ./docs --key=\${{ secrets.README_API_KEY }} --version=1.0.0 +" +`; + +exports[`#createGHA command inputs docs should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-docs-with-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs docs should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`another-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - another-branch + +jobs: + rdme-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`docs\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: docs ./docs --key=\${{ secrets.README_API_KEY }} --version=1.0.0 +" +`; + +exports[`#createGHA command inputs docs:single should run GHA creation workflow and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-docs-single.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs docs:single should run GHA creation workflow and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`some-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - some-branch + +jobs: + rdme-docs-single: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`docs:single\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: docs:single ./docs/rdme.md --key=\${{ secrets.README_API_KEY }} --version=1.0.0 +" +`; + +exports[`#createGHA command inputs docs:single should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-docs-single-with-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs docs:single should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`another-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - another-branch + +jobs: + rdme-docs-single: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`docs:single\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: docs:single ./docs/rdme.md --key=\${{ secrets.README_API_KEY }} --version=1.0.0 +" +`; + +exports[`#createGHA command inputs openapi should run GHA creation workflow and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-openapi.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs openapi should run GHA creation workflow and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`some-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - some-branch + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi petstore.json --key=\${{ secrets.README_API_KEY }} --id=spec_id +" +`; + +exports[`#createGHA command inputs openapi should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Just a couple more steps: +1. Push your newly created file (.github/workflows/rdme-openapi-with-github-flag.yml) to GitHub 🚀 +2. Create a GitHub secret called README_API_KEY and populate the value with your ReadMe API key (••••••••••••I_KEY) 🔑 + +🔐 Check out GitHub's docs for more info on creating encrypted secrets (https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs openapi should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`another-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - another-branch + +jobs: + rdme-openapi: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`openapi\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: openapi petstore.json --key=\${{ secrets.README_API_KEY }} --id=spec_id +" +`; + +exports[`#createGHA command inputs validate should run GHA creation workflow and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Push your newly created file (.github/workflows/rdme-validate.yml) to GitHub and you're all set 🚀 + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs validate should run GHA creation workflow and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`some-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - some-branch + +jobs: + rdme-validate: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`validate\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: validate petstore.json +" +`; + +exports[`#createGHA command inputs validate should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 1`] = ` +" +Your GitHub Actions workflow file has been created! ✨ + +Almost done! Push your newly created file (.github/workflows/rdme-validate-with-github-flag.yml) to GitHub and you're all set 🚀 + +🦉 If you have any more questions, feel free to drop us a line! support@readme.io +" +`; + +exports[`#createGHA command inputs validate should run GHA creation workflow with \`--github\` flag and messy file name and generate valid workflow file 2`] = ` +"# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on 2022-01-01T00:00:00.000Z +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`another-branch\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - another-branch + +jobs: + rdme-validate: + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`validate\` command 🚀 + uses: readmeio/rdme@7.8.9 + with: + rdme: validate petstore.json +" +`; diff --git a/__tests__/lib/createGHA.test.ts b/__tests__/lib/createGHA.test.ts new file mode 100644 index 000000000..a2abc5bff --- /dev/null +++ b/__tests__/lib/createGHA.test.ts @@ -0,0 +1,261 @@ +/* eslint-disable no-console */ +import type commands from '../../src/cmds'; +import type { CommandOptions } from '../../src/lib/baseCommand'; +import type Command from '../../src/lib/baseCommand'; +import type { Response } from 'simple-git'; + +import fs from 'fs'; + +import prompts from 'prompts'; + +import ChangelogsCommand from '../../src/cmds/changelogs'; +import SingleChangelogCommand from '../../src/cmds/changelogs/single'; +import CustomPagesCommand from '../../src/cmds/custompages'; +import SingleCustomPageCommand from '../../src/cmds/custompages/single'; +import DocsCommand from '../../src/cmds/docs'; +import SingleDocCommand from '../../src/cmds/docs/single'; +import OpenAPICommand from '../../src/cmds/openapi'; +import ValidateCommand from '../../src/cmds/validate'; +import configstore from '../../src/lib/configstore'; +import createGHA, { + getConfigStoreKey, + getGHAFileName, + getGitData, + git, + rdmeVersionMajor, +} from '../../src/lib/createGHA'; +import { after, before } from '../helpers/get-gha-setup'; +import getGitRemoteMock from '../helpers/get-git-mock'; +import ghaWorkflowSchema from '../helpers/github-workflow-schema.json'; +import '../helpers/jest.matchers'; + +const testWorkingDir = process.cwd(); + +let consoleInfoSpy; +const getCommandOutput = () => consoleInfoSpy.mock.calls.join('\n\n'); + +const key = 'API_KEY'; + +describe('#createGHA', () => { + let yamlOutput; + + beforeEach(() => { + consoleInfoSpy = jest.spyOn(console, 'info').mockImplementation(); + + before((fileName, data) => { + yamlOutput = data; + }); + }); + + afterEach(() => { + after(); + + consoleInfoSpy.mockRestore(); + process.chdir(testWorkingDir); + }); + + describe('command inputs', () => { + describe.each<{ + cmd: keyof typeof commands; + CmdClass: typeof Command; + opts: CommandOptions>; + }>([ + { cmd: 'validate', CmdClass: ValidateCommand, opts: { spec: 'petstore.json' } }, + { cmd: 'openapi', CmdClass: OpenAPICommand, opts: { key, spec: 'petstore.json', id: 'spec_id' } }, + { cmd: 'docs', CmdClass: DocsCommand, opts: { key, folder: './docs', version: '1.0.0' } }, + { cmd: 'docs:single', CmdClass: SingleDocCommand, opts: { key, filePath: './docs/rdme.md', version: '1.0.0' } }, + { cmd: 'changelogs', CmdClass: ChangelogsCommand, opts: { key, folder: './changelogs' } }, + { cmd: 'changelogs:single', CmdClass: SingleChangelogCommand, opts: { key, filePath: './changelogs/rdme.md' } }, + { cmd: 'custompages', CmdClass: CustomPagesCommand, opts: { key, folder: './custompages' } }, + { + cmd: 'custompages:single', + CmdClass: SingleCustomPageCommand, + opts: { key, filePath: './custompages/rdme.md' }, + }, + ])('$cmd', ({ cmd, CmdClass, opts }) => { + let command; + + beforeEach(() => { + command = new CmdClass(); + }); + + it('should run GHA creation workflow and generate valid workflow file', async () => { + expect.assertions(6); + const fileName = `rdme-${cmd}`; + prompts.inject([true, 'some-branch', fileName]); + + await expect(createGHA('', cmd, command.args, opts)).resolves.toMatchSnapshot(); + + expect(yamlOutput).toBeValidSchema(ghaWorkflowSchema); + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(getGHAFileName(fileName), expect.any(String)); + expect(console.info).toHaveBeenCalledTimes(1); + const output = getCommandOutput(); + expect(output).toMatch("Looks like you're running this command in a GitHub Repository!"); + }); + + it('should run GHA creation workflow with `--github` flag and messy file name and generate valid workflow file', async () => { + expect.assertions(4); + const fileName = `rdme-${cmd} with GitHub flag`; + prompts.inject(['another-branch', fileName]); + + await expect(createGHA('', cmd, command.args, { ...opts, github: true })).resolves.toMatchSnapshot(); + + expect(yamlOutput).toBeValidSchema(ghaWorkflowSchema); + expect(yamlOutput).toMatchSnapshot(); + expect(fs.writeFileSync).toHaveBeenCalledWith(getGHAFileName(fileName), expect.any(String)); + }); + + it('should create workflow directory if it does not exist', async () => { + expect.assertions(3); + const repoRoot = '__tests__/__fixtures__'; + + git.revparse = jest.fn(() => { + return Promise.resolve(repoRoot) as unknown as Response; + }); + + const fileName = `rdme-${cmd}`; + prompts.inject([true, 'some-branch', fileName]); + + fs.mkdirSync = jest.fn(() => { + return ''; + }); + + await expect(createGHA('', cmd, command.args, opts)).resolves.toBeTruthy(); + + expect(fs.mkdirSync).toHaveBeenCalledWith('.github/workflows', { recursive: true }); + expect(fs.writeFileSync).toHaveBeenCalledWith(getGHAFileName(fileName), expect.any(String)); + }); + + it('should run if user is on an outdated package version', () => { + const fileName = `rdme-${cmd}`; + prompts.inject([true, 'some-branch', fileName]); + + const repoRoot = process.cwd(); + + configstore.set(getConfigStoreKey(repoRoot), rdmeVersionMajor - 1); + + return expect(createGHA('', cmd, command.args, opts)).resolves.toMatch( + 'Your GitHub Actions workflow file has been created!' + ); + }); + + it('should set config and exit if user does not want to set up GHA', async () => { + expect.assertions(2); + prompts.inject([false]); + + const repoRoot = process.cwd(); + + git.revparse = jest.fn(() => { + return Promise.resolve(repoRoot) as unknown as Response; + }); + + await expect(createGHA('', cmd, command.args, opts)).rejects.toStrictEqual( + new Error( + 'GitHub Actions workflow creation cancelled. If you ever change your mind, you can run this command again with the `--github` flag.' + ) + ); + + expect(configstore.get(getConfigStoreKey(repoRoot))).toBe(rdmeVersionMajor); + }); + + it('should not run if not a repo', () => { + git.checkIsRepo = jest.fn(() => { + return Promise.reject(new Error('not a repo')) as unknown as Response; + }); + + git.remote = getGitRemoteMock('', '', ''); + + return expect(createGHA('success!', cmd, command.args, opts)).resolves.toBe('success!'); + }); + + it('should not run if user previously declined to set up GHA for current directory + pkg version', () => { + const repoRoot = process.cwd(); + + configstore.set(getConfigStoreKey(repoRoot), rdmeVersionMajor); + + return expect(createGHA('success!', cmd, command.args, opts)).resolves.toBe('success!'); + }); + + it('should not run if in a CI environment', async () => { + process.env.TEST_CI = 'true'; + await expect(createGHA('success!', cmd, command.args, opts)).resolves.toBe('success!'); + delete process.env.TEST_CI; + }); + + it('should not run if repo only contains non-GitHub remotes', () => { + git.remote = getGitRemoteMock('origin', 'https://gitlab.com', 'main'); + + return expect(createGHA('success!', cmd, command.args, opts)).resolves.toBe('success!'); + }); + }); + }); + + describe('helper functions', () => { + describe('#getGitData', () => { + it('should return correct data in default case', () => { + const repoRoot = '/someroot'; + + git.revparse = jest.fn(() => { + return Promise.resolve(repoRoot) as unknown as Response; + }); + + return expect(getGitData()).resolves.toStrictEqual({ + containsGitHubRemote: true, + containsNonGitHubRemote: false, + defaultBranch: 'main', + isRepo: true, + repoRoot, + }); + }); + + it('should return empty repoRoot if function fails', () => { + git.revparse = jest.fn(() => { + return Promise.reject(new Error('some error')) as unknown as Response; + }); + + return expect(getGitData()).resolves.toStrictEqual({ + containsGitHubRemote: true, + containsNonGitHubRemote: false, + defaultBranch: 'main', + isRepo: true, + repoRoot: '', + }); + }); + + it('should still return values if every git check fails', () => { + git.remote = getGitRemoteMock('', '', ''); + + git.checkIsRepo = jest.fn(() => { + return Promise.reject(new Error('some error')) as unknown as Response; + }); + + git.revparse = jest.fn(() => { + return Promise.reject(new Error('some error')) as unknown as Response; + }); + + return expect(getGitData()).resolves.toStrictEqual({ + containsGitHubRemote: undefined, + containsNonGitHubRemote: undefined, + defaultBranch: undefined, + isRepo: false, + repoRoot: '', + }); + }); + }); + + describe('#getGHAFileName', () => { + it('should return cleaned up file name', () => { + expect(getGHAFileName('test')).toBe('.github/workflows/test.yml'); + }); + + it('should lowercase and remove whitespace', () => { + expect(getGHAFileName('Hello World')).toBe('.github/workflows/hello-world.yml'); + }); + + it('should clean up weird characters', () => { + expect(getGHAFileName('Hello_World-Test*Ex@mple!')).toBe('.github/workflows/hello-world-test-ex-mple-.yml'); + }); + }); + }); +}); diff --git a/documentation/legacy-github-action.md b/documentation/legacy-github-action.md index 62cf00a37..568103020 100644 --- a/documentation/legacy-github-action.md +++ b/documentation/legacy-github-action.md @@ -112,7 +112,7 @@ If you're seeing failures with the GitHub Action and need to troubleshoot the is > 🚧 Debug Logs May Contain Sensitive Information > -> Enabling [Step Debug Logs](https://github.com/actions/toolkit/blob/main/docs/action-debugging.md#step-debug-logs) will produce comprehensive logging for **all** of your GitHub Action workflows. While we sanitize all logging output to prevent API keys from being visible, the logs may contain other sensitive information (from ReadMe and any other services that you use). Anybody with read access to the repository will be able to see these logs. +> Enabling [Step Debug Logs](https://github.com/actions/toolkit/blob/main/docs/action-debugging.md#step-debug-logs) will produce comprehensive logging for **all** of your GitHub Actions workflows. While we sanitize all logging output to prevent API keys from being visible, the logs may contain other sensitive information (from ReadMe and any other services that you use). Anybody with read access to the repository will be able to see these logs. > > We **strongly recommend** that you only enable this setting in private repositories. If working in a public repository, we suggest creating a separate private repository with your GitHub workflow and OpenAPI/Swagger files before enabling this debugger. > diff --git a/documentation/rdme.md b/documentation/rdme.md index a9506cc16..a9f011c41 100644 --- a/documentation/rdme.md +++ b/documentation/rdme.md @@ -205,7 +205,7 @@ In the example above, every push to the `main` branch will check out your reposi Not to get too meta on you, but... the page that you're currently reading is actually being synced from the `rdme` GitHub repository via the `rdme` GitHub Action! Here are the relevant files on GitHub: - [The Markdown source file for the page you're reading](https://github.com/readmeio/rdme/blob/main/documentation/rdme.md) 📜 -- [The GitHub Action workflow file that syncs the Markdown to docs.readme.com](https://github.com/readmeio/rdme/blob/main/.github/workflows/docs.yml) 🔄 +- [The GitHub Actions workflow file that syncs the Markdown to docs.readme.com](https://github.com/readmeio/rdme/blob/main/.github/workflows/docs.yml) 🔄 - And finally... [the workflow run results](https://github.com/readmeio/rdme/actions/workflows/docs.yml) ✅ To recreate this magic in your repository, your GitHub Workflow file will look something like this: @@ -305,7 +305,7 @@ If you're troubleshooting issues in a GitHub Actions environment, you can enable > 🚧 Debug Logs May Contain Sensitive Information > -> Enabling step debug logs will produce comprehensive logging for **all** of your GitHub Action workflow steps. While GitHub automatically masks any sensitive information you load in with [secrets](#example-using-github-secrets), there might be other sensitive information that's exposed. Anybody with read access to the repository will be able to see these logs. +> Enabling step debug logs will produce comprehensive logging for **all** of your GitHub Actions workflow steps. While GitHub automatically masks any sensitive information you load in with [secrets](#example-using-github-secrets), there might be other sensitive information that's exposed. Anybody with read access to the repository will be able to see these logs. > > We **strongly recommend** that you only enable step debug logs in private repositories. If working in a public repository, we suggest recreating your GitHub workflow setup (e.g. with your GitHub workflow files, OpenAPI definitions, and anything else you need for syncing to ReadMe) in a separate private repository for testing purposes before enabling this setting. > diff --git a/package-lock.json b/package-lock.json index 1a8d9f316..d9f33b380 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "editor": "^1.0.0", "form-data": "^4.0.0", "gray-matter": "^4.0.1", + "hercule": "^5.1.3", "ignore": "^5.2.0", "jsonpath": "^1.1.1", "mime-types": "^2.1.35", @@ -32,6 +33,7 @@ "parse-link-header": "^2.0.0", "prompts": "^2.4.2", "semver": "^7.0.0", + "simple-git": "^3.13.0", "tmp-promise": "^3.0.2", "update-notifier": "^5.1.0", "validator": "^13.7.0" @@ -40,6 +42,7 @@ "rdme": "bin/rdme" }, "devDependencies": { + "@readme/better-ajv-errors": "^1.5.0", "@readme/eslint-config": "^10.1.0", "@readme/oas-examples": "^5.3.0", "@types/cli-table": "^0.3.0", @@ -57,10 +60,12 @@ "@types/tmp": "^0.2.3", "@types/update-notifier": "^6.0.1", "@types/validator": "^13.7.6", + "ajv": "^8.11.0", "alex": "^10.0.0", "eslint": "^8.23.0", "jest": "^28.1.1", "jest-extended": "^3.0.0", + "js-yaml": "^4.1.0", "nock": "^13.2.7", "prettier": "^2.7.1", "ts-jest": "^28.0.8", @@ -747,24 +752,28 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@eslint/eslintrc/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/@eslint/eslintrc/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "node_modules/@eslint/eslintrc/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "dependencies": { - "argparse": "^2.0.1" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, "node_modules/@exodus/schemasafe": { "version": "1.0.0-rc.6", "resolved": "https://registry.npmjs.org/@exodus/schemasafe/-/schemasafe-1.0.0-rc.6.tgz", @@ -837,6 +846,15 @@ "node": ">=8" } }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -850,6 +868,19 @@ "node": ">=8" } }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -1293,6 +1324,19 @@ "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" }, + "node_modules/@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "dependencies": { + "debug": "^4.1.1" + } + }, + "node_modules/@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1427,22 +1471,6 @@ "js-yaml": "^4.1.0" } }, - "node_modules/@readme/json-schema-ref-parser/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/@readme/json-schema-ref-parser/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/@readme/oas-examples": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@readme/oas-examples/-/oas-examples-5.5.0.tgz", @@ -1470,21 +1498,6 @@ "openapi-types": ">=7" } }, - "node_modules/@readme/openapi-parser/node_modules/ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/@readme/openapi-parser/node_modules/ajv-draft-04": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", @@ -1498,11 +1511,6 @@ } } }, - "node_modules/@readme/openapi-parser/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - }, "node_modules/@sinclair/typebox": { "version": "0.24.22", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.22.tgz", @@ -1654,6 +1662,17 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/cacheable-request": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz", + "integrity": "sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==", + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "*", + "@types/node": "*", + "@types/responselike": "*" + } + }, "node_modules/@types/cli-table": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@types/cli-table/-/cli-table-0.3.0.tgz", @@ -1735,6 +1754,11 @@ "@types/unist": "*" } }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + }, "node_modules/@types/is-empty": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@types/is-empty/-/is-empty-1.2.1.tgz", @@ -1814,6 +1838,11 @@ "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==", "dev": true }, + "node_modules/@types/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha512-3YP80IxxFJB4b5tYC2SUPwkg0XQLiu0nWvhRgEatgjf+29IcWO9X1k8xRv5DGssJ/lCrjYTjQPcobJr2yWIVuQ==" + }, "node_modules/@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -1831,6 +1860,14 @@ "integrity": "sha512-v7qlPA0VpKUlEdhghbDqRoKMxFB3h3Ch688TApBJ6v+XLDdvWCGLJIYiPKGZnS6MAOie+IorCfNYVHOPIHSWwQ==", "dev": true }, + "node_modules/@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/mdast": { "version": "3.0.10", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz", @@ -1849,8 +1886,7 @@ "node_modules/@types/minimist": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", - "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", - "dev": true + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==" }, "node_modules/@types/ms": { "version": "0.7.31", @@ -1870,8 +1906,7 @@ "node_modules/@types/node": { "version": "17.0.21", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz", - "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==", - "dev": true + "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==" }, "node_modules/@types/node-fetch": { "version": "2.6.2", @@ -1900,8 +1935,7 @@ "node_modules/@types/normalize-package-data": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", - "dev": true + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==" }, "node_modules/@types/npmcli__ci-detect": { "version": "2.0.0", @@ -1936,6 +1970,14 @@ "@types/node": "*" } }, + "node_modules/@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/semver": { "version": "7.3.12", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", @@ -2365,13 +2407,13 @@ } }, "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "dependencies": { "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", "uri-js": "^4.2.2" }, "funding": { @@ -2494,12 +2536,9 @@ "dev": true }, "node_modules/argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "dependencies": { - "sprintf-js": "~1.0.2" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/aria-query": { "version": "4.2.2", @@ -2616,7 +2655,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -2627,6 +2665,11 @@ "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=", "dev": true }, + "node_modules/async": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -2997,6 +3040,14 @@ "semver": "^7.0.0" } }, + "node_modules/cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "engines": { + "node": ">=10.6.0" + } + }, "node_modules/cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -3066,7 +3117,6 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, "engines": { "node": ">=6" } @@ -3322,6 +3372,17 @@ "node": ">=0.8" } }, + "node_modules/clone-regexp": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", + "integrity": "sha512-beMpP7BOtTipFuW8hrJvREQ2DrRu3BE7by0ZpibtfBA+qfHYvMGTc2Yb1JMYPKg/JUw0CHYvpg796aNTSW9z7Q==", + "dependencies": { + "is-regexp": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", @@ -3516,6 +3577,23 @@ "lodash": "^4.17.11" } }, + "node_modules/compress-brotli": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/compress-brotli/-/compress-brotli-1.3.8.tgz", + "integrity": "sha512-lVcQsjhxhIXsuupfy9fmZUFtAIdBmXA7EGY6GBdgZ++qkM9zG4YFT8iU7FoBxzryNDMOpD1HIFHUSX4D87oqhQ==", + "dependencies": { + "@types/json-buffer": "~3.0.0", + "json-buffer": "~3.0.1" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/compress-brotli/node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, "node_modules/compute-gcd": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/compute-gcd/-/compute-gcd-1.2.1.tgz", @@ -3744,7 +3822,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", - "dev": true, "dependencies": { "decamelize": "^1.1.0", "map-obj": "^1.0.0" @@ -3757,7 +3834,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -3766,7 +3842,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -4013,7 +4088,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, "dependencies": { "is-arrayish": "^0.2.1" } @@ -4967,11 +5041,21 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/eslint/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "node_modules/eslint/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", @@ -5026,17 +5110,11 @@ "node": ">=10.13.0" } }, - "node_modules/eslint/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } + "node_modules/eslint/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "node_modules/eslint/node_modules/levn": { "version": "0.4.1", @@ -5361,7 +5439,8 @@ "node_modules/fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -5840,11 +5919,30 @@ "node": ">=6.0" } }, + "node_modules/gray-matter/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/gray-matter/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true, "engines": { "node": ">=6" } @@ -6104,11 +6202,352 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hercule": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/hercule/-/hercule-5.1.3.tgz", + "integrity": "sha512-QJTwaxXfSheCySt3nyPCOE0c2jFWivDjcqEZ7f3TNBX+SkIhGRimdIiaD9vwAGSLetNpQw2MtK4d8BlDe3wdpw==", + "dependencies": { + "async": "^3.2.0", + "clone-regexp": "^2.1.0", + "duplexer3": "^0.1.4", + "get-stream": "^5.0.0", + "got": "^11.1.4", + "isstream": "^0.1.2", + "left-split": "^1.0.0", + "lodash": "^4.0.0", + "meow": "^7.0.1", + "source-map": "^0.7.0", + "through2": "^4.0.2", + "through2-get": "^1.0.0" + }, + "bin": { + "hercule": "bin/hercule" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/hercule/node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/hercule/node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/hercule/node_modules/cacheable-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/hercule/node_modules/camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hercule/node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/hercule/node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hercule/node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "engines": { + "node": ">=10" + } + }, + "node_modules/hercule/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hercule/node_modules/got": { + "version": "11.8.5", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.5.tgz", + "integrity": "sha512-o0Je4NvQObAuZPHLFoRSkdG2lTgtcynqymzg2Vupdx6PorhaT5MCbIyXG6d4D94kk8ZG57QeosgdiqfJWhEhlQ==", + "dependencies": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/hercule/node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, + "node_modules/hercule/node_modules/keyv": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.3.3.tgz", + "integrity": "sha512-AcysI17RvakTh8ir03+a3zJr5r0ovnAH/XTXei/4HIv3bL2K/jzvgivLK9UuI/JbU1aJjM3NSAnVvVVd3n+4DQ==", + "dependencies": { + "compress-brotli": "^1.3.8", + "json-buffer": "3.0.1" + } + }, + "node_modules/hercule/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/hercule/node_modules/meow": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-7.1.1.tgz", + "integrity": "sha512-GWHvA5QOcS412WCo8vwKDlTelGLsCGBVevQB5Kva961rmNfun0PCbv5+xta2kUMFJyR8/oWnn7ddeKdosbAPbA==", + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^2.5.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.13.1", + "yargs-parser": "^18.1.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hercule/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hercule/node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hercule/node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/hercule/node_modules/quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "engines": { + "node": ">=8" + } + }, + "node_modules/hercule/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/hercule/node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/hercule/node_modules/responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "dependencies": { + "lowercase-keys": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hercule/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/hercule/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/hercule/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/hercule/node_modules/through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dependencies": { + "readable-stream": "3" + } + }, + "node_modules/hercule/node_modules/trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/hercule/node_modules/type-fest": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hercule/node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" }, "node_modules/html-escaper": { "version": "2.0.2", @@ -6126,6 +6565,18 @@ "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz", "integrity": "sha512-EC2utToWl4RKfs5zd36Mxq7nzHHBuomZboI0yYL6Y0RmBgT7Sgkq4rQ0ezFTYoIsSs7Tm9SJe+o2FcAg6GBhGA==" }, + "node_modules/http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -6241,7 +6692,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true, "engines": { "node": ">=8" } @@ -6348,8 +6798,7 @@ "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" }, "node_modules/is-bigint": { "version": "1.0.4", @@ -6446,7 +6895,6 @@ "version": "2.9.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", - "dev": true, "dependencies": { "has": "^1.0.3" }, @@ -6644,7 +7092,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -6669,6 +7116,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-regexp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-2.1.0.tgz", + "integrity": "sha512-OZ4IlER3zmRIoB9AqNhEggVxqIH4ofDns5nRrPS6yQxXE1TPCUpFznBfRQmQa8uC+pXqjMnukiJBxCisIxiLGA==", + "engines": { + "node": ">=6" + } + }, "node_modules/is-set": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", @@ -6783,6 +7238,11 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -7883,12 +8343,11 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" @@ -7923,8 +8382,7 @@ "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "node_modules/json-schema-compare": { "version": "0.2.2", @@ -7948,9 +8406,9 @@ } }, "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -8103,6 +8561,11 @@ "node": ">=8" } }, + "node_modules/left-split": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/left-split/-/left-split-1.0.0.tgz", + "integrity": "sha512-AfIX+mnfzPET5Ipi9+EA1cdmYJqXNZAD6+8DVs0BavnqraKgIeLOyVZ3Bnz/+3t3GfS0A4Bz3TrH08zPHllxqw==" + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -8227,8 +8690,7 @@ "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "node_modules/load-plugin": { "version": "4.0.1", @@ -8399,7 +8861,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, "engines": { "node": ">=8" }, @@ -9682,7 +10143,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true, "engines": { "node": ">=4" } @@ -9707,7 +10167,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, "dependencies": { "arrify": "^1.0.1", "is-plain-obj": "^1.1.0", @@ -9905,7 +10364,6 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -9917,7 +10375,6 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, "bin": { "semver": "bin/semver" } @@ -10016,22 +10473,6 @@ "node": ">=14" } }, - "node_modules/oas-normalize/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/oas-normalize/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/oas-resolver": { "version": "2.5.6", "resolved": "https://registry.npmjs.org/oas-resolver/-/oas-resolver-2.5.6.tgz", @@ -10430,7 +10871,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -10487,7 +10927,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, "engines": { "node": ">=8" } @@ -10512,8 +10951,7 @@ "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-to-regexp": { "version": "6.2.1", @@ -10860,7 +11298,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "dev": true, "engines": { "node": ">=10" }, @@ -10926,7 +11363,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, "dependencies": { "@types/normalize-package-data": "^2.4.0", "normalize-package-data": "^2.5.0", @@ -10941,7 +11377,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, "dependencies": { "find-up": "^4.1.0", "read-pkg": "^5.2.0", @@ -10958,7 +11393,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -10971,7 +11405,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, "dependencies": { "p-locate": "^4.1.0" }, @@ -10983,7 +11416,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, "dependencies": { "p-try": "^2.0.0" }, @@ -10998,7 +11430,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, "dependencies": { "p-limit": "^2.2.0" }, @@ -11010,7 +11441,6 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, "engines": { "node": ">=6" } @@ -11019,7 +11449,6 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true, "engines": { "node": ">=8" } @@ -11028,7 +11457,6 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true, "engines": { "node": ">=8" } @@ -11341,7 +11769,6 @@ "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", - "dev": true, "dependencies": { "is-core-module": "^2.8.1", "path-parse": "^1.0.7", @@ -11354,6 +11781,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" + }, "node_modules/resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -11712,6 +12144,20 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, + "node_modules/simple-git": { + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.13.0.tgz", + "integrity": "sha512-VYrs3joeHvWGcN3K135RpGpPjm4AHYeOrclwew6LlfHgq6ozQYIW2yMnmjf4PCgVOuSYCbXkdUjyiFawuJz8MA==", + "dependencies": { + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.3.4" + }, + "funding": { + "type": "github", + "url": "https://github.com/steveukx/git-js?sponsor=1" + } + }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -11823,7 +12269,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" @@ -11832,14 +12277,12 @@ "node_modules/spdx-exceptions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" @@ -11848,8 +12291,7 @@ "node_modules/spdx-license-ids": { "version": "3.0.11", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", - "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", - "dev": true + "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==" }, "node_modules/split": { "version": "0.2.10", @@ -11932,7 +12374,7 @@ "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "node_modules/stack-utils": { "version": "2.0.5", @@ -12104,7 +12546,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", - "dev": true, "dependencies": { "min-indent": "^1.0.0" }, @@ -12152,7 +12593,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -12178,22 +12618,6 @@ "node": ">=14" } }, - "node_modules/swagger-inline/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/swagger-inline/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/swagger2openapi": { "version": "7.0.8", "resolved": "https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-7.0.8.tgz", @@ -12324,6 +12748,66 @@ "xtend": "~4.0.0" } }, + "node_modules/through2-get": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/through2-get/-/through2-get-1.0.0.tgz", + "integrity": "sha512-RgpBU5A8JLAA6maOFZ0Cc6jIPuDFHqn6NBOwl/R8Ay/iFQnqrNslnrHm3HZpqA0upgpQKst4CvxUzusDrnjWAA==", + "dependencies": { + "lodash": "^4.17.20", + "through2": "^4.0.2" + }, + "engines": { + "node": ">=6.9" + } + }, + "node_modules/through2-get/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/through2-get/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/through2-get/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/through2-get/node_modules/through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dependencies": { + "readable-stream": "3" + } + }, "node_modules/timers-ext": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", @@ -12769,12 +13253,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/unified-engine/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, "node_modules/unified-engine/node_modules/is-plain-obj": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.0.0.tgz", @@ -12787,18 +13265,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/unified-engine/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/unified-engine/node_modules/lines-and-columns": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.3.tgz", @@ -13157,7 +13623,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" @@ -14112,20 +14577,23 @@ "strip-json-comments": "^3.1.1" }, "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "requires": { - "argparse": "^2.0.1" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true } } }, @@ -14181,6 +14649,15 @@ "resolve-from": "^5.0.0" }, "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -14191,6 +14668,16 @@ "path-exists": "^4.0.0" } }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -14540,6 +15027,19 @@ "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" }, + "@kwsites/file-exists": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", + "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", + "requires": { + "debug": "^4.1.1" + } + }, + "@kwsites/promise-deferred": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", + "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -14643,21 +15143,6 @@ "@types/json-schema": "^7.0.6", "call-me-maybe": "^1.0.1", "js-yaml": "^4.1.0" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "requires": { - "argparse": "^2.0.1" - } - } } }, "@readme/oas-examples": { @@ -14681,27 +15166,11 @@ "call-me-maybe": "^1.0.1" }, "dependencies": { - "ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, "ajv-draft-04": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", "requires": {} - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" } } }, @@ -14846,6 +15315,17 @@ "@babel/types": "^7.3.0" } }, + "@types/cacheable-request": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz", + "integrity": "sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==", + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "*", + "@types/node": "*", + "@types/responselike": "*" + } + }, "@types/cli-table": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@types/cli-table/-/cli-table-0.3.0.tgz", @@ -14927,6 +15407,11 @@ "@types/unist": "*" } }, + "@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + }, "@types/is-empty": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@types/is-empty/-/is-empty-1.2.1.tgz", @@ -14999,6 +15484,11 @@ "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==", "dev": true }, + "@types/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha512-3YP80IxxFJB4b5tYC2SUPwkg0XQLiu0nWvhRgEatgjf+29IcWO9X1k8xRv5DGssJ/lCrjYTjQPcobJr2yWIVuQ==" + }, "@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -15016,6 +15506,14 @@ "integrity": "sha512-v7qlPA0VpKUlEdhghbDqRoKMxFB3h3Ch688TApBJ6v+XLDdvWCGLJIYiPKGZnS6MAOie+IorCfNYVHOPIHSWwQ==", "dev": true }, + "@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "requires": { + "@types/node": "*" + } + }, "@types/mdast": { "version": "3.0.10", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz", @@ -15034,8 +15532,7 @@ "@types/minimist": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", - "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", - "dev": true + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==" }, "@types/ms": { "version": "0.7.31", @@ -15055,8 +15552,7 @@ "@types/node": { "version": "17.0.21", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz", - "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==", - "dev": true + "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==" }, "@types/node-fetch": { "version": "2.6.2", @@ -15084,8 +15580,7 @@ "@types/normalize-package-data": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", - "dev": true + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==" }, "@types/npmcli__ci-detect": { "version": "2.0.0", @@ -15120,6 +15615,14 @@ "@types/node": "*" } }, + "@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "requires": { + "@types/node": "*" + } + }, "@types/semver": { "version": "7.3.12", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.12.tgz", @@ -15391,13 +15894,13 @@ "dev": true }, "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", "requires": { "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", "uri-js": "^4.2.2" } }, @@ -15488,12 +15991,9 @@ "dev": true }, "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "requires": { - "sprintf-js": "~1.0.2" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "aria-query": { "version": "4.2.2", @@ -15572,8 +16072,7 @@ "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" }, "ast-types-flow": { "version": "0.0.7", @@ -15581,6 +16080,11 @@ "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=", "dev": true }, + "async": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -15833,6 +16337,11 @@ "semver": "^7.0.0" } }, + "cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==" + }, "cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -15885,8 +16394,7 @@ "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, "camelcase-keys": { "version": "7.0.2", @@ -16053,6 +16561,14 @@ "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==" }, + "clone-regexp": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", + "integrity": "sha512-beMpP7BOtTipFuW8hrJvREQ2DrRu3BE7by0ZpibtfBA+qfHYvMGTc2Yb1JMYPKg/JUw0CHYvpg796aNTSW9z7Q==", + "requires": { + "is-regexp": "^2.0.0" + } + }, "clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", @@ -16204,6 +16720,22 @@ "lodash": "^4.17.11" } }, + "compress-brotli": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/compress-brotli/-/compress-brotli-1.3.8.tgz", + "integrity": "sha512-lVcQsjhxhIXsuupfy9fmZUFtAIdBmXA7EGY6GBdgZ++qkM9zG4YFT8iU7FoBxzryNDMOpD1HIFHUSX4D87oqhQ==", + "requires": { + "@types/json-buffer": "~3.0.0", + "json-buffer": "~3.0.1" + }, + "dependencies": { + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + } + } + }, "compute-gcd": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/compute-gcd/-/compute-gcd-1.2.1.tgz", @@ -16379,7 +16911,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", - "dev": true, "requires": { "decamelize": "^1.1.0", "map-obj": "^1.0.0" @@ -16388,14 +16919,12 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "map-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=" } } }, @@ -16586,7 +17115,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, "requires": { "is-arrayish": "^0.2.1" } @@ -16807,11 +17335,17 @@ "text-table": "^0.2.0" }, "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } }, "escape-string-regexp": { "version": "4.0.0", @@ -16848,14 +17382,11 @@ "is-glob": "^4.0.3" } }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "levn": { "version": "0.4.1", @@ -17578,7 +18109,8 @@ "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -17937,13 +18469,31 @@ "kind-of": "^6.0.2", "section-matter": "^1.0.0", "strip-bom-string": "^1.0.0" + }, + "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + } } }, "hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==" }, "has": { "version": "1.0.3", @@ -18123,11 +18673,241 @@ "space-separated-tokens": "^2.0.0" } }, + "hercule": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/hercule/-/hercule-5.1.3.tgz", + "integrity": "sha512-QJTwaxXfSheCySt3nyPCOE0c2jFWivDjcqEZ7f3TNBX+SkIhGRimdIiaD9vwAGSLetNpQw2MtK4d8BlDe3wdpw==", + "requires": { + "async": "^3.2.0", + "clone-regexp": "^2.1.0", + "duplexer3": "^0.1.4", + "get-stream": "^5.0.0", + "got": "^11.1.4", + "isstream": "^0.1.2", + "left-split": "^1.0.0", + "lodash": "^4.0.0", + "meow": "^7.0.1", + "source-map": "^0.7.0", + "through2": "^4.0.2", + "through2-get": "^1.0.0" + }, + "dependencies": { + "@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" + }, + "@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "requires": { + "defer-to-connect": "^2.0.0" + } + }, + "cacheable-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + } + }, + "camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "requires": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==" + }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "requires": { + "mimic-response": "^3.1.0" + } + }, + "defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==" + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "got": { + "version": "11.8.5", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.5.tgz", + "integrity": "sha512-o0Je4NvQObAuZPHLFoRSkdG2lTgtcynqymzg2Vupdx6PorhaT5MCbIyXG6d4D94kk8ZG57QeosgdiqfJWhEhlQ==", + "requires": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + } + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, + "keyv": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.3.3.tgz", + "integrity": "sha512-AcysI17RvakTh8ir03+a3zJr5r0ovnAH/XTXei/4HIv3bL2K/jzvgivLK9UuI/JbU1aJjM3NSAnVvVVd3n+4DQ==", + "requires": { + "compress-brotli": "^1.3.8", + "json-buffer": "3.0.1" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + }, + "meow": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-7.1.1.tgz", + "integrity": "sha512-GWHvA5QOcS412WCo8vwKDlTelGLsCGBVevQB5Kva961rmNfun0PCbv5+xta2kUMFJyR8/oWnn7ddeKdosbAPbA==", + "requires": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^2.5.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.13.1", + "yargs-parser": "^18.1.3" + } + }, + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" + }, + "normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" + }, + "p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==" + }, + "quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==" + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "requires": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + } + }, + "responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "requires": { + "lowercase-keys": "^2.0.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "requires": { + "readable-stream": "3" + } + }, + "trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==" + }, + "type-fest": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==" + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" }, "html-escaper": { "version": "2.0.2", @@ -18145,6 +18925,15 @@ "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz", "integrity": "sha512-EC2utToWl4RKfs5zd36Mxq7nzHHBuomZboI0yYL6Y0RmBgT7Sgkq4rQ0ezFTYoIsSs7Tm9SJe+o2FcAg6GBhGA==" }, + "http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + } + }, "human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -18211,8 +19000,7 @@ "indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" }, "inflight": { "version": "1.0.6", @@ -18293,8 +19081,7 @@ "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" }, "is-bigint": { "version": "1.0.4", @@ -18352,7 +19139,6 @@ "version": "2.9.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", - "dev": true, "requires": { "has": "^1.0.3" } @@ -18469,8 +19255,7 @@ "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" }, "is-promise": { "version": "2.2.2", @@ -18486,6 +19271,11 @@ "has-tostringtag": "^1.0.0" } }, + "is-regexp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-2.1.0.tgz", + "integrity": "sha512-OZ4IlER3zmRIoB9AqNhEggVxqIH4ofDns5nRrPS6yQxXE1TPCUpFznBfRQmQa8uC+pXqjMnukiJBxCisIxiLGA==" + }, "is-set": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", @@ -18564,6 +19354,11 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, "istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -19408,12 +20203,11 @@ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" } }, "jsdoc-type-pratt-parser": { @@ -19436,8 +20230,7 @@ "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "json-schema-compare": { "version": "0.2.2", @@ -19458,9 +20251,9 @@ } }, "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -19575,6 +20368,11 @@ "package-json": "^6.3.0" } }, + "left-split": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/left-split/-/left-split-1.0.0.tgz", + "integrity": "sha512-AfIX+mnfzPET5Ipi9+EA1cdmYJqXNZAD6+8DVs0BavnqraKgIeLOyVZ3Bnz/+3t3GfS0A4Bz3TrH08zPHllxqw==" + }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -19671,8 +20469,7 @@ "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "load-plugin": { "version": "4.0.1", @@ -19808,8 +20605,7 @@ "map-obj": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==" }, "map-stream": { "version": "0.1.0", @@ -20653,8 +21449,7 @@ "min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==" }, "minimatch": { "version": "3.1.2", @@ -20673,7 +21468,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, "requires": { "arrify": "^1.0.1", "is-plain-obj": "^1.1.0", @@ -20834,7 +21628,6 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, "requires": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -20845,8 +21638,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" } } }, @@ -20951,21 +21743,6 @@ "node-fetch": "^2.6.1", "openapi-types": "^12.0.0", "swagger2openapi": "^7.0.8" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "requires": { - "argparse": "^2.0.1" - } - } } }, "oas-resolver": { @@ -21231,7 +22008,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -21275,8 +22051,7 @@ "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" }, "path-is-absolute": { "version": "1.0.1", @@ -21292,8 +22067,7 @@ "path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "path-to-regexp": { "version": "6.2.1", @@ -21548,8 +22322,7 @@ "quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "dev": true + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" }, "quotation": { "version": "2.0.2", @@ -21601,7 +22374,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, "requires": { "@types/normalize-package-data": "^2.4.0", "normalize-package-data": "^2.5.0", @@ -21612,8 +22384,7 @@ "type-fest": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==" } } }, @@ -21621,7 +22392,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, "requires": { "find-up": "^4.1.0", "read-pkg": "^5.2.0", @@ -21632,7 +22402,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, "requires": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -21642,7 +22411,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, "requires": { "p-locate": "^4.1.0" } @@ -21651,7 +22419,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, "requires": { "p-try": "^2.0.0" } @@ -21660,7 +22427,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, "requires": { "p-limit": "^2.2.0" } @@ -21668,14 +22434,12 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, "type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==" } } }, @@ -21900,13 +22664,17 @@ "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", - "dev": true, "requires": { "is-core-module": "^2.8.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } }, + "resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" + }, "resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -22189,6 +22957,16 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, + "simple-git": { + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.13.0.tgz", + "integrity": "sha512-VYrs3joeHvWGcN3K135RpGpPjm4AHYeOrclwew6LlfHgq6ozQYIW2yMnmjf4PCgVOuSYCbXkdUjyiFawuJz8MA==", + "requires": { + "@kwsites/file-exists": "^1.1.1", + "@kwsites/promise-deferred": "^1.1.1", + "debug": "^4.3.4" + } + }, "sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -22286,7 +23064,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" @@ -22295,14 +23072,12 @@ "spdx-exceptions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" }, "spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, "requires": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" @@ -22311,8 +23086,7 @@ "spdx-license-ids": { "version": "3.0.11", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", - "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", - "dev": true + "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==" }, "split": { "version": "0.2.10", @@ -22388,7 +23162,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "stack-utils": { "version": "2.0.5", @@ -22525,7 +23299,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", - "dev": true, "requires": { "min-indent": "^1.0.0" } @@ -22557,8 +23330,7 @@ "supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" }, "swagger-inline": { "version": "6.0.0", @@ -22570,21 +23342,6 @@ "js-yaml": "^4.1.0", "multilang-extract-comments": "^0.4.0", "promise.any": "^2.0.2" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "requires": { - "argparse": "^2.0.1" - } - } } }, "swagger2openapi": { @@ -22689,6 +23446,48 @@ "xtend": "~4.0.0" } }, + "through2-get": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/through2-get/-/through2-get-1.0.0.tgz", + "integrity": "sha512-RgpBU5A8JLAA6maOFZ0Cc6jIPuDFHqn6NBOwl/R8Ay/iFQnqrNslnrHm3HZpqA0upgpQKst4CvxUzusDrnjWAA==", + "requires": { + "lodash": "^4.17.20", + "through2": "^4.0.2" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "requires": { + "readable-stream": "3" + } + } + } + }, "timers-ext": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", @@ -23013,27 +23812,12 @@ "vfile-statistics": "^2.0.0" }, "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, "is-plain-obj": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.0.0.tgz", "integrity": "sha512-NXRbBtUdBioI73y/HmOhogw/U5msYPC9DAtGkJXeFcFWSFZw0mCUsPxk/snTuJHzNKA8kLBK4rH97RMB1BfCXw==", "dev": true }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, "lines-and-columns": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.3.tgz", @@ -23284,7 +24068,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, "requires": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" diff --git a/package.json b/package.json index 1ce28f5ef..24d994490 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "editor": "^1.0.0", "form-data": "^4.0.0", "gray-matter": "^4.0.1", + "hercule": "^5.1.3", "ignore": "^5.2.0", "jsonpath": "^1.1.1", "mime-types": "^2.1.35", @@ -57,11 +58,13 @@ "parse-link-header": "^2.0.0", "prompts": "^2.4.2", "semver": "^7.0.0", + "simple-git": "^3.13.0", "tmp-promise": "^3.0.2", "update-notifier": "^5.1.0", "validator": "^13.7.0" }, "devDependencies": { + "@readme/better-ajv-errors": "^1.5.0", "@readme/eslint-config": "^10.1.0", "@readme/oas-examples": "^5.3.0", "@types/cli-table": "^0.3.0", @@ -79,10 +82,12 @@ "@types/tmp": "^0.2.3", "@types/update-notifier": "^6.0.1", "@types/validator": "^13.7.6", + "ajv": "^8.11.0", "alex": "^10.0.0", "eslint": "^8.23.0", "jest": "^28.1.1", "jest-extended": "^3.0.0", + "js-yaml": "^4.1.0", "nock": "^13.2.7", "prettier": "^2.7.1", "ts-jest": "^28.0.8", diff --git a/src/.sink.d.ts b/src/.sink.d.ts index eebce80a4..260756e55 100644 --- a/src/.sink.d.ts +++ b/src/.sink.d.ts @@ -1,2 +1,3 @@ // These packages don't have any TS types so we need to declare a module in order to use them. declare module 'editor'; +declare module 'hercule/promises'; diff --git a/src/cli.ts b/src/cli.ts index d34870c07..cdf6d9f7c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -5,7 +5,7 @@ import updateNotifier from 'update-notifier'; import pkg from '../package.json'; -import isGHA from './lib/isGitHub'; +import { isGHA } from './lib/isCI'; import rdme from '.'; diff --git a/src/cmds/categories/create.ts b/src/cmds/categories/create.ts index b107e5cb7..e18c78844 100644 --- a/src/cmds/categories/create.ts +++ b/src/cmds/categories/create.ts @@ -32,11 +32,7 @@ export default class CategoriesCreateCommand extends Command { this.hiddenArgs = ['title']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), this.getVersionArg(), { name: 'title', diff --git a/src/cmds/categories/index.ts b/src/cmds/categories/index.ts index 77eec1da5..050c7c440 100644 --- a/src/cmds/categories/index.ts +++ b/src/cmds/categories/index.ts @@ -14,14 +14,7 @@ export default class CategoriesCommand extends Command { this.cmdCategory = CommandCategories.CATEGORIES; this.position = 1; - this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, - this.getVersionArg(), - ]; + this.args = [this.getKeyArg(), this.getVersionArg()]; } async run(opts: CommandOptions<{}>) { diff --git a/src/cmds/changelogs/index.ts b/src/cmds/changelogs/index.ts index 05dab2bf4..0b37e93dd 100644 --- a/src/cmds/changelogs/index.ts +++ b/src/cmds/changelogs/index.ts @@ -4,6 +4,7 @@ import chalk from 'chalk'; import config from 'config'; import Command, { CommandCategories } from '../../lib/baseCommand'; +import supportsGHA from '../../lib/decorators/supportsGHA'; import pushDoc from '../../lib/pushDoc'; import readdirRecursive from '../../lib/readdirRecursive'; @@ -12,6 +13,7 @@ export type Options = { folder?: string; }; +@supportsGHA export default class ChangelogsCommand extends Command { constructor() { super(); @@ -24,16 +26,13 @@ export default class ChangelogsCommand extends Command { this.hiddenArgs = ['folder']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), { name: 'folder', type: String, defaultOption: true, }, + this.getGitHubArg(), { name: 'dryRun', type: Boolean, @@ -68,6 +67,6 @@ export default class ChangelogsCommand extends Command { }) ); - return chalk.green(updatedDocs.join('\n')); + return Promise.resolve(chalk.green(updatedDocs.join('\n'))); } } diff --git a/src/cmds/changelogs/single.ts b/src/cmds/changelogs/single.ts index 7d1059e0d..5f9e7fd16 100644 --- a/src/cmds/changelogs/single.ts +++ b/src/cmds/changelogs/single.ts @@ -4,6 +4,7 @@ import chalk from 'chalk'; import config from 'config'; import Command, { CommandCategories } from '../../lib/baseCommand'; +import supportsGHA from '../../lib/decorators/supportsGHA'; import pushDoc from '../../lib/pushDoc'; export type Options = { @@ -11,6 +12,7 @@ export type Options = { filePath?: string; }; +@supportsGHA export default class SingleChangelogCommand extends Command { constructor() { super(); @@ -23,16 +25,13 @@ export default class SingleChangelogCommand extends Command { this.hiddenArgs = ['filePath']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), { name: 'filePath', type: String, defaultOption: true, }, + this.getGitHubArg(), { name: 'dryRun', type: Boolean, @@ -56,6 +55,6 @@ export default class SingleChangelogCommand extends Command { const createdDoc = await pushDoc(key, undefined, dryRun, filePath, this.cmdCategory); - return chalk.green(createdDoc); + return Promise.resolve(chalk.green(createdDoc)); } } diff --git a/src/cmds/custompages/index.ts b/src/cmds/custompages/index.ts index 556be0b04..3dd1bafe0 100644 --- a/src/cmds/custompages/index.ts +++ b/src/cmds/custompages/index.ts @@ -4,6 +4,7 @@ import chalk from 'chalk'; import config from 'config'; import Command, { CommandCategories } from '../../lib/baseCommand'; +import supportsGHA from '../../lib/decorators/supportsGHA'; import pushDoc from '../../lib/pushDoc'; import readdirRecursive from '../../lib/readdirRecursive'; @@ -12,6 +13,7 @@ export type Options = { folder?: string; }; +@supportsGHA export default class CustomPagesCommand extends Command { constructor() { super(); @@ -24,16 +26,13 @@ export default class CustomPagesCommand extends Command { this.hiddenArgs = ['folder']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), { name: 'folder', type: String, defaultOption: true, }, + this.getGitHubArg(), { name: 'dryRun', type: Boolean, @@ -71,6 +70,6 @@ export default class CustomPagesCommand extends Command { }) ); - return chalk.green(updatedDocs.join('\n')); + return Promise.resolve(chalk.green(updatedDocs.join('\n'))); } } diff --git a/src/cmds/custompages/single.ts b/src/cmds/custompages/single.ts index f1c6165fa..d2c5f7f5b 100644 --- a/src/cmds/custompages/single.ts +++ b/src/cmds/custompages/single.ts @@ -4,6 +4,7 @@ import chalk from 'chalk'; import config from 'config'; import Command, { CommandCategories } from '../../lib/baseCommand'; +import supportsGHA from '../../lib/decorators/supportsGHA'; import pushDoc from '../../lib/pushDoc'; export type Options = { @@ -11,6 +12,7 @@ export type Options = { filePath?: string; }; +@supportsGHA export default class SingleCustomPageCommand extends Command { constructor() { super(); @@ -22,16 +24,13 @@ export default class SingleCustomPageCommand extends Command { this.hiddenArgs = ['filePath']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), { name: 'filePath', type: String, defaultOption: true, }, + this.getGitHubArg(), { name: 'dryRun', type: Boolean, @@ -61,6 +60,6 @@ export default class SingleCustomPageCommand extends Command { const createdDoc = await pushDoc(key, undefined, dryRun, filePath, this.cmdCategory); - return chalk.green(createdDoc); + return Promise.resolve(chalk.green(createdDoc)); } } diff --git a/src/cmds/docs/edit.ts b/src/cmds/docs/edit.ts index d8917b702..859cfc1f8 100644 --- a/src/cmds/docs/edit.ts +++ b/src/cmds/docs/edit.ts @@ -34,11 +34,7 @@ export default class EditDocsCommand extends Command { this.hiddenArgs = ['slug']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), this.getVersionArg(), { name: 'slug', diff --git a/src/cmds/docs/index.ts b/src/cmds/docs/index.ts index 0a8f529a3..ea0198166 100644 --- a/src/cmds/docs/index.ts +++ b/src/cmds/docs/index.ts @@ -4,6 +4,7 @@ import chalk from 'chalk'; import config from 'config'; import Command, { CommandCategories } from '../../lib/baseCommand'; +import createGHA from '../../lib/createGHA'; import pushDoc from '../../lib/pushDoc'; import readdirRecursive from '../../lib/readdirRecursive'; import { getProjectVersion } from '../../lib/versionSelect'; @@ -25,17 +26,14 @@ export default class DocsCommand extends Command { this.hiddenArgs = ['folder']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), this.getVersionArg(), { name: 'folder', type: String, defaultOption: true, }, + this.getGitHubArg(), { name: 'dryRun', type: Boolean, @@ -77,6 +75,8 @@ export default class DocsCommand extends Command { }) ); - return chalk.green(updatedDocs.join('\n')); + return Promise.resolve(chalk.green(updatedDocs.join('\n'))).then(msg => + createGHA(msg, this.command, this.args, { ...opts, version: selectedVersion }) + ); } } diff --git a/src/cmds/docs/single.ts b/src/cmds/docs/single.ts index 43462b08c..da4ad3679 100644 --- a/src/cmds/docs/single.ts +++ b/src/cmds/docs/single.ts @@ -4,6 +4,7 @@ import chalk from 'chalk'; import config from 'config'; import Command, { CommandCategories } from '../../lib/baseCommand'; +import createGHA from '../../lib/createGHA'; import pushDoc from '../../lib/pushDoc'; import { getProjectVersion } from '../../lib/versionSelect'; @@ -24,17 +25,14 @@ export default class SingleDocCommand extends Command { this.hiddenArgs = ['filePath']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), this.getVersionArg(), { name: 'filePath', type: String, defaultOption: true, }, + this.getGitHubArg(), { name: 'dryRun', type: Boolean, @@ -65,6 +63,8 @@ export default class SingleDocCommand extends Command { const createdDoc = await pushDoc(key, selectedVersion, dryRun, filePath, this.cmdCategory); - return chalk.green(createdDoc); + return Promise.resolve(chalk.green(createdDoc)).then(msg => + createGHA(msg, this.command, this.args, { ...opts, version: selectedVersion }) + ); } } diff --git a/src/cmds/openapi/index.ts b/src/cmds/openapi/index.ts index 5a30e548a..9d088102f 100644 --- a/src/cmds/openapi/index.ts +++ b/src/cmds/openapi/index.ts @@ -8,6 +8,7 @@ import ora from 'ora'; import parse from 'parse-link-header'; import Command, { CommandCategories } from '../../lib/baseCommand'; +import createGHA from '../../lib/createGHA'; import fetch, { cleanHeaders, handleRes } from '../../lib/fetch'; import { oraOptions } from '../../lib/logger'; import prepareOas from '../../lib/prepareOas'; @@ -38,11 +39,7 @@ export default class OpenAPICommand extends Command { this.hiddenArgs = ['spec']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), { name: 'id', type: String, @@ -55,22 +52,23 @@ export default class OpenAPICommand extends Command { type: String, defaultOption: true, }, - { - name: 'create', - type: Boolean, - description: 'Bypasses the create/update prompt and creates a new API definition.', - }, { name: 'useSpecVersion', type: Boolean, description: 'Uses the version listed in the `info.version` field in the API definition for the project version parameter.', }, + this.getGitHubArg(), { name: 'workingDirectory', type: String, description: 'Working directory (for usage with relative external references)', }, + { + name: 'create', + type: Boolean, + description: 'Bypasses the create/update prompt and creates a new API definition.', + }, { name: 'update', type: Boolean, @@ -88,6 +86,11 @@ export default class OpenAPICommand extends Command { let selectedVersion = version; let isUpdate: boolean; const spinner = ora({ ...oraOptions() }); + /** + * The `version` and `update` parameters are not typically ones we'd want to include + * in GitHub Actions workflow files, so we're going to collect them in this object. + */ + const ignoredGHAParameters: Options = { version: undefined, update: undefined }; if (create && update) { throw new Error( @@ -132,7 +135,7 @@ export default class OpenAPICommand extends Command { Command.debug(`selectedVersion: ${selectedVersion}`); - async function success(data: Response) { + const success = async (data: Response) => { const message = !isUpdate ? `You've successfully uploaded a new ${specType} file to your ReadMe project!` : `You've successfully updated an existing ${specType} file on your ReadMe project!`; @@ -152,10 +155,19 @@ export default class OpenAPICommand extends Command { // eslint-disable-next-line no-underscore-dangle `\t${chalk.green(`rdme openapi ${specPath} --key= --id=${body._id}`)}`, ].join('\n') + ).then(msg => + createGHA(msg, this.command, this.args, { + ...opts, + spec: specPath, + // eslint-disable-next-line no-underscore-dangle + id: body._id, + version: selectedVersion, + ...ignoredGHAParameters, + }) ); - } + }; - async function error(res: Response) { + const error = (res: Response) => { return handleRes(res).catch(err => { // If we receive an APIError, no changes needed! Throw it as is. if (err.name === 'APIError') { @@ -180,7 +192,7 @@ export default class OpenAPICommand extends Command { )}.` ); }); - } + }; const registryUUID = await streamSpecToRegistry(bundledSpec); @@ -243,7 +255,11 @@ export default class OpenAPICommand extends Command { }); } - if (create) return createSpec(); + if (create) { + ignoredGHAParameters.id = undefined; + delete ignoredGHAParameters.version; + return createSpec(); + } if (!id) { Command.debug('no id parameter, retrieving list of API specs'); diff --git a/src/cmds/validate.ts b/src/cmds/validate.ts index 65544a249..3d034df00 100644 --- a/src/cmds/validate.ts +++ b/src/cmds/validate.ts @@ -3,6 +3,7 @@ import type { CommandOptions } from '../lib/baseCommand'; import chalk from 'chalk'; import Command, { CommandCategories } from '../lib/baseCommand'; +import createGHA from '../lib/createGHA'; import prepareOas from '../lib/prepareOas'; export type Options = { @@ -32,6 +33,7 @@ export default class ValidateCommand extends Command { type: String, description: 'Working directory (for usage with relative external references)', }, + this.getGitHubArg(), ]; } @@ -45,6 +47,8 @@ export default class ValidateCommand extends Command { } const { specPath, specType } = await prepareOas(spec, 'validate'); - return Promise.resolve(chalk.green(`${specPath} is a valid ${specType} API definition!`)); + return Promise.resolve(chalk.green(`${specPath} is a valid ${specType} API definition!`)).then(msg => + createGHA(msg, this.command, this.args, { ...opts, spec: specPath } as CommandOptions) + ); } } diff --git a/src/cmds/versions/create.ts b/src/cmds/versions/create.ts index 99df7eea7..b2fd486c3 100644 --- a/src/cmds/versions/create.ts +++ b/src/cmds/versions/create.ts @@ -30,11 +30,7 @@ export default class CreateVersionCommand extends Command { this.hiddenArgs = ['version']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), { name: 'version', type: String, diff --git a/src/cmds/versions/delete.ts b/src/cmds/versions/delete.ts index 0bdb512d3..ee6a5329b 100644 --- a/src/cmds/versions/delete.ts +++ b/src/cmds/versions/delete.ts @@ -18,11 +18,7 @@ export default class DeleteVersionCommand extends Command { this.hiddenArgs = ['version']; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), { name: 'version', type: String, diff --git a/src/cmds/versions/index.ts b/src/cmds/versions/index.ts index d4fae94c2..aace67147 100644 --- a/src/cmds/versions/index.ts +++ b/src/cmds/versions/index.ts @@ -35,11 +35,7 @@ export default class VersionsCommand extends Command { this.position = 1; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), { name: 'version', type: String, diff --git a/src/cmds/versions/update.ts b/src/cmds/versions/update.ts index 5176c13a2..66c27192a 100644 --- a/src/cmds/versions/update.ts +++ b/src/cmds/versions/update.ts @@ -23,11 +23,7 @@ export default class UpdateVersionCommand extends Command { this.position = 3; this.args = [ - { - name: 'key', - type: String, - description: 'Project API key', - }, + this.getKeyArg(), this.getVersionArg(), { name: 'newVersion', diff --git a/src/index.ts b/src/index.ts index 6b3974ae5..bf16c92e3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,6 +24,9 @@ import * as commands from './lib/commands'; import configStore from './lib/configstore'; import * as help from './lib/help'; import { debug } from './lib/logger'; +import createGHA from './lib/createGHA'; +import type Command from './lib/baseCommand'; +import type { CommandOptions } from './lib/baseCommand'; /** * @param {Array} processArgv - An array of arguments from the current process. Can be used to mock @@ -66,8 +69,8 @@ export default function rdme(processArgv: NodeJS.Process['argv']) { } try { - let cmdArgv; - let bin; + let cmdArgv: CommandOptions<{}>; + let bin: Command; // Handling for `rdme help` and `rdme help ` cases. if (command === 'help') { @@ -116,7 +119,12 @@ export default function rdme(processArgv: NodeJS.Process['argv']) { cmdArgv = { key: configStore.get('apiKey'), ...cmdArgv }; - return bin.run(cmdArgv); + return bin.run(cmdArgv).then((msg: string) => { + if (bin.supportsGHA) { + return createGHA(msg, bin.command, bin.args, cmdArgv); + } + return msg; + }); } catch (e) { if (e.message === 'Command not found.') { e.message = `${e.message}\n\nType \`${chalk.yellow(`${config.get('cli')} help`)}\` ${chalk.red( diff --git a/src/lib/baseCommand.ts b/src/lib/baseCommand.ts index 2640428c3..279bc6fed 100644 --- a/src/lib/baseCommand.ts +++ b/src/lib/baseCommand.ts @@ -1,12 +1,16 @@ /* eslint-disable class-methods-use-this */ +import type commands from '../cmds'; +import type { CommandLineOptions } from 'command-line-args'; import type { OptionDefinition } from 'command-line-usage'; +import isCI from './isCI'; import { debug, info, warn } from './logger'; export type CommandOptions = T & { key?: string; version?: string; -}; + github?: boolean; +} & CommandLineOptions; export enum CommandCategories { ADMIN = 'admin', @@ -25,7 +29,7 @@ export default class Command { * * @example openapi */ - command: string; + command: keyof typeof commands; /** * Example command usage, used on invidivual command help screens @@ -63,6 +67,12 @@ export default class Command { */ hidden = false; + /** + * Does the command run the GitHub Actions onboarding called via + * `src/index.ts`? + */ + supportsGHA = false; + /** * Arguments to hide from the individual command help screen * (typically used for hiding default arguments) @@ -76,7 +86,7 @@ export default class Command { */ args: OptionDefinition[]; - run(opts: CommandOptions<{}>): void | Promise { + run(opts: CommandOptions<{}>): Promise { Command.debug(`command: ${this.command}`); Command.debug(`opts: ${JSON.stringify(opts)}`); @@ -85,12 +95,42 @@ export default class Command { throw new Error('No project API key provided. Please use `--key`.'); } } + + if (opts.github && isCI()) { + throw new Error('The `--github` flag is only for usage in non-CI environments.'); + } + + // This is a bit of a hack so we can keep our types consistent + // for this `run` function. + return Promise.resolve(''); + } + + /** + * Used in any command where `github` is an option. + */ + getGitHubArg(): OptionDefinition { + return { + name: 'github', + type: Boolean, + description: 'Create a new GitHub Actions workflow for this command.', + }; + } + + /** + * Used in any command where `key` is an option. + */ + getKeyArg(): OptionDefinition { + return { + name: 'key', + type: String, + description: 'Project API key', + }; } /** * Used in any command where `version` is an option. */ - getVersionArg() { + getVersionArg(): OptionDefinition { return { name: 'version', type: String, diff --git a/src/lib/createGHA/baseFile.ts b/src/lib/createGHA/baseFile.ts new file mode 100644 index 000000000..44c89256d --- /dev/null +++ b/src/lib/createGHA/baseFile.ts @@ -0,0 +1,36 @@ +/** + * The base GitHub Actions workflow file, which is used for generating the YAML file. + * + * The reason this is expressed as a JavaScript string as opposed to a YAML file is because + * TypeScript doesn't have a great way to copy over non-TS files to the `dist/`. + * Plus, this way we can write internal comments like this! + * + * @see {@link https://github.com/microsoft/TypeScript/issues/30835} + * @see {@link https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions} + */ +const yamlBase = `# This GitHub Actions workflow was auto-generated by the \`rdme\` cli on :[](timestamp) +# You can view our full documentation here: https://docs.readme.com/docs/rdme +name: ReadMe GitHub Action 🦉 + +on: + push: + branches: + # This workflow will run every time you push code to the following branch: \`:[](branch)\` + # Check out GitHub's docs for more info on configuring this: + # https://docs.github.com/actions/using-workflows/events-that-trigger-workflows + - :[](branch) + +jobs: + rdme-:[](cleanCommand): + runs-on: ubuntu-latest + steps: + - name: Check out repo 📚 + uses: actions/checkout@v3 + + - name: Run \`:[](command)\` command 🚀 + uses: readmeio/rdme@:[](rdmeVersion) + with: + rdme: :[](commandString) +`; + +export default yamlBase; diff --git a/src/lib/createGHA/index.ts b/src/lib/createGHA/index.ts new file mode 100644 index 000000000..9e832c6bb --- /dev/null +++ b/src/lib/createGHA/index.ts @@ -0,0 +1,362 @@ +import type commands from '../../cmds'; +import type { CommandOptions } from '../baseCommand'; +import type { OptionDefinition } from 'command-line-usage'; + +import fs from 'fs'; +import path from 'path'; + +import chalk from 'chalk'; +import prompts from 'prompts'; +import semverMajor from 'semver/functions/major'; +import simpleGit from 'simple-git'; + +import { transcludeString } from 'hercule/promises'; + +import pkg from '../../../package.json'; +import configstore from '../configstore'; +import isCI from '../isCI'; +import { debug } from '../logger'; +import promptTerminal from '../promptWrapper'; + +import yamlBase from './baseFile'; + +/** + * Generates the key for storing info in `configstore` object. + * @param repoRoot The root of the repo + */ +export const getConfigStoreKey = (repoRoot: string) => `createGHA.${repoRoot}`; +/** + * The directory where GitHub Actions workflow files are stored. + * + * This is the same across all repositories on GitHub. + * + * @see {@link https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows} + */ +const GITHUB_WORKFLOW_DIR = '.github/workflows'; +const GITHUB_SECRET_NAME = 'README_API_KEY'; + +/** + * The current `rdme` version + * + * @example "8.0.0" + * @note the reason why this is a function is + * because we want to mock it for our snapshots. + * @see {@link https://stackoverflow.com/a/54245672} + */ +export const getPkgVersion = () => pkg.version; + +/** + * The current major `rdme` version + * + * @example 8 + */ +export const rdmeVersionMajor = semverMajor(getPkgVersion()); + +export const git = simpleGit(); + +/** + * Removes any non-alphanumeric characters and replaces them with hyphens. + * + * This is used for file names and for YAML keys. + */ +const cleanFileName = (input: string) => input.replace(/[^a-z0-9]/gi, '-'); + +/** + * Removes any non-file-friendly characters and adds + * the full path + file extension for GitHub Workflow files. + * @param fileName raw file name to clean up + */ +export const getGHAFileName = (fileName: string) => { + return path.join(GITHUB_WORKFLOW_DIR, `${cleanFileName(fileName).toLowerCase()}.yml`); +}; + +/** + * Returns a redacted `key` if the current command uses authentication. + * Otherwise, returns `false`. + */ +function getKey(args: OptionDefinition[], opts: CommandOptions<{}>): string | false { + if (args.some(arg => arg.name === 'key')) { + return `••••••••••••${opts.key.slice(-5)}`; + } + return false; +} + +/** + * Constructs the command string that we pass into the workflow file. + */ +function constructCmdString( + command: keyof typeof commands, + args: OptionDefinition[], + opts: CommandOptions> +): string { + const optsString = args + .sort(arg => (arg.defaultOption ? -1 : 0)) + .map(arg => { + const val = opts[arg.name]; + // if default option, return the value + if (arg.defaultOption) return val; + // obfuscate the key in a GitHub secret + if (arg.name === 'key') return `--key=$\{{ secrets.${GITHUB_SECRET_NAME} }}`; + // remove the GitHub flag + if (arg.name === 'github') return false; + // if a boolean value, return the flag + if (arg.type === Boolean && val) return `--${arg.name}`; + if (val) return `--${arg.name}=${val}`; + return false; + }) + .filter(Boolean) + .join(' '); + + return `${command} ${optsString}`.trim(); +} + +/** + * Function to return various git attributes needed for running GitHub Action + */ +export async function getGitData() { + // Expressions to search raw output of `git remote show origin` + const headRegEx = /^ {2}HEAD branch: /g; + const headLineRegEx = /^ {2}HEAD branch:.*/gm; + + const isRepo = await git.checkIsRepo().catch(e => { + debug(`error running git repo check: ${e.message}`); + return false; + }); + + debug(`[getGitData] isRepo result: ${isRepo}`); + + let containsGitHubRemote; + let containsNonGitHubRemote; + let defaultBranch; + const rawRemotes = await git.remote([]).catch(e => { + debug(`[getGitData] error grabbing git remotes: ${e.message}`); + return ''; + }); + + debug(`[getGitData] rawRemotes result: ${rawRemotes}`); + + if (rawRemotes) { + const remote = rawRemotes.split('\n')[0]; + debug(`[getGitData] remote result: ${remote}`); + const rawRemote = await git.remote(['show', remote]); + debug(`[getGitData] rawRemote result: ${rawRemote}`); + // Extract head branch from git output + const rawHead = headLineRegEx.exec(rawRemote as string)?.[0]; + debug(`[getGitData] rawHead result: ${rawHead}`); + if (rawHead) defaultBranch = rawHead.replace(headRegEx, ''); + + // Extract the word 'github' from git output + const remotesList = (await git.remote(['-v'])) as string; + debug(`[getGitData] remotesList result: ${remotesList}`); + // This is a bit hairy but we want to keep it fairly general here + // in case of GitHub Enterprise, etc. + containsGitHubRemote = /github/.test(remotesList); + containsNonGitHubRemote = /gitlab/.test(remotesList) || /bitbucket/.test(remotesList); + } + + debug(`[getGitData] containsGitHubRemote result: ${containsGitHubRemote}`); + debug(`[getGitData] containsNonGitHubRemote result: ${containsNonGitHubRemote}`); + debug(`[getGitData] defaultBranch result: ${defaultBranch}`); + + const repoRoot = await git.revparse(['--show-toplevel']).catch(e => { + debug(`[getGitData] error grabbing git root: ${e.message}`); + return ''; + }); + + debug(`[getGitData] repoRoot result: ${repoRoot}`); + + return { containsGitHubRemote, containsNonGitHubRemote, defaultBranch, isRepo, repoRoot }; +} + +/** + * Post-command flow for creating a GitHub Actions workflow file. + * + */ +export default async function createGHA( + msg: string, + command: keyof typeof commands, + args: OptionDefinition[], + opts: CommandOptions<{}> +) { + debug(`running GHA onboarding for ${command} command`); + debug(`opts used in createGHA: ${JSON.stringify(opts)}`); + + const { containsGitHubRemote, containsNonGitHubRemote, defaultBranch, isRepo, repoRoot } = await getGitData(); + + const configVal = configstore.get(getConfigStoreKey(repoRoot)); + debug(`repo value in config: ${configVal}`); + + if (!opts.github) { + if ( + // not a repo + !isRepo || + // in a CI environment + isCI() || + // user has previously declined to set up GHA for current repo and `rdme` package version + configVal === rdmeVersionMajor || + // is a repo, but only contains non-GitHub remotes + (isRepo && containsNonGitHubRemote && !containsGitHubRemote) || + // not testing this function + (process.env.NODE_ENV === 'testing' && !process.env.TEST_CREATEGHA) + ) { + debug('not running GHA onboarding workflow, exiting'); + // We return the original command message and pretend this command flow never happened. + return msg; + } + } + + /** + * The reason we're using console.info() in these lines as opposed to + * our logger is because that logger has some formatting limitations + * and this function doesn't ever run in a GitHub Actions environment. + * By using `info` as opposed to `log`, we also can mock it in our tests + * while also freely using `log` when debugging our code. + * + * @see {@link https://github.com/readmeio/rdme/blob/main/CONTRIBUTING.md#usage-of-console} + */ + // eslint-disable-next-line no-console + if (msg) console.info(msg); + + if (opts.github) { + // eslint-disable-next-line no-console + console.info(chalk.bold("\n🚀 Let's get you set up with GitHub Actions! 🚀\n")); + } else { + // eslint-disable-next-line no-console + console.info( + [ + '', + chalk.bold("🐙 Looks like you're running this command in a GitHub Repository! 🐙"), + '', + `🚀 With a few quick clicks, you can run this \`${command}\` command via GitHub Actions (${chalk.underline( + 'https://github.com/features/actions' + )})`, + '', + `✨ This means it will run ${chalk.italic('automagically')} with every push to a branch of your choice!`, + '', + ].join('\n') + ); + } + + if (repoRoot) process.chdir(repoRoot); + + prompts.override({ shouldCreateGHA: opts.github }); + + const { branch, filePath, shouldCreateGHA }: { branch: string; filePath: string; shouldCreateGHA: boolean } = + await promptTerminal( + [ + { + message: 'Would you like to add a GitHub Actions workflow?', + name: 'shouldCreateGHA', + type: 'confirm', + initial: true, + }, + { + message: 'What GitHub branch should this workflow run on?', + name: 'branch', + type: 'text', + initial: defaultBranch || 'main', + }, + { + message: 'What would you like to name the GitHub Actions workflow file?', + name: 'filePath', + type: 'text', + initial: cleanFileName(`rdme-${command}`), + format: prev => getGHAFileName(prev), + validate: value => { + if (value.length) { + const fullPath = getGHAFileName(value); + if (!fs.existsSync(fullPath)) { + return true; + } + + return 'Specified output path already exists.'; + } + + return 'An output path must be supplied.'; + }, + }, + ], + { + // @ts-expect-error answers is definitely an object, + // despite TS insisting that it's an array. + // link: https://github.com/terkelg/prompts#optionsonsubmit + onSubmit: (p, a, answers: { shouldCreateGHA: boolean }) => !answers.shouldCreateGHA, + } + ); + + if (!shouldCreateGHA) { + // if the user says no, we don't want to bug them again + // for this repo and version of `rdme + configstore.set(getConfigStoreKey(repoRoot), rdmeVersionMajor); + throw new Error( + 'GitHub Actions workflow creation cancelled. If you ever change your mind, you can run this command again with the `--github` flag.' + ); + } + + const data = { + branch, + cleanCommand: cleanFileName(command), + command, + commandString: constructCmdString(command, args, opts), + rdmeVersion: getPkgVersion(), + timestamp: new Date().toISOString(), + }; + + debug(`data for resolver: ${JSON.stringify(data)}`); + + /** + * Custom resolver for usage in `hercule`. + * + * @param url The variables from [the file template](./baseFile.ts) + * @see {@link https://github.com/jamesramsay/hercule#resolvers} + */ + const customResolver = function ( + url: 'branch' | 'cleanCommand' | 'command' | 'commandString' | 'rdmeVersion' | 'timestamp' + ): { + content: string; + } { + return { content: data[url] }; + }; + + const { output } = await transcludeString(yamlBase, { resolvers: [customResolver] }); + + if (!fs.existsSync(GITHUB_WORKFLOW_DIR)) { + debug('GHA workflow directory does not exist, creating'); + fs.mkdirSync(GITHUB_WORKFLOW_DIR, { recursive: true }); + } + + fs.writeFileSync(filePath, output); + + const success = [chalk.green('\nYour GitHub Actions workflow file has been created! ✨\n')]; + + const key = getKey(args, opts); + + if (key) { + success.push( + chalk.bold('Almost done! Just a couple more steps:'), + `1. Push your newly created file (${chalk.underline(filePath)}) to GitHub 🚀`, + // TODO: only show this if opts.key is a thing + `2. Create a GitHub secret called ${chalk.bold( + GITHUB_SECRET_NAME + )} and populate the value with your ReadMe API key (${key}) 🔑`, + '', + `🔐 Check out GitHub's docs for more info on creating encrypted secrets (${chalk.underline( + 'https://docs.github.com/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository' + )})` + ); + } else { + success.push( + `${chalk.bold('Almost done!')} Push your newly created file (${chalk.underline( + filePath + )}) to GitHub and you're all set 🚀` + ); + } + + success.push( + '', + `🦉 If you have any more questions, feel free to drop us a line! ${chalk.underline('support@readme.io')}`, + '' + ); + + return Promise.resolve(success.join('\n')); +} diff --git a/src/lib/decorators/supportsGHA.ts b/src/lib/decorators/supportsGHA.ts new file mode 100644 index 000000000..2a239b6d6 --- /dev/null +++ b/src/lib/decorators/supportsGHA.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** + * This TypeScript decorator will enable the GitHub Action onboarding workflow + * for the decorated command. + * + * @see {@link https://www.typescriptlang.org/docs/handbook/decorators.html#class-decorators} + */ +export default function supportsGHA(constructor: T) { + return class extends constructor { + supportsGHA = true; + }; +} diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index b1927423b..9b11f4a32 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -6,7 +6,7 @@ import nodeFetch, { Headers } from 'node-fetch'; import pkg from '../../package.json'; import APIError from './apiError'; -import isGHA from './isGitHub'; +import { isGHA } from './isCI'; import { debug } from './logger'; /** diff --git a/src/lib/isCI.ts b/src/lib/isCI.ts new file mode 100644 index 000000000..22e661fa8 --- /dev/null +++ b/src/lib/isCI.ts @@ -0,0 +1,21 @@ +import ciDetect from '@npmcli/ci-detect'; + +/** + * Small env check to determine if we're in a GitHub Actions environment. + * + * @see {@link https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables} + */ +export function isGHA() { + return ciDetect() === 'github-actions'; +} + +/** + * Small check to ensure we're in a safe CI environment. + * + * The reason we have this `env` variable is because we run our tests in a CI environment + * and we don't want false positives when running tests on logic only intended for CI. + */ +export default function isCI() { + /* istanbul ignore next */ + return (ciDetect() && process.env.NODE_ENV !== 'testing') || process.env.TEST_CI; +} diff --git a/src/lib/isGitHub.ts b/src/lib/isGitHub.ts deleted file mode 100644 index 78c6f8931..000000000 --- a/src/lib/isGitHub.ts +++ /dev/null @@ -1,10 +0,0 @@ -import ciDetect from '@npmcli/ci-detect'; - -/** - * Small env check to determine if we're in a GitHub Actions environment. - * - * @see {@link https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables} - */ -export default function isGHA() { - return ciDetect() === 'github-actions'; -} diff --git a/src/lib/logger.ts b/src/lib/logger.ts index f47b0c8f5..7b11960b9 100644 --- a/src/lib/logger.ts +++ b/src/lib/logger.ts @@ -6,7 +6,7 @@ import chalk from 'chalk'; import config from 'config'; import debugModule from 'debug'; -import isGHA from './isGitHub'; +import { isGHA } from './isCI'; const debugPackage = debugModule(config.get('cli')); diff --git a/src/lib/prepareOas.ts b/src/lib/prepareOas.ts index 5232a9dae..0eea36d40 100644 --- a/src/lib/prepareOas.ts +++ b/src/lib/prepareOas.ts @@ -1,8 +1,8 @@ -import ciDetect from '@npmcli/ci-detect'; import chalk from 'chalk'; import OASNormalize from 'oas-normalize'; import ora from 'ora'; +import isCI from './isCI'; import { debug, info, oraOptions } from './logger'; import promptTerminal from './promptWrapper'; import readdirRecursive from './readdirRecursive'; @@ -95,8 +95,7 @@ export default async function prepareOas(path: string, command: 'openapi' | 'ope fileFindingSpinner.succeed(`${fileFindingSpinner.text} found! 🔍`); info(chalk.yellow(`We found ${specPath} and are attempting to ${action} it.`)); } else if (possibleSpecFiles.length > 1) { - /* istanbul ignore next */ - if ((ciDetect() && process.env.NODE_ENV !== 'testing') || process.env.TEST_CI) { + if (isCI()) { fileFindingSpinner.fail(); throw new Error('Multiple API definitions found in current directory. Please specify file.'); } @@ -105,7 +104,7 @@ export default async function prepareOas(path: string, command: 'openapi' | 'ope const selection: FileSelection = await promptTerminal({ name: 'file', - message: `Multiple potential API definitions found! Which file would you like to ${action}?`, + message: `Multiple potential API definitions found! Which one would you like to ${action}?`, type: 'select', choices: possibleSpecFiles.map(file => ({ title: file, value: file })), }); diff --git a/src/lib/versionSelect.ts b/src/lib/versionSelect.ts index aa8080e3d..0a3a6c06d 100644 --- a/src/lib/versionSelect.ts +++ b/src/lib/versionSelect.ts @@ -1,9 +1,9 @@ -import ciDetect from '@npmcli/ci-detect'; import config from 'config'; import { Headers } from 'node-fetch'; import APIError from './apiError'; import fetch, { cleanHeaders, handleRes } from './fetch'; +import isCI from './isCI'; import { warn } from './logger'; import * as promptHandler from './prompts'; import promptTerminal from './promptWrapper'; @@ -28,7 +28,7 @@ export async function getProjectVersion(versionFlag: string, key: string, allowN .then(res => res.version); } - if ((ciDetect() && process.env.NODE_ENV !== 'testing') || process.env.TEST_CI) { + if (isCI()) { warn('No `--version` parameter detected in current CI environment. Defaulting to main version.'); return undefined; } diff --git a/tsconfig.json b/tsconfig.json index f7a7bd5e4..147d886cf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,8 @@ "noImplicitAny": true, "outDir": "dist/", "paths": { - "editor": [".sink.d.ts"] + "editor": [".sink.d.ts"], + "hercule/promises": [".sink.d.ts"] }, "resolveJsonModule": true, "target": "ES5"