sdxjs icon indicating copy to clipboard operation
sdxjs copied to clipboard

Outdated examples using glob in Chapter 2

Open vramana opened this issue 1 year ago • 3 comments

Current version of glob doesn't support callback API. May be the chapter needs to be updated or recommend an older version.

https://www.npmjs.com/package/glob

vramana avatar Feb 13 '24 10:02 vramana

thanks for the pointer - a pull request would be great (and all contributors are acknowledged).

gvwilson avatar Feb 13 '24 11:02 gvwilson

We need to understand all three layers in order to debug things when they go wrong, so this chapter explores callbacks, while Chapter 3 shows how promises and async/await work.

  • At the beginning of Chapter 2, it's mentioned that we initially explore callbacks in this chapter, while Chapter 3 delves into how async/await operates.
  • The newer version of glob returns a Promise, allowing data or error information to be accessed via the then method. However, changing to an example using the updated glob might be premature, as Promises are discussed in Chapter 3, whereas this chapter primarily focuses on callbacks.
  • It would be appropriate to maintain the current code examples but clarify their version, so readers can follow along without encountering errors.

perterHUAN avatar Apr 02 '24 10:04 perterHUAN

Glob 8.1.0 (already deprecated) is the last version of glob which work with callback functions, working with this version we can replicate the examples.

https://www.npmjs.com/package/glob/v/8.1.0

adecora avatar Jul 16 '24 19:07 adecora