Skip to content

Commit

Permalink
Fixed issues with Nx 17 (#108)
Browse files Browse the repository at this point in the history
* moved runTasksInSerial import and fixed issue with undefined value when updating package.json

* bumped version

* updated failing test

* updated github setup

* bumped pnpm in engines

* updated create nx-workspace step in PR validation

* rolled back changes to prepare.yml
  • Loading branch information
mapolonio authored Nov 1, 2023
1 parent e79300c commit e7096f1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
pnpm create nx-workspace \
--name=$NX_WORKSPACE --appName=$NX_APP \
--preset=next --style=@emotion/styled \
--e2eTestRunner=playwright --nextAppDir=false \
--nxCloud=false --interactive=false < /dev/null
pushd $NX_WORKSPACE
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mands/nx-plugins",
"version": "0.6.2",
"version": "0.6.3",
"description": "Nx plugins by M&S engineering",
"license": "MIT",
"private": false,
Expand All @@ -16,7 +16,7 @@
"npm": "please-use-pnpm",
"yarn": "please-use-pnpm",
"node": ">=16",
"pnpm": ">=7.28"
"pnpm": ">=8.9"
},
"dependencies": {
"glob": "^7.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-playwright/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mands/nx-playwright",
"version": "0.6.2",
"version": "0.6.3",
"license": "MIT",
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
5 changes: 3 additions & 2 deletions packages/nx-playwright/src/generators/init/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const MOCK_HOST: Tree = {
const treeFactory = () => MOCK_HOST;

jest.mock('@nx/devkit', () => ({
...jest.requireActual('@nx/devkit'),
addDependenciesToPackageJson: jest.fn(),
updateJson: jest.fn(),
formatFiles: jest.fn(),
Expand Down Expand Up @@ -64,8 +65,8 @@ describe('generator', () => {
expect(addDependenciesToPackageJsonMock).toHaveBeenCalledWith(
host,
{},
expect.objectContaining({
'axe-playwright': undefined,
expect.not.objectContaining({
'axe-playwright': expect.anything(),
}),
);
});
Expand Down
11 changes: 8 additions & 3 deletions packages/nx-playwright/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { addDependenciesToPackageJson, formatFiles, Tree, updateJson } from '@nx/devkit';
import { runTasksInSerial } from '@nx/workspace/src/utilities/run-tasks-in-serial';
import {
addDependenciesToPackageJson,
formatFiles,
runTasksInSerial,
Tree,
updateJson,
} from '@nx/devkit';
import { playwrightAxeVersion, playwrightTestVersion, playwrightVersion } from '../../versions';
import { addGitIgnoreEntry } from './lib/add-git-ignore-entry';
import { InitGeneratorSchema } from './schema';
Expand All @@ -15,9 +20,9 @@ export default async function playwrightInitGenerator(host: Tree, options: InitG
host,
{},
{
'axe-playwright': options.includeAxe ? playwrightAxeVersion : undefined,
'@playwright/test': playwrightTestVersion,
playwright: playwrightVersion,
...(options.includeAxe ? { 'axe-playwright': playwrightAxeVersion } : {}),
},
);

Expand Down
2 changes: 1 addition & 1 deletion packages/nx-playwright/src/generators/project/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
getProjects,
names,
offsetFromRoot,
runTasksInSerial,
Tree,
} from '@nx/devkit';
import { runTasksInSerial } from '@nx/workspace/src/utilities/run-tasks-in-serial';
import { existsSync } from 'fs';
import * as path from 'path';
import playwrightInitGenerator from '../init/generator';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { GeneratorCallback, joinPathFragments, Tree, updateJson } from '@nx/devkit';
import {
GeneratorCallback,
joinPathFragments,
runTasksInSerial,
Tree,
updateJson,
} from '@nx/devkit';
import { Linter, lintProjectGenerator } from '@nx/linter';
import { runTasksInSerial } from '@nx/workspace/src/utilities/run-tasks-in-serial';
import { NxPlaywrightGeneratorNormalizedSchema } from './normalize-options';

type EslintIgnoreFile = {
Expand Down

0 comments on commit e7096f1

Please sign in to comment.