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:Nx 20 #477

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ jobs:

- run: pnpm exec nx-cloud record -- nx format:check --verbose
- run: pnpm exec nx affected -t build lint test e2e-ci --verbose

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: |
./dist/.playwright/**
./dist/**
retention-days: 30
3 changes: 3 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
cache: 'pnpm'

- run: pnpm install
- uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'master'

- run: pnpm dlx playwright install

Expand Down
39 changes: 39 additions & 0 deletions e2e/autoscript-suites/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { workspaceRoot } from '@nx/devkit';
import { PlaywrightTestConfig } from '@playwright/test';
import { baseConfig } from './playwright.config';

export const config: PlaywrightTestConfig = {
...baseConfig,
reporter: process.env.CI ? 'github' : 'list',
testIgnore: '**/authz-txn*',
use: {
baseURL,
ignoreHTTPSErrors: true,
geolocation: { latitude: 24.9884, longitude: -87.3459 },
bypassCSP: true,
trace: process.env.CI ? 'retry-with-trace' : 'retain-on-failure',
},
webServer: [
{
command: 'pnpm nx serve mock-api',
url: 'http://localhost:9443/healthcheck',
ignoreHTTPSErrors: true,
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
},
{
command: 'pnpm nx serve mock-api-v2',
url: 'http://localhost:9444/healthcheck',
ignoreHTTPSErrors: true,
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
},
{
command: 'pnpm nx serve autoscript-apps',
url: 'http://localhost:8443',
ignoreHTTPSErrors: true,
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
},
],
};
7 changes: 2 additions & 5 deletions e2e/autoscript-suites/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"description": "ForgeRock JavaScript SDK E2E Suites",
"main": "index.js",
"type": "module",
"author": "",
"license": "ISC",
"repository": {
Expand All @@ -14,9 +15,5 @@
"url": "https://github.com/ForgeRock/forgerock-javascript-sdk/issues"
},
"homepage": "https://github.com/ForgeRock/forgerock-javascript-sdk#readme",
"dependencies": {
"@forgerock/javascript-sdk": "workspace:*",
"@forgerock/ping-protect": "workspace:*",
"@forgerock/token-vault": "workspace:*"
}
"dependencies": {}
}
6 changes: 4 additions & 2 deletions e2e/autoscript-suites/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { PlaywrightTestConfig } from '@playwright/test';
import { nxE2EPreset } from '@nx/playwright/preset';
import { workspaceRoot } from '@nx/devkit';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);

// For CI, you may want to set BASE_URL to the deployed application.
const baseURL = process.env['BASE_URL'] || 'http://localhost:8443';
Expand Down Expand Up @@ -36,8 +39,7 @@ const config: PlaywrightTestConfig = {
cwd: workspaceRoot,
},
{
command:
'pnpm nx build javascript-sdk && pnpm nx build ping-protect && pnpm nx serve autoscript-apps',
command: 'pnpm nx serve autoscript-apps',
url: 'http://localhost:8443',
ignoreHTTPSErrors: true,
reuseExistingServer: !process.env.CI,
Expand Down
2 changes: 1 addition & 1 deletion e2e/autoscript-suites/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"allowJs": true,
"types": ["jest", "node"],
"outDir": "dist",
"module": "ES2015",
"module": "ES2020",
"moduleResolution": "NodeNext",
"allowUmdGlobalAccess": true,
"target": "ES2015"
Expand Down
2 changes: 1 addition & 1 deletion e2e/mock-api/src/app/routes.auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ export default function (app) {
const domain = req.url.includes('localhost') ? 'localhost' : 'example.com';

res.clearCookie('redirected');
res.cookie('iPlanetDirectoryPro', 'abcd1234', { domain, sameSite: 'none', secure: true });
res.cookie('iPlanetDirectoryPro', 'abcd1234', { domain, sameSite: 'none' });

const url = new URL(`${req.protocol}://${req.headers.host}${authPaths.authorize[1]}`);
url.searchParams.set('client_id', req.query.client_id);
Expand Down
3 changes: 2 additions & 1 deletion e2e/token-vault-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"dependencies": {
"@forgerock/javascript-sdk": "workspace:*",
"@forgerock/token-vault": "workspace:*"
"@forgerock/token-vault": "workspace:*",
"@forgerock/token-vault-interceptor": "workspace:*"
},
"version": "0.0.0"
}
6 changes: 0 additions & 6 deletions e2e/token-vault-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"tags": ["scope:app"],
"targets": {
"build": {
"dependsOn": [
"javascript-sdk:build",
"token-vault:build",
"build-interceptor"
],
"inputs": ["default", "^default"],
"outputs": ["{projectRoot}/dist"],
"defaultConfiguration": "production",
Expand All @@ -27,7 +22,6 @@
}
},
"build-interceptor": {
"dependsOn": ["token-vault:build"],
"inputs": [
"default",
"^default",
Expand Down
2 changes: 1 addition & 1 deletion e2e/token-vault-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const register = client({
origin: 'http://localhost:5823',
},
interceptor: {
file: new URL('/interceptor.js', import.meta.url).pathname,
file: new URL('@forgerock/token-vault-interceptor', import.meta.url).pathname,
scope: '/',
},
proxy: {
Expand Down
10 changes: 10 additions & 0 deletions e2e/token-vault-interceptor/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
*.md
LICENSE
.babelrc
.env*
.bin
dist
favicon.ico
*.html
.eslintignore
33 changes: 33 additions & 0 deletions e2e/token-vault-interceptor/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": [
"error",
{
"ignoredFiles": [
"{projectRoot}/eslint.config.{js,cjs,mjs}",
"{projectRoot}/vite.config.{js,ts,mjs,mts}"
]
}
]
}
}
]
}
11 changes: 11 additions & 0 deletions e2e/token-vault-interceptor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# token-vault-interceptor

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build token-vault-interceptor` to build the library.

## Running unit tests

Run `nx test token-vault-interceptor` to execute the unit tests via [Vitest](https://vitest.dev/).
13 changes: 13 additions & 0 deletions e2e/token-vault-interceptor/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@forgerock/token-vault-interceptor",
"version": "0.0.1",
"dependencies": {
"@forgerock/token-vault": "workspace:*"
},
"type": "module",
"main": "./dist/index.iife.js",
"module": "./dist/index.iife.js",
"exports": "./dist/index.iife.js",
"typings": "./dist/index.d.ts",
"private": true
}
32 changes: 32 additions & 0 deletions e2e/token-vault-interceptor/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@forgerock/token-vault-interceptor",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "e2e/token-vault-interceptor/src",
"projectType": "library",
"tags": ["scope:app"],
"targets": {
"build": {
"inputs": ["default", "^default"],
"outputs": ["{projectRoot}/dist"],
"defaultConfiguration": "production",
"options": {
"emptyOutDir": false
},
"configurations": {
"development": {
"mode": "development"
},
"production": {
"mode": "production"
}
}
},
"lint": {
"options": {
"fix": true,
"ignore-path": ".eslintignore",
"args": ["**/*.ts"]
}
}
}
}
22 changes: 22 additions & 0 deletions e2e/token-vault-interceptor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
16 changes: 16 additions & 0 deletions e2e/token-vault-interceptor/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
"composite": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"moduleDetection": "force",
"lib": ["ESNext", "DOM", "WebWorker", "Webworker.Iterable"],
"types": ["vite/client"]
},
"include": ["src/**/*.ts"],
"exclude": ["vite.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
26 changes: 26 additions & 0 deletions e2e/token-vault-interceptor/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": [
"vitest/globals",
"vitest/importMeta",
"vite/client",
"node",
"vitest"
]
},
"include": [
"vite.config.ts",
"vitest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}
42 changes: 42 additions & 0 deletions e2e/token-vault-interceptor/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/e2e/token-vault-interceptor',

build: {
outDir: './dist',
emptyOutDir: true,
reportCompressedSize: true,
lib: {
entry: 'src/interceptor.ts',
name: 'tokenvaultinterceptor',
fileName: 'index',
formats: ['iife'],
},
},
plugins: [
dts({
declarationOnly: false,
rollupTypes: true,
entryRoot: 'src',
tsconfigPath: './tsconfig.lib.json',
}),
],

test: {
watch: false,
globals: true,
environment: 'node',
passWithNoTests: true,
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],

reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/e2e/token-vault-interceptor',
provider: 'v8',
},
},
});
2 changes: 0 additions & 2 deletions e2e/token-vault-proxy/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"tags": ["scope:app"],
"targets": {
"build": {
"dependsOn": ["javascript-sdk:build", "token-vault:build", "^build"],
"inputs": ["default", "^default"],
"outputs": ["{projectRoot}/dist"],
"defaultConfiguration": "production",
Expand All @@ -20,7 +19,6 @@
}
},
"serve": {
"dependsOn": ["build"],
"defaultConfiguration": "development",
"options": {
"host": "localhost",
Expand Down
Loading
Loading