-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/google/clasp
- Loading branch information
Showing
19 changed files
with
248 additions
and
340 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,16 @@ | ||
import {Conf} from '../conf.js'; | ||
import {DOTFILE} from '../dotfile.js'; | ||
import {hasOauthClientSettings} from '../utils.js'; | ||
import fs from 'fs-extra'; | ||
|
||
const {auth} = Conf.get(); | ||
const config = Conf.get(); | ||
|
||
/** | ||
* Logs out the user by deleting credentials. | ||
*/ | ||
export default async (): Promise<void> => { | ||
let previousPath: string | undefined; | ||
|
||
if (hasOauthClientSettings(true)) { | ||
if (auth.isDefault()) { | ||
// If no local auth defined, try current directory | ||
previousPath = auth.path; | ||
auth.path = '.'; | ||
} | ||
|
||
await DOTFILE.AUTH().delete(); | ||
|
||
if (previousPath) { | ||
auth.path = previousPath; | ||
} | ||
if (config.auth && fs.existsSync(config.auth)) { | ||
fs.unlinkSync(config.auth); | ||
} | ||
|
||
if (hasOauthClientSettings()) { | ||
if (!auth.isDefault()) { | ||
// If local auth defined, try with default (global) | ||
previousPath = auth.path; | ||
auth.path = ''; | ||
} | ||
|
||
await DOTFILE.AUTH().delete(); | ||
|
||
if (previousPath) { | ||
auth.path = previousPath; | ||
} | ||
if (config.authLocal && fs.existsSync(config.authLocal)) { | ||
fs.unlinkSync(config.authLocal); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.