-
Notifications
You must be signed in to change notification settings - Fork 414
refactor: use globalConfig from @netlify/dev-utils #7426
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
refactor: use globalConfig from @netlify/dev-utils #7426
Conversation
src/commands/base-command.ts
Outdated
@@ -643,7 +643,7 @@ export default class BaseCommand extends Command { | |||
siteData = result | |||
} | |||
|
|||
const globalConfig = await getGlobalConfigStore() | |||
const globalConfig = await globalConfigStore.default() |
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.
hrm, we should never need to do any esm/commonjs acrobatics like this these days, especially with our own code. could you instead open a PR over here to replace that export * as
with explicit re-exports? something like export {default as getGlobalConfigStore, GlobalConfigStore, resetConfigCache} from ...
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.
Yup makes sense, heres the primitives PR
src/utils/types.ts
Outdated
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export type GlobalConfigStore<T extends Record<string, any> = Record<string, any>> = globalConfig.GlobalConfigStore<T> |
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.
🤔 There should already be a type like this exported from @netlify/dev-utils
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.
Yup got rid of that 😅 and replaced with a simple
export type { GlobalConfigStore } from '@netlify/dev-utils'
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.
LGTM 🚀
src/commands/base-command.ts
Outdated
@@ -35,7 +35,7 @@ import { | |||
} from '../utils/command-helpers.js' | |||
import type { FeatureFlags } from '../utils/feature-flags.js' | |||
import { getFrameworksAPIPaths } from '../utils/frameworks-api.js' | |||
import getGlobalConfigStore from '../utils/get-global-config-store.js' | |||
import { getGlobalConfigStore } from '@netlify/dev-utils' |
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.
huh, I thought we had a lint rule enforcing this, but fyi we do import groups: first node builtins, empty line, then npm packages, empty line, then relative files
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.
Noted! I'll go over all imports I changed then
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.
Moved all new imports from @netlify/dev-utils
to correct import grouping: b38d980
🎉 Thanks for submitting a pull request! 🎉
Summary
Fixes #EX-331
Replacing duplicated globalConfig from
cli
to use globalConfig from@netlify/dev-utils
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)