Skip to content

Commit

Permalink
feat(options): add gitInfo in module options (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximepvrt authored Sep 11, 2024
1 parent 858d58f commit c5df173
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export interface ModuleOptions {
* Enable Studio mode
* @default: 'production'
*/
enabled: 'production' | true
enabled: 'production' | true,

Check failure on line 17 in src/module.ts

View workflow job for this annotation

GitHub Actions / nightly (ubuntu-latest, 20)

Unexpected separator (,)
gitInfo: GitInfo | null,

Check failure on line 18 in src/module.ts

View workflow job for this annotation

GitHub Actions / nightly (ubuntu-latest, 20)

Unexpected separator (,)
}

export interface ModuleHooks {}
Expand All @@ -26,6 +27,7 @@ export default defineNuxtModule<ModuleOptions>({
},
defaults: {
enabled: 'production',
gitInfo: null,
},
async setup(options, nuxt) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down Expand Up @@ -80,7 +82,7 @@ export default defineNuxtModule<ModuleOptions>({
const apiURL = process.env.NUXT_PUBLIC_STUDIO_API_URL || process.env.STUDIO_API || 'https://api.nuxt.studio'
const publicToken = process.env.NUXT_PUBLIC_STUDIO_TOKENS
const iframeMessagingAllowedOrigins = process.env.IFRAME_MESSAGING_ALLOWED_ORIGINS
const gitInfo = await _getLocalGitInfo(nuxt.options.rootDir) || _getGitEnv() || {}
const gitInfo = options.gitInfo || await _getLocalGitInfo(nuxt.options.rootDir) || _getGitEnv() || {}
nuxt.options.runtimeConfig.studio = defu(nuxt.options.runtimeConfig.studio, {
version,
publicToken,
Expand Down

0 comments on commit c5df173

Please sign in to comment.