Describe the bug
When processing data files, Docmaker tries to change the working directory to the project directory. This is done to allow dynamic (js) data files to be able to simply open files (fs.readFile etc.) relative to the project directory.
https://github.com/BlameButton/docmaker/blob/8516b9161278e85c053fd81c10b2f1c5c7428f32/src/data.ts#L45-L46
After processing all data files Docmaker tries to reset the path back to its original setting, but it appears getCwd() does not return a full path but a relative path (e.g. foo instead of /home/<user>/Documents/foo) which makes the call to chdir fail.
https://github.com/BlameButton/docmaker/blob/8516b9161278e85c053fd81c10b2f1c5c7428f32/src/data.ts#L52
✖ error Error: ENOENT: no such file or directory, chdir '/path/to/foo' -> 'foo'
To Reproduce
Steps to reproduce the behavior:
- Run
docmaker with the configuration below
- See error
Expected behavior
It should correctly reset the current directory after loading all data files.
Configuration
docmaker.yaml:
layout: "layout.html"
pages:
- "*.md"
data:
- "data.js"
page.md:
layout.html:
data.js:
Desktop (please complete the following information)
- OS / version: Ubuntu 20.04
- Docmaker version:
0.1.4
Describe the bug
When processing data files, Docmaker tries to change the working directory to the project directory. This is done to allow dynamic (js) data files to be able to simply open files (
fs.readFileetc.) relative to the project directory.https://github.com/BlameButton/docmaker/blob/8516b9161278e85c053fd81c10b2f1c5c7428f32/src/data.ts#L45-L46
After processing all data files Docmaker tries to reset the path back to its original setting, but it appears
getCwd()does not return a full path but a relative path (e.g.fooinstead of/home/<user>/Documents/foo) which makes the call tochdirfail.https://github.com/BlameButton/docmaker/blob/8516b9161278e85c053fd81c10b2f1c5c7428f32/src/data.ts#L52
To Reproduce
Steps to reproduce the behavior:
docmakerwith the configuration belowExpected behavior
It should correctly reset the current directory after loading all data files.
Configuration
docmaker.yaml:page.md:layout.html:data.js:Desktop (please complete the following information)
0.1.4