Skip to content

Commit f92fcff

Browse files
authored
refactor: use globalConfig from @netlify/dev-utils (#7426)
* Refactored cli to use globalConfig from @netlify/dev-utils * Revert globalConfig changes and added import alias * Reverted unit test changes * Removed old global config files from cli * Removed default export from global-config * use new imports for global config from new dev-utils update * Change export of GlobalConfigStore type * Moved imports of dev-utils into correct import groupings * Moved dev-utils import in telemetry
1 parent 21e4bc5 commit f92fcff

File tree

11 files changed

+65
-312
lines changed

11 files changed

+65
-312
lines changed

package-lock.json

Lines changed: 56 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"@netlify/build": "34.3.0",
6464
"@netlify/build-info": "10.0.7",
6565
"@netlify/config": "23.2.0",
66-
"@netlify/dev-utils": "3.3.0",
66+
"@netlify/dev-utils": "^4.0.0",
6767
"@netlify/edge-bundler": "14.2.2",
6868
"@netlify/edge-functions": "2.15.7",
6969
"@netlify/headers-parser": "9.0.1",

src/commands/base-command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { NetlifyAPI } from '@netlify/api'
77
import { DefaultLogger, Project } from '@netlify/build-info'
88
import { NodeFS, NoopLogger } from '@netlify/build-info/node'
99
import { resolveConfig } from '@netlify/config'
10+
import { getGlobalConfigStore } from '@netlify/dev-utils'
1011
import { isCI } from 'ci-info'
1112
import { Command, Help, Option, type OptionValues } from 'commander'
1213
import debug from 'debug'
@@ -35,7 +36,6 @@ import {
3536
} from '../utils/command-helpers.js'
3637
import type { FeatureFlags } from '../utils/feature-flags.js'
3738
import { getFrameworksAPIPaths } from '../utils/frameworks-api.js'
38-
import getGlobalConfigStore from '../utils/get-global-config-store.js'
3939
import { getSiteByName } from '../utils/get-site.js'
4040
import openBrowser from '../utils/open-browser.js'
4141
import CLIState from '../utils/cli-state.js'

src/commands/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import envinfo from 'envinfo'
55
import { closest } from 'fastest-levenshtein'
66
import inquirer from 'inquirer'
77

8+
import { getGlobalConfigStore } from '@netlify/dev-utils'
9+
810
import {
911
BANG,
1012
chalk,
@@ -17,7 +19,6 @@ import {
1719
logError,
1820
} from '../utils/command-helpers.js'
1921
import execa from '../utils/execa.js'
20-
import getGlobalConfigStore from '../utils/get-global-config-store.js'
2122
import getCLIPackageJson from '../utils/get-cli-package-json.js'
2223
import { didEnableCompileCache } from '../utils/nodejs-compile-cache.js'
2324
import { track, reportError } from '../utils/telemetry/index.js'

src/utils/command-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import process from 'process'
55
import { format, inspect } from 'util'
66

77
import type { NetlifyAPI } from '@netlify/api'
8+
import { getGlobalConfigStore } from '@netlify/dev-utils'
89
import { Chalk } from 'chalk'
910
import chokidar from 'chokidar'
1011
import decache from 'decache'
@@ -14,7 +15,6 @@ import terminalLink from 'terminal-link'
1415

1516
import { startSpinner } from '../lib/spinner.js'
1617

17-
import getGlobalConfigStore from './get-global-config-store.js'
1818
import getCLIPackageJson from './get-cli-package-json.js'
1919
import { reportError } from './telemetry/report-error.js'
2020
import type { TokenLocation } from './types.js'

src/utils/get-global-config-store.ts

Lines changed: 0 additions & 110 deletions
This file was deleted.

src/utils/telemetry/report-error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { dirname, join } from 'path'
33
import process, { version as nodejsVersion } from 'process'
44
import { fileURLToPath } from 'url'
55

6+
import { getGlobalConfigStore } from '@netlify/dev-utils'
67
import { isCI } from 'ci-info'
78

89
import execa from '../execa.js'
9-
import getGlobalConfigStore from '../get-global-config-store.js'
1010

1111
import { cliVersion } from './utils.js'
1212

src/utils/telemetry/telemetry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { dirname, join } from 'path'
22
import process, { version as nodejsVersion } from 'process'
33
import { fileURLToPath } from 'url'
44

5+
import { getGlobalConfigStore } from '@netlify/dev-utils'
56
import { isCI } from 'ci-info'
67

78
import execa from '../execa.js'
8-
import getGlobalConfigStore from '../get-global-config-store.js'
99

1010
import { isTelemetryDisabled, cliVersion } from './utils.js'
1111
import isValidEventName from './validation.js'

src/utils/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { IncomingMessage } from 'http'
44
import type { PollingStrategy } from '@netlify/build-info'
55
import type { Match } from 'netlify-redirector'
66

7-
export type { GlobalConfigStore } from './get-global-config-store.js'
7+
export type { GlobalConfigStore } from '@netlify/dev-utils'
88
export { default as CLIState } from './cli-state.js'
99

1010
export type FrameworkNames = '#static' | '#auto' | '#custom' | string

0 commit comments

Comments
 (0)