@@ -10,11 +10,15 @@ import rehypeSlug from 'rehype-slug';
1010import { serialize } from 'next-mdx-remote/serialize' ;
1111import { availableLocales } from './next.locales.mjs' ;
1212import { getMarkdownFiles } from './next.helpers.mjs' ;
13- import { DEFAULT_LOCALE_CODE , MD_EXTENSION_REGEX } from './next.constants.mjs' ;
13+ import {
14+ DEFAULT_LOCALE_CODE ,
15+ MD_EXTENSION_REGEX ,
16+ CURRENT_WORKING_DIRECTORY ,
17+ } from './next.constants.mjs' ;
1418
1519// allows us to run a glob to get markdown files based on a language folder
1620const getPathsByLanguage = async ( locale = DEFAULT_LOCALE_CODE , ignored = [ ] ) =>
17- getMarkdownFiles ( process . cwd ( ) , `pages/${ locale } ` , ignored ) ;
21+ getMarkdownFiles ( CURRENT_WORKING_DIRECTORY , `pages/${ locale } ` , ignored ) ;
1822
1923/**
2024 * This method is responsible for generating a Collection of all available paths that
@@ -41,6 +45,7 @@ const getAllPaths = async () => {
4145 sourcePages . map ( filename => {
4246 // remove the index.md(x) suffix from a pathname
4347 let pathname = filename . replace ( MD_EXTENSION_REGEX , '' ) ;
48+
4449 // remove trailing slash for correct Windows pathing of the index files
4550 if ( pathname . length > 1 && pathname . endsWith ( sep ) ) {
4651 pathname = pathname . substring ( 0 , pathname . length - 1 ) ;
@@ -110,7 +115,7 @@ export const getMarkdownFile = (
110115
111116 // gets the full pathname for the file (absolute path)
112117 metadata . filename = join (
113- process . cwd ( ) ,
118+ CURRENT_WORKING_DIRECTORY ,
114119 'pages' ,
115120 localeToUse ,
116121 route . filename
0 commit comments