When trying to run @redocly/cli lint and providing a wildcarded path on Windows the command exist with exit code 1 without any error text.
To Reproduce
Steps to reproduce the behavior:
Make sure you are on Windows. I used v11, and Node 20, but it's also reproducible on Node v18. Haven't tried other Nodes.
Create an empty Node.js project by running npm init in a directory of your choice
Add @redocly/cli to your project by running npm install @redocly/cli
Create a very simple project structure:
<ROOT>
├─ api
│ └─ providers
│ └─ test-provider
│ └─ api.yaml (put "hello world" in this file, I know it's invalid YAML, but it doesn't matter)
Run npx @redocly/cli lint api/providers/*/api.yaml in the root folder
Expected behavior
I would expect to see the following text with an error on screen:
No configurations were provided -- using built in recommended configuration by default.
validating api/providers/test-provider/api.yaml...
Something went wrong when processing api/providers/test-provider/api.yaml:
- Document must be JSON object, got string.
Actual behavior
Nothing is displayed. Command exits with exit code 1.
Node.js Version(s)
20
Additional context
I managed to find the cause of this issue. When lint is called we get the following sequence of calls:
handleLint // redocly-cli/packages/cli/src/commands/lint.ts: line 40
getgetFallbackApisOrExit // redocly-cli/packages/cli/src/commands/lint.ts: line 41
expandGlobsInEntrypoints // redocly-cli/packages/cli/src/utils/misceleneous.ts: line 51
And in the expandGlobsInEntrypoints we have this line:
You can see the call to __promisify__ function which does not exist on glob. I don't really know the reason why @types/glob added this, but the function does not exist and the correct way to promisify this would be:
// redocly-cli/packages/cli/src/utils/misceleneous.ts
import { promisify } from 'utils';
// expandGlobsInEntrypoints
/* line 109 */ await promisify(glob)(aliasOrPath).map(...)
Describe the bug
When trying to run
@redocly/cli lint
and providing a wildcarded path on Windows the command exist withexit code 1
without any error text.To Reproduce Steps to reproduce the behavior:
npm init
in a directory of your choice@redocly/cli
to your project by runningnpm install @redocly/cli
npx @redocly/cli lint api/providers/*/api.yaml
in the root folderExpected behavior
I would expect to see the following text with an error on screen:
Actual behavior
Nothing is displayed. Command exits with exit code 1.
Node.js
Version(s)20
Additional context
I managed to find the cause of this issue. When
lint
is called we get the following sequence of calls:And in the
expandGlobsInEntrypoints
we have this line:You can see the call to
__promisify__
function which does not exist onglob
. I don't really know the reason why@types/glob
added this, but the function does not exist and the correct way to promisify this would be: