netlify-cli 8.6.9 → 8.6.10

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "8.6.9",
3
+ "version": "8.6.10",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "8.6.9",
9
+ "version": "8.6.10",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "8.6.9",
4
+ "version": "8.6.10",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
@@ -102,15 +102,14 @@ const getPersonalAccessToken = async () => {
102
102
  */
103
103
  const authWithToken = async () => {
104
104
  const { token } = await getPersonalAccessToken()
105
- if (token) {
106
- const octokit = new Octokit({
107
- auth: `token ${token}`,
108
- })
109
- const { login: user } = await octokit.users.getAuthenticated()
110
- return { token, user, provider: 'github' }
105
+ if (!token) {
106
+ throw new Error('GitHub authentication failed')
111
107
  }
112
- const error = new Error('GitHub authentication failed')
113
- throw error
108
+
109
+ const octokit = new Octokit({ auth: `token ${token}` })
110
+ const { login: user } = await octokit.users.getAuthenticated()
111
+
112
+ return { token, user, provider: 'github' }
114
113
  }
115
114
 
116
115
  /**
@@ -121,11 +120,8 @@ const getGitHubToken = async () => {
121
120
  log('')
122
121
 
123
122
  const withNetlify = await promptForAuthMethod()
124
- if (withNetlify) {
125
- return await authWithNetlify()
126
- }
127
123
 
128
- return await authWithToken()
124
+ return withNetlify ? await authWithNetlify() : await authWithToken()
129
125
  }
130
126
 
131
127
  module.exports = { getGitHubToken, authWithNetlify }