Skip to content

Commit

Permalink
fix(core): update to the async version of getting powerpack information
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Nov 26, 2024
1 parent 4030494 commit 1b6b10a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/nx/src/command-line/report/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ export async function reportHandler() {
`Licensed to ${powerpackLicense.organizationName} for ${
powerpackLicense.seatCount
} user${powerpackLicense.seatCount > 1 ? 's' : ''} in ${
powerpackLicense.workspaceCount
powerpackLicense.workspaceCount === 9999
? 'an unlimited number of'
: powerpackLicense.workspaceCount
} workspace${
powerpackLicense.workspaceCount > 1 ? 's' : ''
} until ${new Date(
powerpackLicense.expiresAt * 1000
(powerpackLicense.realExpiresAt ?? powerpackLicense.expiresAt) * 1000
).toLocaleDateString()}`
);
bodyLines.push('');
Expand Down
9 changes: 7 additions & 2 deletions packages/nx/src/utils/powerpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ export async function printPowerpackLicense() {

export async function getPowerpackLicenseInformation() {
try {
const { getPowerpackLicenseInformation } = (await import(
const {
getPowerpackLicenseInformation,
getPowerpackLicenseInformationAsync,
} = (await import(
'@nx/powerpack-license'
)) as typeof import('@nx/powerpack-license');
return getPowerpackLicenseInformation(workspaceRoot);
return (
getPowerpackLicenseInformationAsync ?? getPowerpackLicenseInformation
)(workspaceRoot);
} catch (e) {
if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
throw new NxPowerpackNotInstalledError(e);
Expand Down

0 comments on commit 1b6b10a

Please sign in to comment.