Skip to content

refactor: make CLI async#286

Merged
keithamus merged 3 commits intokeithamus:mainfrom
fisker:async-cli
Mar 4, 2025
Merged

refactor: make CLI async#286
keithamus merged 3 commits intokeithamus:mainfrom
fisker:async-cli

Conversation

@fisker
Copy link
Collaborator

@fisker fisker commented Jan 30, 2023

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.

function sortPackageJsonFiles(patterns, { ignore, ...options }) {
const files = globSync(patterns, { ignore })
async function sortPackageJsonFiles(patterns, { ignore, ...options }) {
const files = await glob(patterns, { ignore })
Copy link
Collaborator Author

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.

SuperchupuDev/tinyglobby#24

} catch (error) {
reporter.reportFailed(file, error)
}
}
Copy link
Collaborator Author

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.

@fisker fisker marked this pull request as ready for review March 4, 2025 16:44
import { glob } from 'tinyglobby'
import sortPackageJson from './index.js'
import Reporter from './reporter.js'
import packageJson from './package.json' with { type: 'json' }
Copy link
Collaborator Author

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?

@keithamus keithamus merged commit 6e739b2 into keithamus:main Mar 4, 2025
2 checks passed
@fisker fisker deleted the async-cli branch March 4, 2025 16:56
@github-actions
Copy link

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants