Skip to content

Commit

Permalink
feat: use std-env to detect provider (#72)
Browse files Browse the repository at this point in the history
* feat: use `std-env` to detect provider

* refactor: use map
  • Loading branch information
danielroe authored Apr 11, 2022
1 parent 5f9f065 commit e78f598
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import jiti from 'jiti'
import consola from 'consola'
import chalk from 'chalk'
import { getProperty } from 'dot-prop'
import { provider } from 'std-env'
import { Nitro } from '../types'

export function hl (str: string) {
Expand Down Expand Up @@ -64,18 +65,14 @@ export function replaceAll (input: string, from: string, to: string) {
return input.replace(new RegExp(from, 'g'), to)
}

export function detectTarget () {
if (process.env.NETLIFY || process.env.NETLIFY_LOCAL) {
return 'netlify'
}

if (process.env.NOW_BUILDER) {
return 'vercel'
}
const autodetectableProviders = {
azure_static: 'azure',
netlify: 'netlify',
vercel: 'vercel'
}

if (process.env.INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN) {
return 'azure'
}
export function detectTarget () {
return autodetectableProviders[provider]
}

export async function isDirectory (path: string) {
Expand Down

0 comments on commit e78f598

Please sign in to comment.