Skip to content

Commit

Permalink
Allow for next.config.ts in paraglide cli init command
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardmarquinarubio committed Nov 3, 2024
1 parent ff0898a commit dd5078a
Showing 1 changed file with 3 additions and 3 deletions.
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 dd5078a

Please sign in to comment.