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

chore(gatsby-core-utils): cpu-core-count to TS #22048

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/**
* @type {import('../index').cpuCoreCount}
*/
const cpuCoreCount = ignoreEnvVar => {
import physicalCpuCount from "./physical-cpu-count"

const cpuCoreCount = (ignoreEnvVar: boolean): number => {
try {
let coreCount = require(`./physical-cpu-count`) || 1
let coreCount = physicalCpuCount() || 1

if (ignoreEnvVar) {
// Return the physical CPU count,
Expand Down Expand Up @@ -48,4 +47,4 @@ const cpuCoreCount = ignoreEnvVar => {
}
}

module.exports = cpuCoreCount
export default cpuCoreCount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export default cpuCoreCount
export { cpuCoreCount }

And adjust import in https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-core-utils/src/index.js