Skip to content

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

Merged
merged 17 commits into from
Jul 18, 2025

Conversation

keanu-a
Copy link
Contributor

@keanu-a keanu-a commented Jul 15, 2025

🎉 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:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

Copy link

github-actions bot commented Jul 15, 2025

📊 Benchmark results

Comparing with 21e4bc5

  • Dependency count: 1,083 ⬆️ 0.09% increase vs. 21e4bc5
  • Package size: 288 MB ⬆️ 0.02% increase vs. 21e4bc5
  • Number of ts-expect-error directives: 399 (no change)

@keanu-a keanu-a marked this pull request as ready for review July 16, 2025 16:36
@keanu-a keanu-a requested a review from a team as a code owner July 16, 2025 16:36
@keanu-a keanu-a changed the title refactor: use globalconfig from @netlify/dev-utils refactor: use globalConfig from @netlify/dev-utils Jul 16, 2025
@@ -643,7 +643,7 @@ export default class BaseCommand extends Command {
siteData = result
}

const globalConfig = await getGlobalConfigStore()
const globalConfig = await globalConfigStore.default()
Copy link
Member

@serhalp serhalp Jul 17, 2025

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 ...

Copy link
Contributor Author

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

Comment on lines 9 to 10
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type GlobalConfigStore<T extends Record<string, any> = Record<string, any>> = globalConfig.GlobalConfigStore<T>
Copy link
Member

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

Copy link
Contributor Author

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'

@keanu-a keanu-a requested a review from serhalp July 17, 2025 20:12
Copy link
Member

@serhalp serhalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@@ -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'
Copy link
Member

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

Copy link
Contributor Author

@keanu-a keanu-a Jul 18, 2025

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

Copy link
Contributor Author

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

@keanu-a keanu-a merged commit f92fcff into main Jul 18, 2025
86 of 89 checks passed
@keanu-a keanu-a deleted the keanualoua/ex-331-use-globalconfig-from-netlifydev-utils branch July 18, 2025 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy