Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -80,7 +80,6 @@
"perfect-debounce": "catalog:frontend",
"pkg-types": "catalog:prod",
"semver": "catalog:prod",
Comment thread
TooTallNate marked this conversation as resolved.
"simple-git": "catalog:prod",
"sirv": "catalog:prod",
"structured-clone-es": "catalog:frontend",
"tinyglobby": "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'
Comment thread
TooTallNate marked this conversation as resolved.
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
45 changes: 0 additions & 45 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 @@ -156,7 +156,6 @@ catalogs:
package-manager-detector: ^1.8.0
pkg-types: ^2.3.1
semver: ^7.8.5
simple-git: ^3.36.0
sirv: ^3.0.2
tinyglobby: ^0.2.17
unstorage: ^1.17.5
Expand Down
Loading