Skip to content

Commit faba81f

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 207e275 commit faba81f

20 files changed

Lines changed: 4004 additions & 5670 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,
@@ -85,6 +86,11 @@ const urlParams = new URLSearchParams(window.location.search);
8586

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

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

107109
function renderComplete() {
@@ -140,25 +142,26 @@ const urlParams = new URLSearchParams(window.location.search);
140142

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

145147
console.log(tokens);
146148

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

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

161-
//window.location.reload();
164+
window.location.reload();
162165
});
163166
}
164167

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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ pre-commit:
88
format:
99
run: pnpm nx format:write
1010
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
1122
interface-mapping:
1223
glob: >-
1324
{tools/interface-mapping-validator/**/*.ts,

0 commit comments

Comments
 (0)