Skip to content

Commit

Permalink
feat: detect stackblitz using process.versions.webcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 14, 2023
1 parent 0a576f2 commit e728741
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { _process } from "./process";
export const platform = _process.platform || "";

/** Current provider info */
export const providerInfo = detectProvider(env);
export const providerInfo = detectProvider(env, _process);
export const provider: ProviderName = providerInfo.name;

/** Detect if `CI` environment variable is set or a provider CI detected */
Expand Down
3 changes: 2 additions & 1 deletion src/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export type ProviderInfo = { name: ProviderName; [meta: string]: any };

export function detectProvider(
env: Record<string, string | undefined>,
ctx: { versions?: Record<string, string> } = {},
): ProviderInfo {
// Based on env
for (const provider of providers) {
Expand All @@ -115,7 +116,7 @@ export function detectProvider(
}

// Stackblitz / Webcontainer
if (env.SHELL && env.SHELL === "/bin/jsh") {
if (env.SHELL === "/bin/jsh" || ctx.versions?.webcontainer) {
return {
name: "stackblitz",
ci: false,
Expand Down

0 comments on commit e728741

Please sign in to comment.