Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"perfect-debounce": "catalog:frontend",
"pkg-types": "catalog:prod",
"semver": "catalog:prod",
"simple-git": "catalog:prod",
"sirv": "catalog:prod",
"structured-clone-es": "catalog:frontend",
"tinyexec": "catalog:prod",
Expand Down
18 changes: 11 additions & 7 deletions packages/devtools/src/server-rpc/analyze-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'node:fs'
import fsp from 'node:fs/promises'
import { startSubprocess } from '@nuxt/devtools-kit'
import { dirname, join } from 'pathe'
import Git from 'simple-git'
import { x } from 'tinyexec'
import { glob } from 'tinyglobby'

const COLON_RE = /:/g
Expand Down Expand Up @@ -87,14 +87,18 @@ export function setupAnalyzeBuildRPC({ nuxt, refresh, ensureDevAuthToken }: Nuxt
return builds.sort((a, b) => b.endTime - a.endTime)
}

async function git(...args: string[]): Promise<string> {
const result = await x('git', args, { nodeOptions: { cwd: nuxt.options.rootDir }, throwOnError: true })
return result.stdout.trim()
}

async function generateAnalyzeBuildName() {
try {
const git = Git(nuxt.options.rootDir)
const branch = await git.branch()
const branchName = branch.current || 'head'
const sha = await git.revparse(['--short', 'HEAD'])
const isWorkingTreeClean = (await git.status()).isClean()
if (isWorkingTreeClean)
const branchName = await git('rev-parse', '--abbrev-ref', 'HEAD') || 'head'
const sha = await git('rev-parse', '--short', 'HEAD')
const status = await git('status', '--porcelain')
const isClean = status === ''
if (isClean)
return `${branchName}#${sha}`
return `${branchName}#${sha}-dirty`
}
Expand Down
31 changes: 0 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ catalogs:
nypm: ^0.6.5
pkg-types: ^2.3.0
semver: ^7.7.4
simple-git: ^3.33.0
sirv: ^3.0.2
tinyexec: ^1.0.4
tinyglobby: ^0.2.15
Expand Down
Loading