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

feat: upgrade plugins to be compatible with nx@16 #291

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
15 changes: 11 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
Expand All @@ -23,13 +23,20 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ testem.log
# System Files
.DS_Store
Thumbs.db

.yarn/cache
11 changes: 11 additions & 0 deletions apps/docusaurus-e2e/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@ module.exports = {
displayName: 'docusaurus-e2e',
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/apps/docusaurus-e2e',
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest', {
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
}],
},
};
13 changes: 7 additions & 6 deletions apps/docusaurus-e2e/project.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "docusaurus-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/docusaurus-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"executor": "@nx/jest:jest",
"options": {
"target": "docusaurus:build",
"jestConfig": "apps/docusaurus-e2e/jest.config.ts"
}
"jestConfig": "apps/docusaurus-e2e/jest.config.ts",
"runInBand": true
},
"dependsOn": ["docusaurus:build"]
}
},
"tags": [],
"implicitDependencies": ["docusaurus"],
"name": "docusaurus-e2e"
"implicitDependencies": ["docusaurus"]
}
2 changes: 1 addition & 1 deletion apps/docusaurus-e2e/tests/docusaurus.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ensureNxProject, uniq } from '@nrwl/nx-plugin/testing';
import { ensureNxProject, uniq } from '@nx/plugin/testing';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

describe('docusaurus e2e', () => {
Expand Down
3 changes: 3 additions & 0 deletions apps/nuxt-e2e/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module.exports = {
displayName: 'nuxt-e2e',
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/apps/nuxt-e2e',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
};
13 changes: 7 additions & 6 deletions apps/nuxt-e2e/project.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "nuxt-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/nuxt-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"executor": "@nx/jest:jest",
"options": {
"target": "nuxt:build",
"jestConfig": "apps/nuxt-e2e/jest.config.ts"
}
"jestConfig": "apps/nuxt-e2e/jest.config.ts",
"runInBand": true
},
"dependsOn": ["nuxt:build"]
}
},
"tags": [],
"implicitDependencies": ["nuxt"],
"name": "nuxt-e2e"
"implicitDependencies": ["nuxt"]
}
2 changes: 1 addition & 1 deletion apps/nuxt-e2e/tests/nuxt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ensureNxProject,
uniq,
updateFile,
} from '@nrwl/nx-plugin/testing';
} from '@nx/plugin/testing';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

describe('nuxt e2e', () => {
Expand Down
8 changes: 2 additions & 6 deletions apps/vite-e2e/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
module.exports = {
displayName: 'vite-e2e',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
globals: {},
transform: {
'^.+\\.[tj]s$': 'ts-jest',
'^.+\\.(t|j)sx?$': '@swc/jest',
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/vite-e2e',
Expand Down
13 changes: 7 additions & 6 deletions apps/vite-e2e/project.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "vite-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/vite-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"executor": "@nx/jest:jest",
"options": {
"target": "vite:build",
"jestConfig": "apps/vite-e2e/jest.config.ts"
}
"jestConfig": "apps/vite-e2e/jest.config.ts",
"runInBand": true
},
"dependsOn": ["vite:build"]
}
},
"tags": [],
"implicitDependencies": ["vite"],
"name": "vite-e2e"
"implicitDependencies": ["vite"]
}
2 changes: 1 addition & 1 deletion apps/vite-e2e/tests/vite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ensureNxProject,
uniq,
updateFile,
} from '@nrwl/nx-plugin/testing';
} from '@nx/plugin/testing';
import { join } from 'path';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

Expand Down
3 changes: 3 additions & 0 deletions apps/vue-e2e/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ module.exports = {
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/apps/vue-e2e',
maxWorkers: 1,
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
};
13 changes: 7 additions & 6 deletions apps/vue-e2e/project.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "vue-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/vue-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"executor": "@nx/jest:jest",
"options": {
"target": "vue:build",
"jestConfig": "apps/vue-e2e/jest.config.ts"
}
"jestConfig": "apps/vue-e2e/jest.config.ts",
"runInBand": true
},
"dependsOn": ["vue:build"]
}
},
"tags": [],
"implicitDependencies": ["vue"],
"name": "vue-e2e"
"implicitDependencies": ["vue"]
}
2 changes: 1 addition & 1 deletion apps/vue-e2e/tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { tags } from '@angular-devkit/core';
import { checkFilesExist, tmpProjPath } from '@nrwl/nx-plugin/testing';
import { checkFilesExist, tmpProjPath } from '@nx/plugin/testing';
import * as cp from 'child_process';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

Expand Down
2 changes: 1 addition & 1 deletion apps/vue-e2e/tests/vue-2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ensureNxProject,
uniq,
updateFile,
} from '@nrwl/nx-plugin/testing';
} from '@nx/plugin/testing';
import { runNxProdCommandAsync, testGeneratedApp } from './utils';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

Expand Down
2 changes: 1 addition & 1 deletion apps/vue-e2e/tests/vue-3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ensureNxProject,
uniq,
updateFile,
} from '@nrwl/nx-plugin/testing';
} from '@nx/plugin/testing';
import { runNxProdCommandAsync, testGeneratedApp } from './utils';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { getJestProjects } = require('@nrwl/jest');
const { getJestProjects } = require('@nx/jest');

export default { projects: getJestProjects() };
16 changes: 14 additions & 2 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
const nxPreset = require('@nrwl/jest/preset').default;
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
module.exports = {
...nxPreset,
/* TODO: Update to latest Jest snapshotFormat
* By default Nx has kept the older style of Jest Snapshot formats
* to prevent breaking of any existing tests with snapshots.
* It's recommend you update to the latest format.
* You can do this by removing snapshotFormat property
* and running tests with --update-snapshot flag.
* Example: "nx affected --targets=test --update-snapshot"
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
*/
snapshotFormat: { escapeString: true, printBasicPrototype: true },
};
12 changes: 10 additions & 2 deletions libs/docusaurus/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
/* eslint-disable */
export default {
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
'^.+\\.(t|j)sx?$': ['@swc/jest', {
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
}],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
coverageDirectory: '../../coverage/libs/docusaurus',
globals: { 'ts-jest': { tsconfig: '<rootDir>/tsconfig.spec.json' } },
globals: {},
displayName: 'docusaurus',
testEnvironment: 'node',
preset: '../../jest.preset.js',
Expand Down
8 changes: 3 additions & 5 deletions libs/docusaurus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nx-plus/docusaurus",
"version": "15.0.0-rc.0",
"version": "16.0.0",
"main": "src/index.js",
"generators": "./generators.json",
"executors": "./executors.json",
Expand All @@ -24,10 +24,8 @@
"url": "https://github.com/ZachJW34/nx-plus/issues"
},
"homepage": "https://github.com/ZachJW34/nx-plus/tree/master/libs/docusaurus#readme",
"peerDependencies": {
"@nrwl/workspace": "^15.0.0"
},
"peerDependencies": {},
"dependencies": {
"@nrwl/devkit": "^15.0.0"
"@nx/devkit": "^16.0.0"
}
}
13 changes: 7 additions & 6 deletions libs/docusaurus/project.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
{
"name": "docusaurus",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/docusaurus/src",
"projectType": "library",
"generators": {},
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/docusaurus/**/*.ts",
"libs/docusaurus/**/*.spec.ts",
"libs/docusaurus/**/*.spec.tsx",
"libs/docusaurus/**/*.spec.js",
"libs/docusaurus/**/*.spec.jsx",
"libs/docusaurus/**/*.d.ts"
"libs/docusaurus/**/*.d.ts",
"libs/docusaurus/package.json"
]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "libs/docusaurus/jest.config.ts",
"passWithNoTests": true
},
"outputs": ["{workspaceRoot}/coverage/libs/docusaurus"]
},
"build": {
"executor": "@nrwl/js:tsc",
"executor": "@nx/js:tsc",
"options": {
"outputPath": "dist/libs/docusaurus",
"tsConfig": "libs/docusaurus/tsconfig.lib.json",
Expand Down Expand Up @@ -55,6 +57,5 @@
"outputs": ["{options.outputPath}"]
}
},
"tags": [],
"name": "docusaurus"
"tags": []
}
2 changes: 1 addition & 1 deletion libs/docusaurus/src/executors/browser/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convertNxExecutor } from '@nrwl/devkit';
import { convertNxExecutor } from '@nx/devkit';
import { default as browserExecutor } from './executor';

export default convertNxExecutor(browserExecutor);
5 changes: 3 additions & 2 deletions libs/docusaurus/src/executors/browser/executor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build } from '@docusaurus/core/lib';
import { ExecutorContext } from '@nrwl/devkit';
import { ExecutorContext } from '@nx/devkit';
import * as path from 'path';
import { join } from 'path';
import { BrowserExecutorSchema } from './schema';
Expand All @@ -10,7 +10,8 @@ export default async function* runExecutor(
) {
const projectRoot = path.join(
context.root,
context.workspace.projects[context.projectName ?? ''].root
context.projectsConfigurations?.projects?.[context?.projectName ?? '']
?.root ?? ''
);

try {
Expand Down
1 change: 0 additions & 1 deletion libs/docusaurus/src/executors/browser/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"version": 2,
"outputCapture": "direct-nodejs",
"$schema": "http://json-schema.org/schema",
"cli": "nx",
"title": "Browser executor",
"description": "",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion libs/docusaurus/src/executors/dev-server/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convertNxExecutor } from '@nrwl/devkit';
import { convertNxExecutor } from '@nx/devkit';
import { default as devServerExecutor } from './executor';

export default convertNxExecutor(devServerExecutor);
Loading