-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cli] Remove legacy config file migration logic #8199
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
02e31a9
[cli] Remove legacy config file migration logic
TooTallNate 09fb386
Simply config file loading logic
TooTallNate bc43184
Remove old link
TooTallNate 3c24272
Merge branch 'main' into remove/cli-legacy-config-migration
styfle f38680d
Merge branch 'main' into remove/cli-legacy-config-migration
EndangeredMassa 0660c0e
Merge branch 'main' of https://github.com/vercel/vercel into remove/c…
TooTallNate ea0892a
Add `err: unknown`
TooTallNate 10afc81
Remove unnecessary lint ignore comment
TooTallNate 1c97938
Merge branch 'main' into remove/cli-legacy-config-migration
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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,75 +1,15 @@ | ||
import { AuthConfig, GlobalConfig } from '../../types'; | ||
|
||
export const getDefaultConfig = async (existingCopy?: GlobalConfig | null) => { | ||
let migrated = false; | ||
|
||
const config: GlobalConfig = { | ||
_: 'This is your Vercel config file. For more information see the global configuration documentation: https://vercel.com/docs/configuration#global', | ||
collectMetrics: true, | ||
}; | ||
|
||
if (existingCopy) { | ||
const keep = [ | ||
'_', | ||
'currentTeam', | ||
'desktop', | ||
'updateChannel', | ||
'collectMetrics', | ||
'api', | ||
// This is deleted later in the code | ||
]; | ||
|
||
try { | ||
const existing = Object.assign({}, existingCopy); | ||
// @ts-ignore | ||
const sh = Object.assign({}, existing.sh || {}); | ||
|
||
Object.assign(config, existing, sh); | ||
|
||
for (const key of Object.keys(config)) { | ||
if (!keep.includes(key)) { | ||
// @ts-ignore | ||
delete config[key]; | ||
} | ||
} | ||
|
||
if (typeof config.currentTeam === 'object') { | ||
// @ts-ignore | ||
config.currentTeam = config.currentTeam.id; | ||
} | ||
|
||
// @ts-ignore | ||
if (typeof config.user === 'object') { | ||
// @ts-ignore | ||
config.user = config.user.uid || config.user.id; | ||
} | ||
|
||
migrated = true; | ||
} catch (err) {} | ||
} | ||
|
||
return { config, migrated }; | ||
export const defaultGlobalConfig: GlobalConfig = { | ||
'// Note': | ||
'This is your Vercel config file. For more information see the global configuration documentation.', | ||
'// Docs': | ||
'https://vercel.com/docs/project-configuration#global-configuration/config-json', | ||
collectMetrics: true, | ||
}; | ||
|
||
export const getDefaultAuthConfig = async (existing?: AuthConfig | null) => { | ||
let migrated = false; | ||
|
||
const config: AuthConfig = { | ||
_: 'This is your Vercel credentials file. DO NOT SHARE! More: https://vercel.com/docs/configuration#global', | ||
}; | ||
|
||
if (existing) { | ||
try { | ||
// @ts-ignore | ||
const sh = existing.credentials.find(item => item.provider === 'sh'); | ||
|
||
if (sh) { | ||
config.token = sh.token; | ||
} | ||
|
||
migrated = true; | ||
} catch (err) {} | ||
} | ||
|
||
return { config, migrated }; | ||
export const defaultAuthConfig: AuthConfig = { | ||
'// Note': 'This is your Vercel credentials file. DO NOT SHARE!', | ||
'// Docs': | ||
'https://vercel.com/docs/project-configuration#global-configuration/auth-json', | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed these docs links too since they pointed to an incorrect page.