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

hexo build failed due to type issue #5326

Closed
uiolee opened this issue Oct 23, 2023 · 10 comments · Fixed by #5271 or hexojs/hexo-front-matter#129
Closed

hexo build failed due to type issue #5326

uiolee opened this issue Oct 23, 2023 · 10 comments · Fixed by #5271 or hexojs/hexo-front-matter#129

Comments

@uiolee
Copy link
Member

uiolee commented Oct 23, 2023

The former one should be fixed in hexojs/hexo-front-matter#67, but since hexo-front-matter hasn't released a new version to include this change yet, we should still stick to v4.0.0 here to prevent type error.

Originally posted by @Pcrab in #5202 (comment)

in #5202, we lock hexo-front-matter version to 4.0.0

"hexo-front-matter": "4.0.0",

hexo build failed

after hexojs/hexo-front-matter#67, hexo still have another types issue, which leads build failed.

> [email protected] build D:\hexojs\hexo
> tsc -b

lib/hexo/post.ts:359:36 - error TS2345: Argument of type 'string | Buffer' is not assignable to parameter of type 'string'.
  Type 'Buffer' is not assignable to type 'string'.

359       Object.assign(data, yfmParse(content));
                                       ~~~~~~~


Found 1 error.

 ELIFECYCLE  Command failed with exit code 1.
@uiolee uiolee changed the title fix https://github.com/hexojs/hexo/pull/5202#issuecomment-1544052137 fix hexo-front-matter version Oct 23, 2023
@uiolee uiolee changed the title fix hexo-front-matter version fix hexo-front-matter version to caret Oct 23, 2023
@D-Sketon
Copy link
Member

It's time to release a new version of hexo-front-matter

This was referenced Oct 26, 2023
@yoshinorin
Copy link
Member

Ready for release hexo-front-matter v4.2.0.

@uiolee
Copy link
Member Author

uiolee commented Oct 26, 2023

still exists another types issue. It leads hexo build fail. (see above)

I think it need time to investigate and update.

we could postpone this issue and release v7 first.

@uiolee uiolee changed the title fix hexo-front-matter version to caret hexo build failed due to type issue Oct 26, 2023
@D-Sketon
Copy link
Member

D-Sketon commented Oct 26, 2023

still exists another types issue. It leads hexo build fail

I think it need time to investigate.

we could postpone this issue and release v7 first.

maybe we can fix it in #5271 ?

@D-Sketon
Copy link
Member

still exists another types issue. It leads hexo build fail. (see above)

I think it need time to investigate.

we could postpone this issue and release v7 first.

https://github.com/hexojs/hexo-fs/blob/72f16b383bce2a438aed3076e47be352f9e41d1c/lib/fs.ts#L236-L237

The file encoding defaults to utf-8, so the type is basically string

@uiolee
Copy link
Member Author

uiolee commented Oct 26, 2023

@uiolee
Copy link
Member Author

uiolee commented Oct 26, 2023

The file encoding defaults to utf-8, so the type is basically string

yes

@D-Sketon
Copy link
Member

Besides, I found that fs.readFile(target, null) will cause

TypeError: Cannot convert undefined or null to object

However, The signature of the writeFile function is

function readFile(path: string, options?: ReadFileOptions | null): BlueBirdPromise<string | Buffer>

null is allowed to be passed in
is this a bug?

@D-Sketon
Copy link
Member

still exists another types issue. It leads hexo build fail. (see above)

I think it need time to investigate and update.

we could postpone this issue and release v7 first.

fix in #5271

@uiolee
Copy link
Member Author

uiolee commented Oct 29, 2023

fix in #5271

thanks! test passed.

@uiolee uiolee mentioned this issue Oct 29, 2023
2 tasks
This was linked to pull requests Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants