@@ -10,11 +10,15 @@ import rehypeSlug from 'rehype-slug';
10
10
import { serialize } from 'next-mdx-remote/serialize' ;
11
11
import { availableLocales } from './next.locales.mjs' ;
12
12
import { 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' ;
14
18
15
19
// allows us to run a glob to get markdown files based on a language folder
16
20
const getPathsByLanguage = async ( locale = DEFAULT_LOCALE_CODE , ignored = [ ] ) =>
17
- getMarkdownFiles ( process . cwd ( ) , `pages/${ locale } ` , ignored ) ;
21
+ getMarkdownFiles ( CURRENT_WORKING_DIRECTORY , `pages/${ locale } ` , ignored ) ;
18
22
19
23
/**
20
24
* This method is responsible for generating a Collection of all available paths that
@@ -41,6 +45,7 @@ const getAllPaths = async () => {
41
45
sourcePages . map ( filename => {
42
46
// remove the index.md(x) suffix from a pathname
43
47
let pathname = filename . replace ( MD_EXTENSION_REGEX , '' ) ;
48
+
44
49
// remove trailing slash for correct Windows pathing of the index files
45
50
if ( pathname . length > 1 && pathname . endsWith ( sep ) ) {
46
51
pathname = pathname . substring ( 0 , pathname . length - 1 ) ;
@@ -110,7 +115,7 @@ export const getMarkdownFile = (
110
115
111
116
// gets the full pathname for the file (absolute path)
112
117
metadata . filename = join (
113
- process . cwd ( ) ,
118
+ CURRENT_WORKING_DIRECTORY ,
114
119
'pages' ,
115
120
localeToUse ,
116
121
route . filename
0 commit comments