Skip to content
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

Failed to find .md file in non-ASCII directory #108

Closed
saiya opened this issue Jun 24, 2019 · 6 comments · Fixed by #109
Closed

Failed to find .md file in non-ASCII directory #108

saiya opened this issue Jun 24, 2019 · 6 comments · Fixed by #109
Labels
bug Something isn't working

Comments

@saiya
Copy link
Contributor

saiya commented Jun 24, 2019

marp-cli failed to glob markdown files within non-ASCII directory. Thus marp --server . exits.

Way to reproduce

% grep marp-cli yarn.lock 
"@marp-team/marp-cli@^0.10.0":
  resolved "https://registry.yarnpkg.com/@marp-team/marp-cli/-/marp-cli-0.10.2.tgz#111be76a2df5f3c228f08dc3627eadbe23fbf3e8"

% pwd
/Users/seiya.yazaki/work/github.com/saiya/presentations/190913 RDBMS 実践
# ↑ It contains non-ASCII character in directory name

% ls *.md
-rw-r--r-- 1 seiya.yazaki staff 1.6K  6 24 15:07  slide.md

% yarn marp --server .
yarn run v1.17.0
$ '/Users/seiya.yazaki/work/github.com/saiya/presentations/190913 RDBMS 実践/node_modules/.bin/marp' --server .
Usage:
  marp [options] <files...>
  marp [options] -I <dir>

Basic Options:
  --version, -v      Show versions                                        [真偽]
  --help, -h         Show help                                            [真偽]
    .... snip ....

Expected result

yarn marp --server . should start server, not showing help.

Workaround

Use ASCII directory name:

% pwd
/Users/seiya.yazaki/work/github.com/saiya/presentations/190913 RDBMS Advanced

% ls *.md
-rw-r--r-- 1 seiya.yazaki staff 1.6K  6 24 15:07  slide.md

% yarn marp --server .
yarn run v1.17.0
$ '/Users/seiya.yazaki/work/github.com/saiya/presentations/190913 RDBMS Advanced/node_modules/.bin/marp' --server .
[  INFO ] [Server mode] Start server listened at http://localhost:8080/ ...
@saiya
Copy link
Contributor Author

saiya commented Jun 24, 2019

I debugged marp-cli and found that globby returns empty list when I use non-ASCII directory name: https://github.com/marp-team/marp-cli/blob/v0.10.2/src/file.ts#L122

But it is hard for me to debug why globby fails to find markdown files at now...

If I have enough time, I will try to debug it.

@yhatt
Copy link
Member

yhatt commented Jun 24, 2019

The cause is very similar to #95 I'm found. It is caused by globby too.

@yhatt yhatt added the bug Something isn't working label Jun 24, 2019
@yhatt
Copy link
Member

yhatt commented Jun 24, 2019

It might cause in the upstream package fast-glob v2.2.7. The latest v3 has already fixed this.

.
├── test.js
├── a
│   └── test
└── 字
    └── test
// test.js
const fastGlob = require('fast-glob')

// Globby calls fast-glob internally with the path like these
for (const path of ['a/**/*', '字/**/*']) {
  console.log(path, fastGlob.sync(path))
}
# fast-glob v2.2.7
$ node test.js
a/**/* [ 'a/test' ]
字/**/* []

# fast-glob v3.0.2
$ node test.js
a/**/* [ 'a/test' ]
字/**/* [ '字/test' ]

@yhatt
Copy link
Member

yhatt commented Jun 24, 2019

@saiya I've created PR #109 with updated fast-glob. Could you try to build Marp CLI and test non-ASCII directory on glob-non-ascii-dir branch?

@saiya
Copy link
Contributor Author

saiya commented Jun 26, 2019

@yhatt Thank you. glob-non-ascii-dir works well with non-ASCII directory in my environment also.

I will wait for globby's update (and marp-cli's update) as you posted.

@yhatt
Copy link
Member

yhatt commented Jun 30, 2019

I worked for getting fast-glob v3 in globby, and it came as globby v10 😆
https://github.com/sindresorhus/globby/releases/tag/v10.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants