Skip to content

Commit 0b7dc94

Browse files
committed
chore: don't use std-env to resolve isDevelopment
1 parent b50306b commit 0b7dc94

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

app/pages/index.vue

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import { debounce } from 'perfect-debounce'
33
44
const router = useRouter()
5+
const buildInfo = useAppConfig().buildInfo
6+
57
const searchQuery = ref('')
68
const searchInputRef = useTemplateRef('searchInputRef')
79
const { focused: isSearchFocused } = useFocus(searchInputRef)
@@ -33,10 +35,34 @@ defineOgImageComponent('Default')
3335
<!-- Animated title -->
3436
<h1
3537
dir="ltr"
36-
class="inline-flex items-center header-logo flex-gap1 font-mono text-5xl sm:text-7xl md:text-8xl font-medium tracking-tight mb-4 motion-safe:animate-fade-in motion-safe:animate-fill-both"
38+
class="grid grid-cols-[auto_auto] items-center header-logo flex-gap1 font-mono text-5xl sm:text-7xl md:text-8xl font-medium tracking-tight mb-4 motion-safe:animate-fade-in motion-safe:animate-fill-both"
3739
>
3840
<img :alt="$t('alt_logo')" src="/favicon.svg" width="96" height="96" class="mt-6" />
39-
<span>npmx</span>
41+
<span class="block">
42+
<span>npmx</span>
43+
<span class="text-xs font-mono flex items-center justify-end flex-gap1">
44+
<NuxtLink
45+
v-if="buildInfo.env === 'release'"
46+
external
47+
:href="`1https://github.com/npmx-dev/npmx.dev/tag/v${buildInfo.version}`"
48+
target="_blank"
49+
>
50+
v{{ buildInfo.version }}
51+
</NuxtLink>
52+
<span v-else>{{ buildInfo.env }}</span>
53+
<template v-if="buildInfo.commit && buildInfo.branch !== 'release'">
54+
&middot;
55+
<NuxtLink
56+
external
57+
:href="`https://github.com/npmx-dev/npmx.dev/commit/${buildInfo.commit}`"
58+
target="_blank"
59+
class="text-balance"
60+
>
61+
{{ buildInfo.shortCommit }}
62+
</NuxtLink>
63+
</template>
64+
</span>
65+
</span>
4066
</h1>
4167

4268
<p

config/env.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Git from 'simple-git'
2-
import { isDevelopment } from 'std-env'
32
import * as process from 'node:process'
43

54
export { version } from '../package.json'
@@ -55,7 +54,7 @@ export async function getGitInfo() {
5554
return { branch, commit, shortCommit }
5655
}
5756

58-
export async function getEnv() {
57+
export async function getEnv(isDevelopment: boolean) {
5958
const { commit, shortCommit, branch } = await getGitInfo()
6059
const env = isDevelopment
6160
? 'dev'

modules/build-env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default defineNuxtModule({
1010
name: 'npmx:build-env',
1111
},
1212
async setup(_options, nuxt) {
13-
const { env, commit, shortCommit, branch } = await getEnv()
13+
const { env, commit, shortCommit, branch } = await getEnv(nuxt.options.dev)
1414
const buildInfo: BuildInfo = {
1515
version,
1616
time: +Date.now(),

0 commit comments

Comments
 (0)