perf(dev): keep update check + confbox parsers off the panel startup … · nuxt/cli@693eba4 · GitHub
Skip to content

Commit 693eba4

Browse files
committed
perf(dev): keep update check + confbox parsers off the panel startup path
1 parent 579ee5d commit 693eba4

5 files changed

Lines changed: 28 additions & 24 deletions

File tree

‎packages/nuxt-cli/src/dev/tui/index.ts‎

Lines changed: 6 additions & 2 deletions

‎packages/nuxt-cli/src/utils/registry.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { homedir } from 'node:os'
66
import { join } from 'node:path'
77
import process from 'node:process'
88

9-
import { parseINI } from 'confbox'
9+
import { parseINI } from 'confbox/ini'
1010

1111
const TRAILING_SLASH_RE = /\/$/
1212
const ENV_REFERENCE_RE = /\$\{([^}]+)\}/g
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** Repositories whose releases are published under a `v`-prefixed tag. */
2+
const RELEASE_REPOS: Record<string, string> = {
3+
'nuxt': 'nuxt/nuxt',
4+
'@nuxt/cli': 'nuxt/cli',
5+
'nuxi': 'nuxt/cli',
6+
'create-nuxt': 'nuxt/cli',
7+
}
8+
9+
/**
10+
* The release notes for a published version, when the package has a known
11+
* repository. Nightlies are skipped: their versions have no matching tag.
12+
*/
13+
export function releaseNotesUrl(pkg: string, version: string): string | undefined {
14+
const repo = RELEASE_REPOS[pkg]
15+
if (!repo || version.includes('nightly')) {
16+
return undefined
17+
}
18+
return `https://github.com/${repo}/releases/tag/v${version}`
19+
}

‎packages/nuxt-cli/src/utils/update-check.ts‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { fetchJson } from './fetch'
1010
import { terminalLink } from './formatting'
1111
import { debug, writeNotice } from './logger'
1212
import { detectNpmRegistry } from './registry'
13+
import { releaseNotesUrl } from './release-notes'
1314
import { trackOutputSpacing } from './stdout'
1415

1516
const RC_FILE = '.nuxtrc'
@@ -148,26 +149,6 @@ export interface UpdateNudgeOptions {
148149
pkg?: string
149150
}
150151

151-
/** Repositories whose releases are published under a `v`-prefixed tag. */
152-
const RELEASE_REPOS: Record<string, string> = {
153-
'nuxt': 'nuxt/nuxt',
154-
'@nuxt/cli': 'nuxt/cli',
155-
'nuxi': 'nuxt/cli',
156-
'create-nuxt': 'nuxt/cli',
157-
}
158-
159-
/**
160-
* The release notes for a published version, when the package has a known
161-
* repository. Nightlies are skipped: their versions have no matching tag.
162-
*/
163-
export function releaseNotesUrl(pkg: string, version: string): string | undefined {
164-
const repo = RELEASE_REPOS[pkg]
165-
if (!repo || version.includes('nightly')) {
166-
return undefined
167-
}
168-
return `https://github.com/${repo}/releases/tag/v${version}`
169-
}
170-
171152
function describeUpdate({ current, latest }: NuxtUpdate, name: string, pkg: string): string {
172153
const notes = releaseNotesUrl(pkg, latest)
173154
const version = styleText('green', latest)

‎packages/nuxt-cli/test/unit/utils/release-notes.spec.ts‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)