From b7fb3ea8ada294918609f2dd775079846cf03ed9 Mon Sep 17 00:00:00 2001 From: Caleb Ukle Date: Thu, 20 Jul 2023 11:42:51 -0500 Subject: [PATCH] fix(testing): add playwright secondary entrypoint for preset (#18202) --- packages/playwright/index.ts | 7 ++++ packages/playwright/package.json | 4 +- packages/playwright/preset.ts | 1 + packages/playwright/project.json | 42 +++++++++++-------- .../files/playwright.config.ts.template | 2 +- packages/playwright/src/index.ts | 7 ---- packages/playwright/tsconfig.lib.json | 2 +- 7 files changed, 37 insertions(+), 28 deletions(-) create mode 100644 packages/playwright/index.ts create mode 100644 packages/playwright/preset.ts delete mode 100644 packages/playwright/src/index.ts diff --git a/packages/playwright/index.ts b/packages/playwright/index.ts new file mode 100644 index 0000000000000..85fa5e118a0ba --- /dev/null +++ b/packages/playwright/index.ts @@ -0,0 +1,7 @@ +export { + playwrightExecutor, + PlaywrightExecutorSchema, +} from './src/executors/playwright/playwright'; +export { initGenerator } from './src/generators/init/init'; +export { configurationGenerator } from './src/generators/configuration/configuration'; +export { nxE2EPreset, NxPlaywrightOptions } from './src/utils/preset'; diff --git a/packages/playwright/package.json b/packages/playwright/package.json index 2d7b94ebb4dc8..4fb4f8b22cb22 100644 --- a/packages/playwright/package.json +++ b/packages/playwright/package.json @@ -16,8 +16,8 @@ "Playwright", "CLI" ], - "main": "./src/index", - "typings": "./src/index.d.ts", + "main": "./index.js", + "typings": "./index.d.ts", "author": "Victor Savkin", "license": "MIT", "bugs": { diff --git a/packages/playwright/preset.ts b/packages/playwright/preset.ts new file mode 100644 index 0000000000000..48121da0b4ab7 --- /dev/null +++ b/packages/playwright/preset.ts @@ -0,0 +1 @@ +export * from './src/utils/preset'; diff --git a/packages/playwright/project.json b/packages/playwright/project.json index 75e993f33c62d..bbfdddabf5cfc 100644 --- a/packages/playwright/project.json +++ b/packages/playwright/project.json @@ -1,7 +1,7 @@ { "name": "playwright", "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/playwright/src", + "sourceRoot": "packages/playwright", "projectType": "library", "targets": { "build": { @@ -15,30 +15,38 @@ "executor": "@nx/js:tsc", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "build/packages/playwright", - "main": "packages/playwright/src/index.ts", - "tsConfig": "packages/playwright/tsconfig.lib.json", "assets": [ - "packages/playwright/*.md", { - "input": "./packages/playwright/src", - "glob": "**/!(*.ts)", - "output": "./src" + "input": "packages/playwright", + "glob": "**/files/**", + "output": "/" }, { - "input": "./packages/playwright/src", - "glob": "**/*.d.ts", - "output": "./src" + "input": "packages/playwright", + "glob": "**/files/**/.gitkeep", + "output": "/" + }, + { + "input": "packages/playwright", + "glob": "**/*.json", + "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"], + "output": "/" }, { - "input": "./packages/playwright", - "glob": "generators.json", - "output": "." + "input": "packages/playwright", + "glob": "**/*.js", + "ignore": ["**/jest.config.js"], + "output": "/" + }, + { + "input": "packages/playwright", + "glob": "**/*.d.ts", + "output": "/" }, { - "input": "./packages/playwright", - "glob": "executors.json", - "output": "." + "input": "", + "glob": "LICENSE", + "output": "/" } ] } diff --git a/packages/playwright/src/generators/configuration/files/playwright.config.ts.template b/packages/playwright/src/generators/configuration/files/playwright.config.ts.template index 486d8ab3bed8d..5d4095d0f5dc5 100644 --- a/packages/playwright/src/generators/configuration/files/playwright.config.ts.template +++ b/packages/playwright/src/generators/configuration/files/playwright.config.ts.template @@ -1,5 +1,5 @@ import { defineConfig } from '@playwright/test'; -import { nxE2EPreset } from '@nx/playwright' +import { nxE2EPreset } from '@nx/playwright/preset'; import { workspaceRoot } from '@nx/devkit'; /** diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.ts deleted file mode 100644 index e47844934e1d4..0000000000000 --- a/packages/playwright/src/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export { - playwrightExecutor, - PlaywrightExecutorSchema, -} from './executors/playwright/playwright'; -export { initGenerator } from './generators/init/init'; -export { configurationGenerator } from './generators/configuration/configuration'; -export { nxE2EPreset, NxPlaywrightOptions } from './utils/preset'; diff --git a/packages/playwright/tsconfig.lib.json b/packages/playwright/tsconfig.lib.json index 33eca2c2cdf8c..a9755ab2a9679 100644 --- a/packages/playwright/tsconfig.lib.json +++ b/packages/playwright/tsconfig.lib.json @@ -5,6 +5,6 @@ "declaration": true, "types": ["node"] }, - "include": ["src/**/*.ts"], + "include": ["**/*.ts"], "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] }