Skip to content

Commit

Permalink
fix: honor forced framework for Remix and Hydrogen
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Sep 18, 2024
1 parent e71068a commit 7e19e12
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/build-info/src/frameworks/hydrogen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseFramework, Category, DetectedFramework, Framework } from './framework.js'
import { Accuracy, BaseFramework, Category, DetectedFramework, Framework } from './framework.js'

const CLASSIC_COMPILER_CONFIG_FILES = ['remix.config.js']
const CLASSIC_COMPILER_DEV = {
Expand Down Expand Up @@ -58,7 +58,17 @@ export class Hydrogen extends BaseFramework implements Framework {
this.build = CLASSIC_COMPILER_BUILD
return this as DetectedFramework
}

// If neither config file exists, it can't be a valid Hydrogen site for Netlify anyway.

// We still honor the forced framework and use defaults we had before adding support
// for Vite variant to preserve previous behavior for this case.
if (this.detected.accuracy === Accuracy.Forced) {
this.dev = CLASSIC_COMPILER_DEV
this.build = CLASSIC_COMPILER_BUILD
return this as DetectedFramework
}

return
}
}
Expand Down
12 changes: 11 additions & 1 deletion packages/build-info/src/frameworks/remix.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseFramework, Category, DetectedFramework, Framework } from './framework.js'
import { Accuracy, BaseFramework, Category, DetectedFramework, Framework } from './framework.js'

const CLASSIC_COMPILER_CONFIG_FILES = ['remix.config.js']
const CLASSIC_COMPILER_DEV = {
Expand Down Expand Up @@ -69,7 +69,17 @@ export class Remix extends BaseFramework implements Framework {
this.build = CLASSIC_COMPILER_BUILD
return this as DetectedFramework
}

// If neither config file exists, it can't be a valid Remix site for Netlify anyway.

// We still honor the forced framework and use defaults we had before adding support
// for Vite variant to preserve previous behavior for this case.
if (this.detected.accuracy === Accuracy.Forced) {
this.dev = CLASSIC_COMPILER_DEV
this.build = CLASSIC_COMPILER_BUILD
return this as DetectedFramework
}

return
}
}
Expand Down

0 comments on commit 7e19e12

Please sign in to comment.