-
Notifications
You must be signed in to change notification settings - Fork 91
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
refactor: make CLI async #286
Conversation
6d02ade
to
502f6f3
Compare
# Conflicts: # cli.js
function sortPackageJsonFiles(patterns, { ignore, ...options }) { | ||
const files = globSync(patterns, { ignore }) | ||
async function sortPackageJsonFiles(patterns, { ignore, ...options }) { | ||
const files = await glob(patterns, { ignore }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original implmention I want to use globStream
from globby
, but tinyglobby
doesn't support.
try { | ||
sortPackageJsonFile(file, reporter, isCheck) | ||
await sortPackageJsonFile(file, reporter, isCheck) | ||
} catch (error) { | ||
reporter.reportFailed(file, error) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still running serially, hard to make test pass if switch to parallel, I guess we can revist later.
import sortPackageJson from './index.js' | ||
import Reporter from './reporter.js' | ||
import packageJson from './package.json' with { type: 'json' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I move this to showVersion
?
This is based on #278, will rebase after #278 merged.Forgot we still support Node.js v12, we'll have to wait untill we drop it.