Skip to content

Commit

Permalink
fix: safer version resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jan 7, 2024
1 parent 8c821b6 commit 66929e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"nuxt-simple-robots": "^4.0.0-rc.10",
"nuxt-site-config": "^2.2.3",
"nuxt-site-config-kit": "^2.2.3",
"pkg-types": "^1.0.3",
"ufo": "^1.3.2"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

8 changes: 4 additions & 4 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@nuxt/kit'
import chalk from 'chalk'
import { installNuxtSiteConfig } from 'nuxt-site-config-kit'
import { version } from '../package.json'
import { readPackageJSON } from 'pkg-types'

export interface ModuleOptions {
/**
Expand Down Expand Up @@ -83,15 +83,15 @@ export default defineNuxtModule<ModuleOptions>({
}
},
async setup(config, nuxt) {
const logger = useLogger('@nuxtjs/seo')
const { resolve, resolvePath } = createResolver(import.meta.url)
const { name, version } = await readPackageJSON(resolve('../package.json'))
const logger = useLogger(name)
logger.level = config.debug ? 4 : 3
if (config.enabled === false) {
logger.debug('The module is disabled, skipping setup.')
return
}

const { resolve, resolvePath } = createResolver(import.meta.url)

await installNuxtSiteConfig()

// TODO disable modules if SSR is disabled
Expand Down

1 comment on commit 66929e4

@GalacticHypernova
Copy link

@GalacticHypernova GalacticHypernova commented on 66929e4 Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️
We love safe version resolution!!!!

Please sign in to comment.