Skip to content

Commit

Permalink
Merge pull request #3199 from gerardmarquinarubio/paraglide-next-cli-…
Browse files Browse the repository at this point in the history
…allow-ts-configs

Allow for next.config.ts in paraglide cli init command
  • Loading branch information
samuelstroschein authored Nov 3, 2024
2 parents a9c0474 + 49b54dc commit 85233be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-ladybugs-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inlang/paraglide-next": patch
---

allow for next.config.ts in paraglide cli init command https://github.com/opral/monorepo/pull/3199
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ export const scanNextJSProject: CliStep<
}

/**
* Attempts to find the next.config.js or next.config.mjs file in the current working directory.
* Attempts to find the next.config.js, next.config.mjs or next.config.ts file in the current working directory.
*/
async function findNextConfig(
fs: NodeishFilesystem,
cwd: string
): Promise<NextConfigFile | undefined> {
const possibleNextConfigPaths = ["./next.config.js", "./next.config.mjs"].map(
const possibleNextConfigPaths = ["./next.config.js", "./next.config.mjs", "./next.config.ts"].map(
(possibleRelativePath) => path.resolve(cwd, possibleRelativePath)
)

for (const possibleNextConfigPath of possibleNextConfigPaths) {
if (await fileExists(fs, possibleNextConfigPath)) {
return {
path: possibleNextConfigPath,
type: possibleNextConfigPath.endsWith(".mjs") ? "esm" : "cjs",
type: possibleNextConfigPath.endsWith(".js") ? "cjs" : "esm",
}
}
}
Expand Down

0 comments on commit 85233be

Please sign in to comment.