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 d8e9318
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 267 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
"@nx/js": "20.2.0-beta.3",
"@nx/next": "20.2.0-beta.3",
"@nx/playwright": "20.2.0-beta.3",
"@nx/powerpack-conformance": "1.1.0-beta.5",
"@nx/powerpack-enterprise-cloud": "1.1.0-beta.5",
"@nx/powerpack-license": "1.1.0-beta.5",
"@nx/powerpack-conformance": "1.1.0-beta.6",
"@nx/powerpack-enterprise-cloud": "1.1.0-beta.6",
"@nx/powerpack-license": "1.1.0-beta.6",
"@nx/react": "20.2.0-beta.3",
"@nx/storybook": "20.2.0-beta.3",
"@nx/vite": "20.2.0-beta.3",
Expand Down
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
Loading

0 comments on commit d8e9318

Please sign in to comment.