backport 10.2.0 → 11.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/backport +1 -1
- package/dist/src/backport-run.d.ts +5 -22
- package/dist/src/backport-run.js +76 -130
- package/dist/src/backport-run.js.map +1 -1
- package/dist/src/entrypoint.api.d.ts +18 -22
- package/dist/src/entrypoint.api.js +55 -88
- package/dist/src/entrypoint.api.js.map +1 -1
- package/dist/src/entrypoint.cli.d.ts +1 -1
- package/dist/src/entrypoint.cli.js +17 -13
- package/dist/src/entrypoint.cli.js.map +1 -1
- package/dist/src/graphql/generated/gql.d.ts +1 -1
- package/dist/src/graphql/generated/gql.js +4 -38
- package/dist/src/graphql/generated/gql.js.map +1 -1
- package/dist/src/graphql/generated/graphql.d.ts +2000 -1619
- package/dist/src/graphql/generated/graphql.js +659 -581
- package/dist/src/graphql/generated/graphql.js.map +1 -1
- package/dist/src/graphql/generated/index.d.ts +1 -1
- package/dist/src/graphql/generated/index.js +1 -17
- package/dist/src/graphql/generated/index.js.map +1 -1
- package/dist/src/lib/author.d.ts +2 -2
- package/dist/src/lib/author.js +1 -4
- package/dist/src/lib/author.js.map +1 -1
- package/dist/src/lib/backport-error.d.ts +53 -7
- package/dist/src/lib/backport-error.js +39 -15
- package/dist/src/lib/backport-error.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/auto-merge-now-or-later.d.ts +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/auto-merge-now-or-later.js +19 -23
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/auto-merge-now-or-later.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/cherrypick-and-create-target-pull-request.d.ts +2 -3
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/cherrypick-and-create-target-pull-request.js +60 -57
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/cherrypick-and-create-target-pull-request.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/copy-source-pull-request-reviewers-to-target-pull-request.d.ts +2 -2
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/copy-source-pull-request-reviewers-to-target-pull-request.js +7 -10
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/copy-source-pull-request-reviewers-to-target-pull-request.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-backport-branch-name.d.ts +2 -2
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-backport-branch-name.js +6 -12
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-backport-branch-name.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-commits-without-backports.d.ts +2 -2
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-commits-without-backports.js +10 -16
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-commits-without-backports.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-merge-commit.d.ts +2 -2
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-merge-commit.js +6 -9
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-merge-commit.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-configured-target-pr-labels.d.ts +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-configured-target-pr-labels.js +7 -10
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-configured-target-pr-labels.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-source-pr-labels-to-copy.d.ts +2 -2
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-source-pr-labels-to-copy.js +3 -6
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-source-pr-labels-to-copy.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-target-prlabels.d.ts +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-target-prlabels.js +7 -10
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-target-prlabels.js.map +1 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/list-conflicting-and-unstaged-files.d.ts +7 -0
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/list-conflicting-and-unstaged-files.js +44 -0
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/list-conflicting-and-unstaged-files.js.map +1 -0
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/wait-for-cherrypick.d.ts +6 -4
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/wait-for-cherrypick.js +63 -86
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/wait-for-cherrypick.js.map +1 -1
- package/dist/src/lib/child-process-promisified.d.ts +1 -1
- package/dist/src/lib/child-process-promisified.js +27 -48
- package/dist/src/lib/child-process-promisified.js.map +1 -1
- package/dist/src/lib/env.d.ts +3 -3
- package/dist/src/lib/env.js +12 -21
- package/dist/src/lib/env.js.map +1 -1
- package/dist/src/lib/get-commits.d.ts +2 -2
- package/dist/src/lib/get-commits.js +30 -32
- package/dist/src/lib/get-commits.js.map +1 -1
- package/dist/src/lib/get-source-branch-from-commits.d.ts +1 -1
- package/dist/src/lib/get-source-branch-from-commits.js +6 -6
- package/dist/src/lib/get-source-branch-from-commits.js.map +1 -1
- package/dist/src/lib/get-target-branches.d.ts +3 -3
- package/dist/src/lib/get-target-branches.js +20 -20
- package/dist/src/lib/get-target-branches.js.map +1 -1
- package/dist/src/lib/git/branch.d.ts +12 -0
- package/dist/src/lib/git/branch.js +83 -0
- package/dist/src/lib/git/branch.js.map +1 -0
- package/dist/src/lib/git/cherrypick.d.ts +27 -0
- package/dist/src/lib/git/cherrypick.js +106 -0
- package/dist/src/lib/git/cherrypick.js.map +1 -0
- package/dist/src/lib/git/clone.d.ts +4 -0
- package/dist/src/lib/git/clone.js +47 -0
- package/dist/src/lib/git/clone.js.map +1 -0
- package/dist/src/lib/git/commit.d.ts +19 -0
- package/dist/src/lib/git/commit.js +86 -0
- package/dist/src/lib/git/commit.js.map +1 -0
- package/dist/src/lib/git/config-file-status.d.ts +9 -0
- package/dist/src/lib/git/config-file-status.js +37 -0
- package/dist/src/lib/git/config-file-status.js.map +1 -0
- package/dist/src/lib/git/diff.d.ts +12 -0
- package/dist/src/lib/git/diff.js +73 -0
- package/dist/src/lib/git/diff.js.map +1 -0
- package/dist/src/lib/git/index.d.ts +8 -0
- package/dist/src/lib/git/index.js +9 -0
- package/dist/src/lib/git/index.js.map +1 -0
- package/dist/src/lib/git/push.d.ts +10 -0
- package/dist/src/lib/git/push.js +36 -0
- package/dist/src/lib/git/push.js.map +1 -0
- package/dist/src/lib/git/remote.d.ts +13 -0
- package/dist/src/lib/git/remote.js +85 -0
- package/dist/src/lib/git/remote.js.map +1 -0
- package/dist/src/lib/github/commit-formatters.js +4 -9
- package/dist/src/lib/github/commit-formatters.js.map +1 -1
- package/dist/src/lib/github/v3/add-assignees-to-pull-request.js +11 -26
- package/dist/src/lib/github/v3/add-assignees-to-pull-request.js.map +1 -1
- package/dist/src/lib/github/v3/add-labels-to-pull-request.js +11 -26
- package/dist/src/lib/github/v3/add-labels-to-pull-request.js.map +1 -1
- package/dist/src/lib/github/v3/add-reviewers-to-pull-request.d.ts +10 -2
- package/dist/src/lib/github/v3/add-reviewers-to-pull-request.js +12 -32
- package/dist/src/lib/github/v3/add-reviewers-to-pull-request.js.map +1 -1
- package/dist/src/lib/github/v3/{getPullRequest → create-pull-request}/create-pull-request.d.ts +1 -2
- package/dist/src/lib/github/v3/create-pull-request/create-pull-request.js +57 -0
- package/dist/src/lib/github/v3/create-pull-request/create-pull-request.js.map +1 -0
- package/dist/src/lib/github/v3/{getPullRequest → create-pull-request}/get-pull-request-body.d.ts +5 -3
- package/dist/src/lib/github/v3/create-pull-request/get-pull-request-body.js +72 -0
- package/dist/src/lib/github/v3/create-pull-request/get-pull-request-body.js.map +1 -0
- package/dist/src/lib/github/v3/{getPullRequest → create-pull-request}/get-title.d.ts +2 -2
- package/dist/src/lib/github/v3/create-pull-request/get-title.js +27 -0
- package/dist/src/lib/github/v3/create-pull-request/get-title.js.map +1 -0
- package/dist/src/lib/github/v3/create-status-comment.d.ts +2 -2
- package/dist/src/lib/github/v3/create-status-comment.js +54 -84
- package/dist/src/lib/github/v3/create-status-comment.js.map +1 -1
- package/dist/src/lib/github/v3/get-github-v3-error-message.d.ts +2 -14
- package/dist/src/lib/github/v3/get-github-v3-error-message.js +4 -6
- package/dist/src/lib/github/v3/get-github-v3-error-message.js.map +1 -1
- package/dist/src/lib/github/v3/get-reviewers-from-pull-requests.js +14 -21
- package/dist/src/lib/github/v3/get-reviewers-from-pull-requests.js.map +1 -1
- package/dist/src/lib/github/v3/index.d.ts +13 -0
- package/dist/src/lib/github/v3/index.js +13 -0
- package/dist/src/lib/github/v3/index.js.map +1 -0
- package/dist/src/lib/github/v3/merge-pull-request.d.ts +1 -1
- package/dist/src/lib/github/v3/merge-pull-request.js +5 -13
- package/dist/src/lib/github/v3/merge-pull-request.js.map +1 -1
- package/dist/src/lib/github/v3/octokit-client.d.ts +10 -0
- package/dist/src/lib/github/v3/octokit-client.js +30 -0
- package/dist/src/lib/github/v3/octokit-client.js.map +1 -0
- package/dist/src/lib/github/v4/client/graphql-client.d.ts +17 -12
- package/dist/src/lib/github/v4/client/graphql-client.js +69 -23
- package/dist/src/lib/github/v4/client/graphql-client.js.map +1 -1
- package/dist/src/lib/github/v4/disable-pull-request-auto-merge.d.ts +1 -1
- package/dist/src/lib/github/v4/disable-pull-request-auto-merge.js +12 -12
- package/dist/src/lib/github/v4/disable-pull-request-auto-merge.js.map +1 -1
- package/dist/src/lib/github/v4/enable-pull-request-auto-merge.d.ts +1 -3
- package/dist/src/lib/github/v4/enable-pull-request-auto-merge.js +27 -16
- package/dist/src/lib/github/v4/enable-pull-request-auto-merge.js.map +1 -1
- package/dist/src/lib/github/v4/fetch-author-id.js +10 -10
- package/dist/src/lib/github/v4/fetch-author-id.js.map +1 -1
- package/dist/src/lib/github/v4/fetch-existing-pull-request.d.ts +2 -2
- package/dist/src/lib/github/v4/fetch-existing-pull-request.js +12 -12
- package/dist/src/lib/github/v4/fetch-existing-pull-request.js.map +1 -1
- package/dist/src/lib/github/v4/fetch-pull-request-auto-merge-method.d.ts +2 -2
- package/dist/src/lib/github/v4/fetch-pull-request-auto-merge-method.js +10 -10
- package/dist/src/lib/github/v4/fetch-pull-request-auto-merge-method.js.map +1 -1
- package/dist/src/lib/github/v4/{fetch-pull-request-id2.d.ts → fetch-pull-request-id.d.ts} +1 -1
- package/dist/src/lib/github/v4/fetch-pull-request-id.js +36 -0
- package/dist/src/lib/github/v4/fetch-pull-request-id.js.map +1 -0
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-pull-number.d.ts +2 -2
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-pull-number.js +26 -21
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-pull-number.js.map +1 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-sha.d.ts +2 -2
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-sha.js +19 -16
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-sha.js.map +1 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.d.ts +2 -2
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.js +41 -33
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.js.map +1 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-for-rebase-and-merge-strategy.d.ts +1 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-for-rebase-and-merge-strategy.js +16 -16
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-for-rebase-and-merge-strategy.js.map +1 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-pull-requests-by-search-query.d.ts +1 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-pull-requests-by-search-query.js +24 -22
- package/dist/src/lib/github/v4/fetchCommits/fetch-pull-requests-by-search-query.js.map +1 -1
- package/dist/src/lib/github/v4/get-invalid-access-token-message.d.ts +1 -1
- package/dist/src/lib/github/v4/get-invalid-access-token-message.js +18 -17
- package/dist/src/lib/github/v4/get-invalid-access-token-message.js.map +1 -1
- package/dist/src/lib/github/v4/get-repo-owner-and-name-from-git-remotes.js +18 -19
- package/dist/src/lib/github/v4/get-repo-owner-and-name-from-git-remotes.js.map +1 -1
- package/dist/src/lib/github/v4/getOptionsFromGithub/get-options-from-github.d.ts +4 -8
- package/dist/src/lib/github/v4/getOptionsFromGithub/get-options-from-github.js +48 -42
- package/dist/src/lib/github/v4/getOptionsFromGithub/get-options-from-github.js.map +1 -1
- package/dist/src/lib/github/v4/index.d.ts +20 -0
- package/dist/src/lib/github/v4/index.js +23 -0
- package/dist/src/lib/github/v4/index.js.map +1 -0
- package/dist/src/lib/github/v4/mocks/commits-by-author-mock.d.ts +1 -1
- package/dist/src/lib/github/v4/mocks/commits-by-author-mock.js +3 -6
- package/dist/src/lib/github/v4/mocks/commits-by-author-mock.js.map +1 -1
- package/dist/src/lib/github/v4/validate-target-branch.js +13 -14
- package/dist/src/lib/github/v4/validate-target-branch.js.map +1 -1
- package/dist/src/lib/logger.js +15 -56
- package/dist/src/lib/logger.js.map +1 -1
- package/dist/src/lib/ora.d.ts +4 -4
- package/dist/src/lib/ora.js +5 -12
- package/dist/src/lib/ora.js.map +1 -1
- package/dist/src/lib/prompts.d.ts +2 -2
- package/dist/src/lib/prompts.js +56 -59
- package/dist/src/lib/prompts.js.map +1 -1
- package/dist/src/lib/register-handlebars-helpers.js +5 -11
- package/dist/src/lib/register-handlebars-helpers.js.map +1 -1
- package/dist/src/lib/remote-config.d.ts +6 -3
- package/dist/src/lib/remote-config.js +14 -14
- package/dist/src/lib/remote-config.js.map +1 -1
- package/dist/src/lib/run-sequentially.d.ts +11 -14
- package/dist/src/lib/run-sequentially.js +27 -52
- package/dist/src/lib/run-sequentially.js.map +1 -1
- package/dist/src/lib/sequential-helper.d.ts +2 -0
- package/dist/src/lib/sequential-helper.js +9 -0
- package/dist/src/lib/sequential-helper.js.map +1 -0
- package/dist/src/lib/setup-repo.d.ts +1 -1
- package/dist/src/lib/setup-repo.js +31 -37
- package/dist/src/lib/setup-repo.js.map +1 -1
- package/dist/src/lib/sourceCommit/get-mock-source-commit.d.ts +1 -1
- package/dist/src/lib/sourceCommit/get-mock-source-commit.js +2 -5
- package/dist/src/lib/sourceCommit/get-mock-source-commit.js.map +1 -1
- package/dist/src/lib/sourceCommit/get-pull-request-states.d.ts +2 -2
- package/dist/src/lib/sourceCommit/get-pull-request-states.js +18 -22
- package/dist/src/lib/sourceCommit/get-pull-request-states.js.map +1 -1
- package/dist/src/lib/sourceCommit/get-source-pull-request.d.ts +22 -2
- package/dist/src/lib/sourceCommit/get-source-pull-request.js +2 -5
- package/dist/src/lib/sourceCommit/get-source-pull-request.js.map +1 -1
- package/dist/src/lib/sourceCommit/is-pull-request-cross-referenced-event.d.ts +1 -1
- package/dist/src/lib/sourceCommit/is-pull-request-cross-referenced-event.js +1 -4
- package/dist/src/lib/sourceCommit/is-pull-request-cross-referenced-event.js.map +1 -1
- package/dist/src/lib/sourceCommit/parse-source-commit.d.ts +3 -3
- package/dist/src/lib/sourceCommit/parse-source-commit.js +17 -21
- package/dist/src/lib/sourceCommit/parse-source-commit.js.map +1 -1
- package/dist/src/options/cli-args.d.ts +19 -19
- package/dist/src/options/cli-args.js +29 -25
- package/dist/src/options/cli-args.js.map +1 -1
- package/dist/src/options/config/config.d.ts +6 -10
- package/dist/src/options/config/config.js +5 -8
- package/dist/src/options/config/config.js.map +1 -1
- package/dist/src/options/config/global-config.d.ts +1 -1
- package/dist/src/options/config/global-config.js +22 -28
- package/dist/src/options/config/global-config.js.map +1 -1
- package/dist/src/options/config/project-config.d.ts +1 -1
- package/dist/src/options/config/project-config.js +7 -13
- package/dist/src/options/config/project-config.js.map +1 -1
- package/dist/src/options/config/read-config-file.d.ts +1 -1
- package/dist/src/options/config/read-config-file.js +16 -20
- package/dist/src/options/config/read-config-file.js.map +1 -1
- package/dist/src/options/config-options.d.ts +3 -1
- package/dist/src/options/config-options.js +1 -2
- package/dist/src/options/option-schema.d.ts +189 -0
- package/dist/src/options/option-schema.js +123 -0
- package/dist/src/options/option-schema.js.map +1 -0
- package/dist/src/options/options.d.ts +6 -119
- package/dist/src/options/options.js +65 -108
- package/dist/src/options/options.js.map +1 -1
- package/dist/src/scripts/postinstall.js +10 -13
- package/dist/src/scripts/postinstall.js.map +1 -1
- package/dist/src/scripts/run-postinstall.js +2 -4
- package/dist/src/scripts/run-postinstall.js.map +1 -1
- package/dist/src/types/index.d.ts +10 -0
- package/dist/src/types/index.js +6 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utils/exclude-undefined.js +1 -4
- package/dist/src/utils/exclude-undefined.js.map +1 -1
- package/dist/src/utils/filter-empty.js +1 -4
- package/dist/src/utils/filter-empty.js.map +1 -1
- package/dist/src/utils/filter-unmerged-commits.d.ts +1 -1
- package/dist/src/utils/filter-unmerged-commits.js +1 -4
- package/dist/src/utils/filter-unmerged-commits.js.map +1 -1
- package/dist/src/utils/is-errno-error.js +1 -4
- package/dist/src/utils/is-errno-error.js.map +1 -1
- package/dist/src/utils/package-version.d.ts +1 -1
- package/dist/src/utils/package-version.js +20 -9
- package/dist/src/utils/package-version.js.map +1 -1
- package/package.json +66 -71
- package/dist/package.json +0 -125
- package/dist/src/entrypoint.module.private.test.d.ts +0 -1
- package/dist/src/entrypoint.module.private.test.js +0 -501
- package/dist/src/entrypoint.module.private.test.js.map +0 -1
- package/dist/src/lib/apm.d.ts +0 -1
- package/dist/src/lib/apm.js +0 -33
- package/dist/src/lib/apm.js.map +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/cherrypick-and-create-target-pull-request.test.d.ts +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/cherrypick-and-create-target-pull-request.test.js +0 -371
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/cherrypick-and-create-target-pull-request.test.js.map +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-backport-branch-name.test.d.ts +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-backport-branch-name.test.js +0 -74
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-backport-branch-name.test.js.map +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-commits-without-backports.test.d.ts +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-commits-without-backports.test.js +0 -382
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/get-commits-without-backports.test.js.map +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-configured-target-pr-labels.test.d.ts +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-configured-target-pr-labels.test.js +0 -126
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-configured-target-pr-labels.test.js.map +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-source-pr-labels-to-copy.test.d.ts +0 -1
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-source-pr-labels-to-copy.test.js +0 -85
- package/dist/src/lib/cherrypickAndCreateTargetPullRequest/getTargetPRLabels/get-source-pr-labels-to-copy.test.js.map +0 -1
- package/dist/src/lib/env.test.d.ts +0 -1
- package/dist/src/lib/env.test.js +0 -27
- package/dist/src/lib/env.test.js.map +0 -1
- package/dist/src/lib/get-target-branches.test.d.ts +0 -1
- package/dist/src/lib/get-target-branches.test.js +0 -263
- package/dist/src/lib/get-target-branches.test.js.map +0 -1
- package/dist/src/lib/git.d.ts +0 -89
- package/dist/src/lib/git.js +0 -537
- package/dist/src/lib/git.js.map +0 -1
- package/dist/src/lib/git.private.test.d.ts +0 -1
- package/dist/src/lib/git.private.test.js +0 -619
- package/dist/src/lib/git.private.test.js.map +0 -1
- package/dist/src/lib/git.test.d.ts +0 -1
- package/dist/src/lib/git.test.js +0 -1053
- package/dist/src/lib/git.test.js.map +0 -1
- package/dist/src/lib/github/commit-formatters.test.d.ts +0 -1
- package/dist/src/lib/github/commit-formatters.test.js +0 -12
- package/dist/src/lib/github/commit-formatters.test.js.map +0 -1
- package/dist/src/lib/github/v3/add-assignees-to-pull-request.test.d.ts +0 -1
- package/dist/src/lib/github/v3/add-assignees-to-pull-request.test.js +0 -31
- package/dist/src/lib/github/v3/add-assignees-to-pull-request.test.js.map +0 -1
- package/dist/src/lib/github/v3/create-status-comment.test.d.ts +0 -1
- package/dist/src/lib/github/v3/create-status-comment.test.js +0 -664
- package/dist/src/lib/github/v3/create-status-comment.test.js.map +0 -1
- package/dist/src/lib/github/v3/get-reviewers-from-pull-requests.ts.private.test.d.ts +0 -1
- package/dist/src/lib/github/v3/get-reviewers-from-pull-requests.ts.private.test.js +0 -34
- package/dist/src/lib/github/v3/get-reviewers-from-pull-requests.ts.private.test.js.map +0 -1
- package/dist/src/lib/github/v3/getPullRequest/create-pull-request.js +0 -67
- package/dist/src/lib/github/v3/getPullRequest/create-pull-request.js.map +0 -1
- package/dist/src/lib/github/v3/getPullRequest/get-pull-request-body.js +0 -63
- package/dist/src/lib/github/v3/getPullRequest/get-pull-request-body.js.map +0 -1
- package/dist/src/lib/github/v3/getPullRequest/get-pull-request-body.test.d.ts +0 -1
- package/dist/src/lib/github/v3/getPullRequest/get-pull-request-body.test.js +0 -447
- package/dist/src/lib/github/v3/getPullRequest/get-pull-request-body.test.js.map +0 -1
- package/dist/src/lib/github/v3/getPullRequest/get-title.js +0 -33
- package/dist/src/lib/github/v3/getPullRequest/get-title.js.map +0 -1
- package/dist/src/lib/github/v3/getPullRequest/get-title.test.d.ts +0 -1
- package/dist/src/lib/github/v3/getPullRequest/get-title.test.js +0 -111
- package/dist/src/lib/github/v3/getPullRequest/get-title.test.js.map +0 -1
- package/dist/src/lib/github/v4/client/graphql-client.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/client/graphql-client.private.test.js +0 -93
- package/dist/src/lib/github/v4/client/graphql-client.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/client/logging-exchange.d.ts +0 -2
- package/dist/src/lib/github/v4/client/logging-exchange.js +0 -21
- package/dist/src/lib/github/v4/client/logging-exchange.js.map +0 -1
- package/dist/src/lib/github/v4/client/response-meta-interceptor-exchange.d.ts +0 -2
- package/dist/src/lib/github/v4/client/response-meta-interceptor-exchange.js +0 -45
- package/dist/src/lib/github/v4/client/response-meta-interceptor-exchange.js.map +0 -1
- package/dist/src/lib/github/v4/enable-pull-request-auto-merge.mutation.test.d.ts +0 -1
- package/dist/src/lib/github/v4/enable-pull-request-auto-merge.mutation.test.js +0 -245
- package/dist/src/lib/github/v4/enable-pull-request-auto-merge.mutation.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetch-author-id.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetch-author-id.private.test.js +0 -26
- package/dist/src/lib/github/v4/fetch-author-id.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetch-existing-pull-request.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetch-existing-pull-request.private.test.js +0 -47
- package/dist/src/lib/github/v4/fetch-existing-pull-request.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetch-pull-request-id2.js +0 -33
- package/dist/src/lib/github/v4/fetch-pull-request-id2.js.map +0 -1
- package/dist/src/lib/github/v4/fetchCommits/all-fetchers.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetchCommits/all-fetchers.private.test.js +0 -126
- package/dist/src/lib/github/v4/fetchCommits/all-fetchers.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-pull-number.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-pull-number.private.test.js +0 -110
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-pull-number.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-sha.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-sha.private.test.js +0 -76
- package/dist/src/lib/github/v4/fetchCommits/fetch-commit-by-sha.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.private.test.js +0 -179
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.test.js +0 -168
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-by-author.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-for-rebase-and-merge-strategy.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-for-rebase-and-merge-strategy.private.test.js +0 -30
- package/dist/src/lib/github/v4/fetchCommits/fetch-commits-for-rebase-and-merge-strategy.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-pull-request-by-search-query.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/fetchCommits/fetch-pull-request-by-search-query.private.test.js +0 -150
- package/dist/src/lib/github/v4/fetchCommits/fetch-pull-request-by-search-query.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/get-invalid-access-token-message.test.d.ts +0 -1
- package/dist/src/lib/github/v4/get-invalid-access-token-message.test.js +0 -99
- package/dist/src/lib/github/v4/get-invalid-access-token-message.test.js.map +0 -1
- package/dist/src/lib/github/v4/get-repo-owner-and-name-from-git-remotes.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/get-repo-owner-and-name-from-git-remotes.private.test.js +0 -50
- package/dist/src/lib/github/v4/get-repo-owner-and-name-from-git-remotes.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/getOptionsFromGithub/get-options-from-github.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/getOptionsFromGithub/get-options-from-github.private.test.js +0 -119
- package/dist/src/lib/github/v4/getOptionsFromGithub/get-options-from-github.private.test.js.map +0 -1
- package/dist/src/lib/github/v4/validate-target-branch.private.test.d.ts +0 -1
- package/dist/src/lib/github/v4/validate-target-branch.private.test.js +0 -24
- package/dist/src/lib/github/v4/validate-target-branch.private.test.js.map +0 -1
- package/dist/src/lib/prompt.test.d.ts +0 -1
- package/dist/src/lib/prompt.test.js +0 -181
- package/dist/src/lib/prompt.test.js.map +0 -1
- package/dist/src/lib/sequentially.d.ts +0 -1
- package/dist/src/lib/sequentially.js +0 -11
- package/dist/src/lib/sequentially.js.map +0 -1
- package/dist/src/lib/setup-repo.test.d.ts +0 -1
- package/dist/src/lib/setup-repo.test.js +0 -283
- package/dist/src/lib/setup-repo.test.js.map +0 -1
- package/dist/src/lib/sourceCommit/get-pull-request-states.test.d.ts +0 -1
- package/dist/src/lib/sourceCommit/get-pull-request-states.test.js +0 -706
- package/dist/src/lib/sourceCommit/get-pull-request-states.test.js.map +0 -1
- package/dist/src/lib/sourceCommit/parse-source-commit.test.d.ts +0 -1
- package/dist/src/lib/sourceCommit/parse-source-commit.test.js +0 -295
- package/dist/src/lib/sourceCommit/parse-source-commit.test.js.map +0 -1
- package/dist/src/options/cli-args.test.d.ts +0 -1
- package/dist/src/options/cli-args.test.js +0 -307
- package/dist/src/options/cli-args.test.js.map +0 -1
- package/dist/src/options/config/config.test.d.ts +0 -1
- package/dist/src/options/config/config.test.js +0 -32
- package/dist/src/options/config/config.test.js.map +0 -1
- package/dist/src/options/config/global-config.test.d.ts +0 -1
- package/dist/src/options/config/global-config.test.js +0 -62
- package/dist/src/options/config/global-config.test.js.map +0 -1
- package/dist/src/options/config/project-config.test.d.ts +0 -1
- package/dist/src/options/config/project-config.test.js +0 -110
- package/dist/src/options/config/project-config.test.js.map +0 -1
- package/dist/src/options/options.test.d.ts +0 -1
- package/dist/src/options/options.test.js +0 -505
- package/dist/src/options/options.test.js.map +0 -1
- package/dist/src/scripts/binary.integration.test.d.ts +0 -1
- package/dist/src/scripts/binary.integration.test.js +0 -87
- package/dist/src/scripts/binary.integration.test.js.map +0 -1
- package/dist/src/scripts/postinstall.integration.test.d.ts +0 -1
- package/dist/src/scripts/postinstall.integration.test.js +0 -92
- package/dist/src/scripts/postinstall.integration.test.js.map +0 -1
- package/dist/src/scripts/postinstall.test.d.ts +0 -1
- package/dist/src/scripts/postinstall.test.js +0 -68
- package/dist/src/scripts/postinstall.test.js.map +0 -1
- package/dist/src/test/child-process-helper.d.ts +0 -7
- package/dist/src/test/child-process-helper.js +0 -19
- package/dist/src/test/child-process-helper.js.map +0 -1
- package/dist/src/test/e2e/cli/binary.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/binary.private.test.js +0 -53
- package/dist/src/test/e2e/cli/binary.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/commit-author.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/commit-author.private.test.js +0 -79
- package/dist/src/test/e2e/cli/commit-author.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/copy-reviewers-to-target-pull-request.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/copy-reviewers-to-target-pull-request.private.test.js +0 -63
- package/dist/src/test/e2e/cli/copy-reviewers-to-target-pull-request.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/date-filters.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/date-filters.private.test.js +0 -56
- package/dist/src/test/e2e/cli/date-filters.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/different-merge-strategies.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/different-merge-strategies.private.test.js +0 -260
- package/dist/src/test/e2e/cli/different-merge-strategies.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/entrypoint.cli.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/entrypoint.cli.private.test.js +0 -228
- package/dist/src/test/e2e/cli/entrypoint.cli.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/error-handling-interactive-mode.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/error-handling-interactive-mode.private.test.js +0 -91
- package/dist/src/test/e2e/cli/error-handling-interactive-mode.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/error-handling-non-interactive-mode.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/error-handling-non-interactive-mode.private.test.js +0 -203
- package/dist/src/test/e2e/cli/error-handling-non-interactive-mode.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/gracefully-handles-corrupt-repo.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/gracefully-handles-corrupt-repo.private.test.js +0 -57
- package/dist/src/test/e2e/cli/gracefully-handles-corrupt-repo.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/repo-with-backportrc-removed.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/repo-with-backportrc-removed.private.test.js +0 -51
- package/dist/src/test/e2e/cli/repo-with-backportrc-removed.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/repo-with-changing-branch-label-mapping.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/repo-with-changing-branch-label-mapping.private.test.js +0 -98
- package/dist/src/test/e2e/cli/repo-with-changing-branch-label-mapping.private.test.js.map +0 -1
- package/dist/src/test/e2e/cli/repo-with-programatically-added-commits.mutation.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/repo-with-programatically-added-commits.mutation.test.js +0 -114
- package/dist/src/test/e2e/cli/repo-with-programatically-added-commits.mutation.test.js.map +0 -1
- package/dist/src/test/e2e/cli/run-backport-via-cli.d.ts +0 -21
- package/dist/src/test/e2e/cli/run-backport-via-cli.js +0 -104
- package/dist/src/test/e2e/cli/run-backport-via-cli.js.map +0 -1
- package/dist/src/test/e2e/cli/test-that-repo-can-be-cloned.private.test.d.ts +0 -1
- package/dist/src/test/e2e/cli/test-that-repo-can-be-cloned.private.test.js +0 -91
- package/dist/src/test/e2e/cli/test-that-repo-can-be-cloned.private.test.js.map +0 -1
- package/dist/src/test/e2e/module/entrypoint.module.mutation.test.d.ts +0 -1
- package/dist/src/test/e2e/module/entrypoint.module.mutation.test.js +0 -378
- package/dist/src/test/e2e/module/entrypoint.module.mutation.test.js.map +0 -1
- package/dist/src/test/handle-unbackported-pull-requests.private.test.d.ts +0 -1
- package/dist/src/test/handle-unbackported-pull-requests.private.test.js +0 -71
- package/dist/src/test/handle-unbackported-pull-requests.private.test.js.map +0 -1
- package/dist/src/test/mock-config-files.d.ts +0 -5
- package/dist/src/test/mock-config-files.js +0 -21
- package/dist/src/test/mock-config-files.js.map +0 -1
- package/dist/src/test/nock-helpers.d.ts +0 -18
- package/dist/src/test/nock-helpers.js +0 -33
- package/dist/src/test/nock-helpers.js.map +0 -1
- package/dist/src/test/private/get-dev-access-token.d.ts +0 -2
- package/dist/src/test/private/get-dev-access-token.js +0 -12
- package/dist/src/test/private/get-dev-access-token.js.map +0 -1
- package/dist/src/test/replace-string-and-linebreaks.d.ts +0 -6
- package/dist/src/test/replace-string-and-linebreaks.js +0 -14
- package/dist/src/test/replace-string-and-linebreaks.js.map +0 -1
- package/dist/src/test/sandbox.d.ts +0 -6
- package/dist/src/test/sandbox.js +0 -63
- package/dist/src/test/sandbox.js.map +0 -1
- package/dist/src/test/setupFiles/automatic-mocks.d.ts +0 -1
- package/dist/src/test/setupFiles/automatic-mocks.js +0 -79
- package/dist/src/test/setupFiles/automatic-mocks.js.map +0 -1
- package/dist/src/test/setupFiles/jest-retry.d.ts +0 -0
- package/dist/src/test/setupFiles/jest-retry.js +0 -3
- package/dist/src/test/setupFiles/jest-retry.js.map +0 -1
- package/dist/src/test/setupFiles/nock-cleanup.d.ts +0 -1
- package/dist/src/test/setupFiles/nock-cleanup.js +0 -16
- package/dist/src/test/setupFiles/nock-cleanup.js.map +0 -1
- package/dist/src/utils/exclude-undefined.test.d.ts +0 -1
- package/dist/src/utils/exclude-undefined.test.js +0 -25
- package/dist/src/utils/exclude-undefined.test.js.map +0 -1
- package/dist/src/utils/maybe.d.ts +0 -1
- package/dist/src/utils/maybe.js +0 -7
- package/dist/src/utils/maybe.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const graphql_client_1 = require("../client/graphql-client");
|
|
10
|
-
const get_invalid_access_token_message_1 = require("../get-invalid-access-token-message");
|
|
11
|
-
async function getOptionsFromGithub(options) {
|
|
1
|
+
import { graphql } from '../../../../graphql/generated/index.js';
|
|
2
|
+
import { BackportError } from '../../../backport-error.js';
|
|
3
|
+
import { getLocalConfigFileCommitDate, isLocalConfigFileUntracked, isLocalConfigFileModified, } from '../../../git/index.js';
|
|
4
|
+
import { logger } from '../../../logger.js';
|
|
5
|
+
import { parseRemoteConfigFile, isMissingConfigFileException, } from '../../../remote-config.js';
|
|
6
|
+
import { graphqlRequest } from '../client/graphql-client.js';
|
|
7
|
+
import { getInvalidAccessTokenMessage } from '../get-invalid-access-token-message.js';
|
|
8
|
+
export async function getOptionsFromGithub(options) {
|
|
12
9
|
const { accessToken, githubApiBaseUrlV4, repoName, repoOwner, globalConfigFile, } = options;
|
|
13
|
-
const query =
|
|
10
|
+
const query = graphql(`
|
|
14
11
|
query GithubConfigOptions($repoOwner: String!, $repoName: String!) {
|
|
15
12
|
viewer {
|
|
16
13
|
login
|
|
@@ -32,34 +29,48 @@ async function getOptionsFromGithub(options) {
|
|
|
32
29
|
}
|
|
33
30
|
`);
|
|
34
31
|
const variables = { repoOwner, repoName };
|
|
35
|
-
const
|
|
36
|
-
const result = await client.query(query, variables);
|
|
32
|
+
const result = await graphqlRequest({ accessToken, githubApiBaseUrlV4 }, query, variables);
|
|
37
33
|
if (result.error) {
|
|
38
|
-
const isInvalidAccessTokenMessage =
|
|
34
|
+
const isInvalidAccessTokenMessage = getInvalidAccessTokenMessage({
|
|
39
35
|
result,
|
|
40
36
|
repoName,
|
|
41
37
|
repoOwner,
|
|
42
38
|
globalConfigFile,
|
|
43
39
|
});
|
|
44
40
|
if (isInvalidAccessTokenMessage) {
|
|
45
|
-
throw new
|
|
41
|
+
throw new BackportError({
|
|
42
|
+
code: 'invalid-credentials-exception',
|
|
43
|
+
message: isInvalidAccessTokenMessage,
|
|
44
|
+
});
|
|
46
45
|
}
|
|
47
|
-
if (!
|
|
48
|
-
throw new
|
|
46
|
+
if (!isMissingConfigFileException(result)) {
|
|
47
|
+
throw new BackportError({
|
|
48
|
+
code: 'github-api-exception',
|
|
49
|
+
message: result.error.message,
|
|
50
|
+
});
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
const insufficientPermissionsErrorMessage = getInsufficientPermissionsErrorMessage(result);
|
|
52
54
|
if (insufficientPermissionsErrorMessage) {
|
|
53
|
-
throw new
|
|
55
|
+
throw new BackportError({
|
|
56
|
+
code: 'invalid-credentials-exception',
|
|
57
|
+
message: insufficientPermissionsErrorMessage,
|
|
58
|
+
});
|
|
54
59
|
}
|
|
55
60
|
const { data } = result;
|
|
56
61
|
// it is not possible to have a branch named "backport"
|
|
57
62
|
if (data?.repository?.illegalBackportBranch) {
|
|
58
|
-
throw new
|
|
63
|
+
throw new BackportError({
|
|
64
|
+
code: 'config-error-exception',
|
|
65
|
+
message: 'You must delete the branch "backport" to continue. See https://github.com/sorenlouv/backport/issues/155 for details',
|
|
66
|
+
});
|
|
59
67
|
}
|
|
60
68
|
const remoteConfig = await getRemoteConfigFileOptions(data, options.cwd, options.skipRemoteConfig);
|
|
61
69
|
if (!data) {
|
|
62
|
-
throw new
|
|
70
|
+
throw new BackportError({
|
|
71
|
+
code: 'config-error-exception',
|
|
72
|
+
message: 'Failed to fetch options from GitHub. Please check your access token and repository settings.',
|
|
73
|
+
});
|
|
63
74
|
}
|
|
64
75
|
return {
|
|
65
76
|
authenticatedUsername: data.viewer.login,
|
|
@@ -70,57 +81,52 @@ async function getOptionsFromGithub(options) {
|
|
|
70
81
|
}
|
|
71
82
|
async function getRemoteConfigFileOptions(res, cwd, skipRemoteConfig) {
|
|
72
83
|
if (skipRemoteConfig) {
|
|
73
|
-
|
|
84
|
+
logger.info('Remote config: Skipping. `--skip-remote-config` specified via config file or cli');
|
|
74
85
|
return;
|
|
75
86
|
}
|
|
76
87
|
if (res?.repository?.defaultBranchRef?.target?.__typename !== 'Commit') {
|
|
77
|
-
|
|
88
|
+
logger.info('Remote config: Skipping. Default branch is not a commit');
|
|
78
89
|
return;
|
|
79
90
|
}
|
|
80
|
-
const remoteConfig = res.repository.defaultBranchRef.target.remoteConfigHistory.edges?.
|
|
81
|
-
?.remoteConfig;
|
|
91
|
+
const remoteConfig = res.repository.defaultBranchRef.target.remoteConfigHistory.edges?.at(0)?.remoteConfig;
|
|
82
92
|
if (!remoteConfig) {
|
|
83
|
-
|
|
93
|
+
logger.info("Remote config: Skipping. Remote config doesn't exist");
|
|
84
94
|
return;
|
|
85
95
|
}
|
|
86
96
|
if (cwd) {
|
|
87
97
|
const [isLocalConfigModified, isLocalConfigUntracked, localCommitDate] = await Promise.all([
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
isLocalConfigFileModified({ cwd }),
|
|
99
|
+
isLocalConfigFileUntracked({ cwd }),
|
|
100
|
+
getLocalConfigFileCommitDate({ cwd }),
|
|
91
101
|
]);
|
|
92
102
|
if (isLocalConfigUntracked) {
|
|
93
|
-
|
|
103
|
+
logger.info('Remote config: Skipping. Local config is new');
|
|
94
104
|
return;
|
|
95
105
|
}
|
|
96
106
|
if (isLocalConfigModified) {
|
|
97
|
-
|
|
107
|
+
logger.info('Remote config: Skipping. Local config is modified');
|
|
98
108
|
return;
|
|
99
109
|
}
|
|
100
110
|
if (localCommitDate &&
|
|
101
111
|
localCommitDate > Date.parse(remoteConfig.committedDate)) {
|
|
102
|
-
|
|
112
|
+
logger.info(`Remote config: Skipping. Local config is newer: ${new Date(localCommitDate).toISOString()} > ${remoteConfig.committedDate}`);
|
|
103
113
|
return;
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
|
-
|
|
107
|
-
return
|
|
116
|
+
logger.info('Remote config: Parsing.');
|
|
117
|
+
return parseRemoteConfigFile(remoteConfig);
|
|
108
118
|
}
|
|
109
119
|
function getInsufficientPermissionsErrorMessage(res) {
|
|
110
|
-
const
|
|
111
|
-
const accessScopesHeader = responseHeaders.get('x-oauth-scopes');
|
|
120
|
+
const accessScopesHeader = res.responseHeaders?.get('x-oauth-scopes');
|
|
112
121
|
if (accessScopesHeader == null) {
|
|
113
122
|
return;
|
|
114
123
|
}
|
|
115
|
-
const accessTokenScopes = accessScopesHeader
|
|
116
|
-
.split(',')
|
|
117
|
-
.map((scope) => scope.trim());
|
|
124
|
+
const accessTokenScopes = new Set(accessScopesHeader.split(',').map((scope) => scope.trim()));
|
|
118
125
|
const isRepoPrivate = res.data?.repository?.isPrivate;
|
|
119
|
-
if (isRepoPrivate && !accessTokenScopes.
|
|
126
|
+
if (isRepoPrivate && !accessTokenScopes.has('repo')) {
|
|
120
127
|
return `You must grant the "repo" scope to your personal access token`;
|
|
121
128
|
}
|
|
122
|
-
if (!accessTokenScopes.
|
|
123
|
-
!accessTokenScopes.includes('public_repo')) {
|
|
129
|
+
if (!accessTokenScopes.has('repo') && !accessTokenScopes.has('public_repo')) {
|
|
124
130
|
return `You must grant the "repo" or "public_repo" scope to your personal access token`;
|
|
125
131
|
}
|
|
126
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-options-from-github.js","sourceRoot":"","sources":["../../../../../../src/lib/github/v4/getOptionsFromGithub/get-options-from-github.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-options-from-github.js","sourceRoot":"","sources":["../../../../../../src/lib/github/v4/getOptionsFromGithub/get-options-from-github.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAUtF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAS1C;IACC,MAAM,EACJ,WAAW,EACX,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,GAAG,OAAO,CAAC;IAEZ,MAAM,KAAK,GAAG,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;GAoBrB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAG,MAAM,cAAc,CACjC,EAAE,WAAW,EAAE,kBAAkB,EAAE,EACnC,KAAK,EACL,SAAS,CACV,CAAC;IAEF,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,2BAA2B,GAAG,4BAA4B,CAAC;YAC/D,MAAM;YACN,QAAQ;YACR,SAAS;YACT,gBAAgB;SACjB,CAAC,CAAC;QAEH,IAAI,2BAA2B,EAAE,CAAC;YAChC,MAAM,IAAI,aAAa,CAAC;gBACtB,IAAI,EAAE,+BAA+B;gBACrC,OAAO,EAAE,2BAA2B;aACrC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,4B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,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACvC,OAAO,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,sCAAsC,CAC7C,GAAsD;IAEtD,MAAM,kBAAkB,GAAG,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACtE,IAAI,kBAAkB,IAAI,IAAI,EAAE,CAAC;QAC/B,OAAO;IACT,CAAC;IAED,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAC/B,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAC3D,CAAC;IAEF,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;IAEtD,IAAI,aAAa,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACpD,OAAO,+DAA+D,CAAC;IACzE,CAAC;IAED,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;QAC5E,OAAO,gFAAgF,CAAC;IAC1F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Barrel export for GitHub GraphQL (v4) API operations. */
|
|
2
|
+
export { graphqlRequest } from './client/graphql-client.js';
|
|
3
|
+
export type { GitHubGraphQLError, OperationResultWithMeta, } from './client/graphql-client.js';
|
|
4
|
+
export { fetchCommitsByPullNumber } from './fetchCommits/fetch-commit-by-pull-number.js';
|
|
5
|
+
export { fetchCommitBySha } from './fetchCommits/fetch-commit-by-sha.js';
|
|
6
|
+
export { fetchCommitsByAuthor } from './fetchCommits/fetch-commits-by-author.js';
|
|
7
|
+
export { fetchCommitsForRebaseAndMergeStrategy } from './fetchCommits/fetch-commits-for-rebase-and-merge-strategy.js';
|
|
8
|
+
export { fetchPullRequestsBySearchQuery } from './fetchCommits/fetch-pull-requests-by-search-query.js';
|
|
9
|
+
export { fetchExistingPullRequest } from './fetch-existing-pull-request.js';
|
|
10
|
+
export { fetchPullRequestId } from './fetch-pull-request-id.js';
|
|
11
|
+
export { fetchPullRequestAutoMergeMethod } from './fetch-pull-request-auto-merge-method.js';
|
|
12
|
+
export { enablePullRequestAutoMerge } from './enable-pull-request-auto-merge.js';
|
|
13
|
+
export { disablePullRequestAutoMerge } from './disable-pull-request-auto-merge.js';
|
|
14
|
+
export { fetchAuthorId } from './fetch-author-id.js';
|
|
15
|
+
export { getInvalidAccessTokenMessage } from './get-invalid-access-token-message.js';
|
|
16
|
+
export { getRepoOwnerAndNameFromGitRemotes } from './get-repo-owner-and-name-from-git-remotes.js';
|
|
17
|
+
export { getOptionsFromGithub } from './getOptionsFromGithub/get-options-from-github.js';
|
|
18
|
+
export type { OptionsFromGithub } from './getOptionsFromGithub/get-options-from-github.js';
|
|
19
|
+
export { validateTargetBranch } from './validate-target-branch.js';
|
|
20
|
+
export type { TargetBranchResponse } from './validate-target-branch.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Barrel export for GitHub GraphQL (v4) API operations. */
|
|
2
|
+
// Client
|
|
3
|
+
export { graphqlRequest } from './client/graphql-client.js';
|
|
4
|
+
// Commit fetching
|
|
5
|
+
export { fetchCommitsByPullNumber } from './fetchCommits/fetch-commit-by-pull-number.js';
|
|
6
|
+
export { fetchCommitBySha } from './fetchCommits/fetch-commit-by-sha.js';
|
|
7
|
+
export { fetchCommitsByAuthor } from './fetchCommits/fetch-commits-by-author.js';
|
|
8
|
+
export { fetchCommitsForRebaseAndMergeStrategy } from './fetchCommits/fetch-commits-for-rebase-and-merge-strategy.js';
|
|
9
|
+
export { fetchPullRequestsBySearchQuery } from './fetchCommits/fetch-pull-requests-by-search-query.js';
|
|
10
|
+
// PR operations
|
|
11
|
+
export { fetchExistingPullRequest } from './fetch-existing-pull-request.js';
|
|
12
|
+
export { fetchPullRequestId } from './fetch-pull-request-id.js';
|
|
13
|
+
export { fetchPullRequestAutoMergeMethod } from './fetch-pull-request-auto-merge-method.js';
|
|
14
|
+
export { enablePullRequestAutoMerge } from './enable-pull-request-auto-merge.js';
|
|
15
|
+
export { disablePullRequestAutoMerge } from './disable-pull-request-auto-merge.js';
|
|
16
|
+
// Auth & config
|
|
17
|
+
export { fetchAuthorId } from './fetch-author-id.js';
|
|
18
|
+
export { getInvalidAccessTokenMessage } from './get-invalid-access-token-message.js';
|
|
19
|
+
export { getRepoOwnerAndNameFromGitRemotes } from './get-repo-owner-and-name-from-git-remotes.js';
|
|
20
|
+
export { getOptionsFromGithub } from './getOptionsFromGithub/get-options-from-github.js';
|
|
21
|
+
// Validation
|
|
22
|
+
export { validateTargetBranch } from './validate-target-branch.js';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/github/v4/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,SAAS;AACT,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAM5D,kBAAkB;AAClB,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qCAAqC,EAAE,MAAM,+DAA+D,CAAC;AACtH,OAAO,EAAE,8BAA8B,EAAE,MAAM,uDAAuD,CAAC;AAEvG,gBAAgB;AAChB,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF,gBAAgB;AAChB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,iCAAiC,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAGzF,aAAa;AACb,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CommitsByAuthorQuery } from '../../../../graphql/generated/graphql';
|
|
1
|
+
import type { CommitsByAuthorQuery } from '../../../../graphql/generated/graphql.js';
|
|
2
2
|
export declare const commitsByAuthorMock: CommitsByAuthorQuery;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.commitsByAuthorMock = void 0;
|
|
4
|
-
const graphql_1 = require("../../../../graphql/generated/graphql");
|
|
5
|
-
exports.commitsByAuthorMock = {
|
|
1
|
+
import { PullRequestState } from '../../../../graphql/generated/graphql.js';
|
|
2
|
+
export const commitsByAuthorMock = {
|
|
6
3
|
repository: {
|
|
7
4
|
ref: {
|
|
8
5
|
target: {
|
|
@@ -116,7 +113,7 @@ exports.commitsByAuthorMock = {
|
|
|
116
113
|
},
|
|
117
114
|
url: 'https://github.com/elastic/kibana/pull/99',
|
|
118
115
|
title: 'some title',
|
|
119
|
-
state:
|
|
116
|
+
state: PullRequestState.Merged,
|
|
120
117
|
number: 99,
|
|
121
118
|
baseRefName: '6.3',
|
|
122
119
|
commits: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commits-by-author-mock.js","sourceRoot":"","sources":["../../../../../../src/lib/github/v4/mocks/commits-by-author-mock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commits-by-author-mock.js","sourceRoot":"","sources":["../../../../../../src/lib/github/v4/mocks/commits-by-author-mock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,CAAC,MAAM,mBAAmB,GAAyB;IACvD,UAAU,EAAE;QACV,GAAG,EAAE;YACH,MAAM,EAAE;gBACN,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE;oBACP,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE;gCACJ,UAAU,EAAE,QAAQ;gCACpB,MAAM,EAAE;oCACN,KAAK,EAAE,uBAAuB;oCAC9B,IAAI,EAAE,mBAAmB;iCAC1B;gCACD,UAAU,EAAE;oCACV,IAAI,EAAE,QAAQ;oCACd,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;iCAC5B;gCACD,aAAa,EAAE,sBAAsB;gCACrC,GAAG,EAAE,0CAA0C;gCAC/C,OAAO,EAAE,QAAQ;gCACjB,sBAAsB,EAAE;oCACtB,KAAK,EAAE,EAAE;iCACV;6BACF;yBACF;wBACD;4BACE,IAAI,EAAE;gCACJ,UAAU,EAAE,QAAQ;gCACpB,MAAM,EAAE;oCACN,KAAK,EAAE,uBAAuB;oCAC9B,IAAI,EAAE,mBAAmB;iCAC1B;gCACD,UAAU,EAAE;oCACV,IAAI,EAAE,QAAQ;oCACd,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;iCAC5B;gCACD,aAAa,EAAE,sBAAsB;gCACrC,GAAG,EAAE,0CAA0C;gCAC/C,OAAO,EAAE,iBAAiB;gCAC1B,sBAAsB,EAAE;oCACtB,KAAK,EAAE;wCACL;4CACE,IAAI,EAAE;gDACJ,KAAK,EAAE,sBAAsB;gDAC7B,GAAG,EAAE,2CAA2C;gDAChD,WAAW,EAAE,QAAQ;gDACrB,MAAM,EAAE;oDACN,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;iDAChC;g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iBACF;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const graphql_client_1 = require("./client/graphql-client");
|
|
8
|
-
async function validateTargetBranch({ accessToken, repoName, repoOwner, branchName, githubApiBaseUrlV4 = 'https://api.github.com/graphql', interactive, }) {
|
|
9
|
-
const query = (0, generated_1.graphql)(`
|
|
1
|
+
import { graphql } from '../../../graphql/generated/index.js';
|
|
2
|
+
import { BackportError } from '../../backport-error.js';
|
|
3
|
+
import { ora } from '../../ora.js';
|
|
4
|
+
import { graphqlRequest } from './client/graphql-client.js';
|
|
5
|
+
export async function validateTargetBranch({ accessToken, repoName, repoOwner, branchName, githubApiBaseUrlV4 = 'https://api.github.com/graphql', interactive, }) {
|
|
6
|
+
const query = graphql(`
|
|
10
7
|
query GetBranchId(
|
|
11
8
|
$repoOwner: String!
|
|
12
9
|
$repoName: String!
|
|
@@ -19,16 +16,18 @@ async function validateTargetBranch({ accessToken, repoName, repoOwner, branchNa
|
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
`);
|
|
22
|
-
const spinner =
|
|
19
|
+
const spinner = ora(interactive, '').start();
|
|
23
20
|
const variables = { repoOwner, repoName, branchName };
|
|
24
|
-
const
|
|
25
|
-
const result = await client.query(query, variables);
|
|
21
|
+
const result = await graphqlRequest({ accessToken, githubApiBaseUrlV4 }, query, variables);
|
|
26
22
|
if (result.error) {
|
|
27
|
-
throw new
|
|
23
|
+
throw new BackportError({
|
|
24
|
+
code: 'github-api-exception',
|
|
25
|
+
message: result.error.message,
|
|
26
|
+
});
|
|
28
27
|
}
|
|
29
28
|
if (!result.data?.repository?.ref) {
|
|
30
29
|
spinner.fail(`The branch "${branchName}" does not exist`);
|
|
31
|
-
throw new
|
|
30
|
+
throw new BackportError({
|
|
32
31
|
code: 'invalid-branch-exception',
|
|
33
32
|
branchName: branchName,
|
|
34
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-target-branch.js","sourceRoot":"","sources":["../../../../../src/lib/github/v4/validate-target-branch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-target-branch.js","sourceRoot":"","sources":["../../../../../src/lib/github/v4/validate-target-branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAM5D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,SAAS,EACT,UAAU,EACV,kBAAkB,GAAG,gCAAgC,EACrD,WAAW,GAQZ;IACC,MAAM,KAAK,GAAG,OAAO,CAAC;;;;;;;;;;;;GAYrB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IAC7C,MAAM,SAAS,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IACtD,MAAM,MAAM,GAAG,MAAM,cAAc,CACjC,EAAE,WAAW,EAAE,kBAAkB,EAAE,EACnC,KAAK,EACL,SAAS,CACV,CAAC;IAEF,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,IAAI,aAAa,CAAC;YACtB,IAAI,EAAE,sBAAsB;YAC5B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,eAAe,UAAU,kBAAkB,CAAC,CAAC;QAC1D,MAAM,IAAI,aAAa,CAAC;YACtB,IAAI,EAAE,0BAA0B;YAChC,UAAU,EAAE,UAAU;SACvB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,IAAI,EAAE,CAAC;IAEf,OAAO;AACT,CAAC"}
|
package/dist/src/lib/logger.js
CHANGED
|
@@ -1,47 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.logger = void 0;
|
|
37
|
-
exports.initLogger = initLogger;
|
|
38
|
-
exports.consoleLog = consoleLog;
|
|
39
|
-
exports.setAccessToken = setAccessToken;
|
|
40
|
-
exports.redactAccessToken = redactAccessToken;
|
|
41
|
-
exports.accessTokenReplacer = accessTokenReplacer;
|
|
42
|
-
const winston_1 = __importStar(require("winston"));
|
|
43
|
-
const env_1 = require("./env");
|
|
44
|
-
exports.logger = winston_1.default.createLogger({
|
|
1
|
+
import winston, { format } from 'winston';
|
|
2
|
+
import { getLogfilePath } from './env.js';
|
|
3
|
+
export let logger = winston.createLogger({
|
|
45
4
|
transports: [
|
|
46
5
|
fileTransport({ logLevel: 'info' }),
|
|
47
6
|
fileTransport({ logLevel: 'debug' }),
|
|
@@ -49,13 +8,13 @@ exports.logger = winston_1.default.createLogger({
|
|
|
49
8
|
});
|
|
50
9
|
let _accessToken;
|
|
51
10
|
let _interactive;
|
|
52
|
-
function initLogger({ interactive, accessToken, logFilePath, }) {
|
|
11
|
+
export function initLogger({ interactive, accessToken, logFilePath, }) {
|
|
53
12
|
_accessToken = accessToken;
|
|
54
13
|
_interactive = interactive;
|
|
55
|
-
|
|
56
|
-
format:
|
|
14
|
+
logger = winston.createLogger({
|
|
15
|
+
format: format.combine(format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
|
|
57
16
|
// Format the metadata object
|
|
58
|
-
|
|
17
|
+
format.metadata({
|
|
59
18
|
fillExcept: ['message', 'level', 'timestamp', 'label'],
|
|
60
19
|
})),
|
|
61
20
|
transports: logFilePath
|
|
@@ -65,32 +24,32 @@ function initLogger({ interactive, accessToken, logFilePath, }) {
|
|
|
65
24
|
fileTransport({ logLevel: 'debug' }),
|
|
66
25
|
],
|
|
67
26
|
});
|
|
68
|
-
return
|
|
27
|
+
return logger;
|
|
69
28
|
}
|
|
70
29
|
function fileTransport({ logFilePath, logLevel, }) {
|
|
71
|
-
return new
|
|
72
|
-
filename:
|
|
30
|
+
return new winston.transports.File({
|
|
31
|
+
filename: getLogfilePath({ logFilePath, logLevel }),
|
|
73
32
|
level: logLevel,
|
|
74
|
-
format:
|
|
33
|
+
format: format.json({ replacer: accessTokenReplacer }),
|
|
75
34
|
});
|
|
76
35
|
}
|
|
77
36
|
// wrapper around console.log
|
|
78
|
-
function consoleLog(message) {
|
|
37
|
+
export function consoleLog(message) {
|
|
79
38
|
if (_interactive) {
|
|
80
39
|
console.log(redactAccessToken(message));
|
|
81
40
|
}
|
|
82
41
|
}
|
|
83
|
-
function setAccessToken(accessToken) {
|
|
42
|
+
export function setAccessToken(accessToken) {
|
|
84
43
|
_accessToken = accessToken;
|
|
85
44
|
}
|
|
86
|
-
function redactAccessToken(str) {
|
|
45
|
+
export function redactAccessToken(str) {
|
|
87
46
|
// `redactAccessToken` might be called before access token is set
|
|
88
47
|
if (_accessToken) {
|
|
89
48
|
return str.replaceAll(_accessToken, '<REDACTED>');
|
|
90
49
|
}
|
|
91
50
|
return str;
|
|
92
51
|
}
|
|
93
|
-
function accessTokenReplacer(key, value) {
|
|
52
|
+
export function accessTokenReplacer(key, value) {
|
|
94
53
|
return typeof value === 'string' ? redactAccessToken(value) : value;
|
|
95
54
|
}
|
|
96
55
|
//# sourceMappingURL=logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/lib/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/lib/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,CAAC,IAAI,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IACvC,UAAU,EAAE;QACV,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnC,aAA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B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,YAAY,GAAG,WAAW,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,iEAAiE;IACjE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,KAAc;IAC7D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACtE,CAAC"}
|
package/dist/src/lib/ora.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const oraNonInteractiveMode:
|
|
3
|
-
export declare function ora(interactive: boolean | undefined, text?: string | undefined):
|
|
4
|
-
export type Ora
|
|
1
|
+
import { type Ora } from 'ora';
|
|
2
|
+
export declare const oraNonInteractiveMode: Ora;
|
|
3
|
+
export declare function ora(interactive: boolean | undefined, text?: string | undefined): Ora;
|
|
4
|
+
export { type Ora } from 'ora';
|
package/dist/src/lib/ora.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.oraNonInteractiveMode = void 0;
|
|
7
|
-
exports.ora = ora;
|
|
8
|
-
const ora_1 = __importDefault(require("ora"));
|
|
9
|
-
exports.oraNonInteractiveMode = {
|
|
10
|
-
start: () => exports.oraNonInteractiveMode,
|
|
1
|
+
import oraOriginal from 'ora';
|
|
2
|
+
export const oraNonInteractiveMode = {
|
|
3
|
+
start: () => oraNonInteractiveMode,
|
|
11
4
|
succeed: () => { },
|
|
12
5
|
stop: () => { },
|
|
13
6
|
fail: () => { },
|
|
14
7
|
stopAndPersist: () => { },
|
|
15
8
|
set text(value) { },
|
|
16
9
|
};
|
|
17
|
-
function ora(interactive, text) {
|
|
18
|
-
return interactive ? (
|
|
10
|
+
export function ora(interactive, text) {
|
|
11
|
+
return interactive ? oraOriginal({ text }) : oraNonInteractiveMode;
|
|
19
12
|
}
|
|
20
13
|
//# sourceMappingURL=ora.js.map
|
package/dist/src/lib/ora.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ora.js","sourceRoot":"","sources":["../../../src/lib/ora.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ora.js","sourceRoot":"","sources":["../../../src/lib/ora.ts"],"names":[],"mappings":"AAAA,OAAO,WAAyB,MAAM,KAAK,CAAC;AAE5C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,GAAG,EAAE,CAAC,qBAAqB;IAClC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,IAAI,IAAI,CAAC,KAAa,IAAG,CAAC;CACpB,CAAC;AAET,MAAM,UAAU,GAAG,CACjB,WAAgC,EAChC,IAAyB;IAEzB,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC;AACrE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TargetBranchChoice } from '../options/config-options';
|
|
2
|
-
import type { Commit } from './sourceCommit/parse-source-commit';
|
|
1
|
+
import type { TargetBranchChoice } from '../options/config-options.js';
|
|
2
|
+
import type { Commit } from './sourceCommit/parse-source-commit.js';
|
|
3
3
|
export declare function getChoicesForCommitPrompt(commits: Commit[], showDetails: boolean): {
|
|
4
4
|
name: string;
|
|
5
5
|
short: string;
|