Skip to content

Commit 45a5fc2

Browse files
committed
chore: add syncpack v15 and align all deps to pnpm catalogs
- Install syncpack@15 for monorepo dependency alignment enforcement - Add .syncpackrc with JSON schema reference - Add syncpack:lint and syncpack:fix scripts (with explicit --source to exclude dist/ build artifacts, which syncpack reads via pnpm-workspace) - Extend pnpm default catalog with: @forgerock/javascript-sdk, @types/express, tslib, tsx - Migrate all consumers to catalog: references — fixes DiffersToCatalog and DiffersToHighestOrLowestSemver across 11 package.json files
1 parent 2c61fc4 commit 45a5fc2

18 files changed

Lines changed: 263 additions & 519 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
with:
3333
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3434

35+
- name: Lint dependency versions
36+
run: pnpm syncpack:lint
37+
3538
- run: pnpm nx fix-ci
3639
if: always()
3740

.syncpackrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "./node_modules/syncpack/schema.json",
3+
"source": [
4+
"package.json",
5+
"packages/*/package.json",
6+
"packages/sdk-effects/*/package.json",
7+
"packages/utils/*/package.json",
8+
"e2e/*/package.json",
9+
"tools/*/package.json",
10+
"scratchpad/package.json"
11+
]
12+
}

e2e/am-mock-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"uuid": "^14.0.0"
1717
},
1818
"devDependencies": {
19-
"@types/express": "^5.0.0"
19+
"@types/express": "catalog:"
2020
}
2121
}

e2e/davinci-app/main.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
*/
77
import './style.css';
88

9-
import { Config, FRUser, TokenManager } from '@forgerock/javascript-sdk';
109
import { davinci } from '@forgerock/davinci-client';
10+
import { oidc } from '@forgerock/oidc-client';
11+
import type { OidcConfig } from '@forgerock/oidc-client/types';
1112
import type {
1213
CustomLogger,
1314
DaVinciConfig,
@@ -86,6 +87,11 @@ const urlParams = new URLSearchParams(window.location.search);
8687

8788
(async () => {
8889
const davinciClient: DavinciClient = await davinci({ config, logger, requestMiddleware });
90+
const oidcResult = await oidc({ config: config as OidcConfig });
91+
if ('error' in oidcResult) {
92+
throw new Error(`Failed to initialize oidc client: ${oidcResult.error}`);
93+
}
94+
const oidcClient = oidcResult;
8995
const protectApi = protect({ envId: '02fb4743-189a-4bc7-9d6c-a919edfe6447' });
9096
const continueToken = urlParams.get('continueToken');
9197
const formEl = document.getElementById('form') as HTMLFormElement;
@@ -99,10 +105,6 @@ const urlParams = new URLSearchParams(window.location.search);
99105

100106
if (continueToken) {
101107
resumed = await davinciClient.resume({ continueToken });
102-
} else {
103-
// the current davinci-config has a slightly
104-
// different middleware type than the old legacy config
105-
await Config.setAsync(config as any);
106108
}
107109

108110
function renderComplete() {
@@ -141,25 +143,26 @@ const urlParams = new URLSearchParams(window.location.search);
141143

142144
const tokenBtn = document.getElementById('tokensButton') as HTMLButtonElement;
143145
tokenBtn.addEventListener('click', async () => {
144-
tokens = await TokenManager.getTokens({ query: { code, state } });
146+
tokens = await oidcClient.token.exchange(code, state);
145147

146148
console.log(tokens);
147149

150+
const accessTokenValue = tokens && 'accessToken' in tokens ? tokens.accessToken : '';
148151
const tokenPreEl = document.getElementById('accessTokenContainer') as HTMLPreElement;
149152
tokenPreEl.innerHTML = `
150153
<pre
151154
data-testid="access-token"
152155
id="accessTokenValue"
153156
style="display: block; max-width: 400px; text-wrap: wrap; overflow-wrap: anywhere;"
154-
>${tokens?.accessToken}</pre>
157+
>${accessTokenValue}</pre>
155158
`;
156159
});
157160

158161
const loginBtn = document.getElementById('logoutButton') as HTMLButtonElement;
159162
loginBtn.addEventListener('click', async () => {
160-
await FRUser.logout({ logoutRedirectUri: `${window.location.origin}/` });
163+
await oidcClient.user.logout();
161164

162-
//window.location.reload();
165+
window.location.reload();
163166
});
164167
}
165168

e2e/davinci-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@forgerock/davinci-client": "workspace:*",
15-
"@forgerock/javascript-sdk": "4.7.0",
15+
"@forgerock/oidc-client": "workspace:*",
1616
"@forgerock/protect": "workspace:*",
1717
"@forgerock/sdk-logger": "workspace:*"
1818
},

e2e/davinci-app/tsconfig.app.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
{
1919
"path": "../../packages/protect/tsconfig.lib.json"
2020
},
21+
{
22+
"path": "../../packages/oidc-client/tsconfig.lib.json"
23+
},
2124
{
2225
"path": "../../packages/davinci-client/tsconfig.lib.json"
2326
}

e2e/davinci-suites/src/basic.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,8 @@ test('Test happy paths on test page', async ({ page }) => {
4040
return true;
4141
}
4242
});
43-
const signoff = page.waitForResponse((response) => {
44-
if (response.url().includes('/signoff') && response.status() === 302) {
45-
return true;
46-
}
47-
});
4843
await logoutButton.click();
4944
await revokeCall;
50-
await signoff;
5145
await expect(page.getByText('Username/Password Form')).toBeVisible();
5246
});
5347
test('ensure query params passed to start are sent off in authorize call', async ({ page }) => {

e2e/device-client-app/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
},
1111
"dependencies": {
1212
"@forgerock/device-client": "workspace:*",
13-
"@forgerock/javascript-sdk": "4.7.0",
14-
"effect": "^3.12.7"
13+
"@forgerock/javascript-sdk": "catalog:",
14+
"effect": "catalog:effect"
1515
},
1616
"devDependencies": {
17-
"@effect/language-service": "^0.20.0"
17+
"@effect/language-service": "catalog:effect"
1818
},
1919
"nx": {
2020
"tags": ["scope:e2e"]

e2e/protect-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"serve": "pnpm nx nxServe"
1212
},
1313
"dependencies": {
14-
"@forgerock/javascript-sdk": "4.7.0",
14+
"@forgerock/javascript-sdk": "catalog:",
1515
"@forgerock/protect": "workspace:*"
1616
},
1717
"nx": {

lefthook.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ pre-commit:
55
nx-check:
66
run: pnpm nx affected -t typecheck lint build api-report --tui=false
77
stage_fixed: true
8+
format:
9+
run: pnpm nx format:write
10+
stage_fixed: true
11+
syncpack:
12+
glob: >-
13+
{package.json,
14+
pnpm-workspace.yaml,
15+
packages/*/package.json,
16+
packages/sdk-effects/*/package.json,
17+
packages/utils/*/package.json,
18+
e2e/*/package.json,
19+
tools/*/package.json,
20+
scratchpad/package.json}
21+
run: pnpm syncpack:lint
822
interface-mapping:
923
glob: >-
1024
{tools/interface-mapping-validator/**/*.ts,
@@ -21,9 +35,6 @@ pre-commit:
2135
echo "Interface mapping is out of sync." &&
2236
echo "Run: pnpm mapping:generate" &&
2337
exit 1)
24-
format:
25-
run: pnpm nx format:write
26-
stage_fixed: true
2738
commit-msg:
2839
commands:
2940
commitlint:

0 commit comments

Comments
 (0)