docsifyjs / docsify

🃏 A magical documentation site generator.

Home Page:https://docsify.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build/emoji.js fails in Windows

trusktr opened this issue · comments

Bug Report

Steps to reproduce

D:\src\docsifyjs+docsify> node build/emoji.js 
Build emoji
- Fetching emoji data from https://api.github.com/emojis
- Retrieved 1877 emoji entries
- Error: Cannot read properties of null (reading '1')
- ```

#### Current behaviour

fail
#### Expected behaviour

pass

#### Other relevant information

- Docsify version: develop
- Your OS: Windows
- Node.js version: 20.5.0
- npm/yarn version: npm 10.2.0
- Browser version: N/A



#### Please create a reproducible sandbox

#### Mention the docsify version in which this bug was not present (if any)

After making the change in

I can see the full error in the output, and the script no longer exits with 0 after the error (it should exit non-zero if there's an error):

PS D:\src\lume+lume\packages\docsifyjs+docsify> node .\build\emoji.js
Build emoji
- Fetching emoji data from https://api.github.com/emojis
- Retrieved 1877 emoji entries
file:///D:/src/lume+lume/packages/docsifyjs+docsify/build/emoji.js:47
  const emojiMarkdownStart = emojiMatch[1].trim();
                                       ^

TypeError: Cannot read properties of null (reading '1')
    at writeEmojiPage (file:///D:/src/lume+lume/packages/docsifyjs+docsify/build/emoji.js:47:40)
    at file:///D:/src/lume+lume/packages/docsifyjs+docsify/build/emoji.js:101:3
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.5.0

I updated the PR so it also fixes the Windows issue. I'm not sure exactly how the issue happens, but I think it might be due to git settings.

I think that the other PR,

may prevent the CRLFs from popping in unexpectedly, but no harm in making the regex more robust just in case the CRLFs get in there somehow.