-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(docz-core): change filepath entry for windows #31
Conversation
packages/docz-core/src/Entries.tsx
Outdated
@@ -114,6 +114,9 @@ export class Entries { | |||
const entries = await Promise.all(files.filter(isEntry).map(createEntry)) | |||
|
|||
for (const entry of entries) { | |||
if (process.platform === "win32") { | |||
entry.filepath = entry.filepath.split('\\').join('/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use path.normalize
https://nodejs.org/api/path.html#path_path_normalize_path
❯ node -p "require('path').win32.normalize('/Users/test')"
\Users\test
I use .win32. here to simulate windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that the tpl.js compiler just somehow mess up with the final import file with the double slash "\" on windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's all fine even on the last phase of writing the import, but after writing the import file the slash disappear on windows and the Error appear.
Thanks @marceloavf! You right in your pr, but I think that this need to be in the https://github.com/pedronauck/docz/blob/master/packages/docz-core/src/Entry.ts#L105-L108 |
Changed it @pedronauck, thanks! |
Description
Change Windows filepath imports
Review
Closes #12, Closes #30