feat(repo): replace usages of @nrwl/ with @nx/ in tooling packages (#16351)

This commit is contained in:
Jason Jean 2023-04-18 12:15:33 -04:00 committed by GitHub
parent 2dd59c3b57
commit 5a0a4e8d26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
209 changed files with 1631 additions and 1401 deletions

View File

@ -168,7 +168,7 @@ describe('Linter', () => {
);
updateFile(newRulePath, updatedRuleContents);
const newRuleNameForUsage = `@nrwl/nx/workspace/${newRuleName}`;
const newRuleNameForUsage = `@nx/nx/workspace/${newRuleName}`;
// Add the new workspace rule to the lint config and run linting
const eslintrc = readJson('.eslintrc.json');
@ -199,10 +199,10 @@ describe('Linter', () => {
const eslint = readJson('.eslintrc.json');
eslint.overrides[0].rules[
'@nrwl/nx/enforce-module-boundaries'
'@nx/nx/enforce-module-boundaries'
][1].depConstraints = [
{ sourceTag: 'validtag', onlyDependOnLibsWithTags: ['validtag'] },
...eslint.overrides[0].rules['@nrwl/nx/enforce-module-boundaries'][1]
...eslint.overrides[0].rules['@nx/nx/enforce-module-boundaries'][1]
.depConstraints,
];
updateFile('.eslintrc.json', JSON.stringify(eslint, null, 2));
@ -454,8 +454,8 @@ describe('Linter', () => {
const e2eEslint = readJson('e2e/.eslintrc.json');
// should directly refer to nx plugin
expect(rootEslint.plugins).toEqual(['@nrwl/nx']);
expect(e2eEslint.plugins).toEqual(['@nrwl/nx']);
expect(rootEslint.plugins).toEqual(['@nx/nx']);
expect(e2eEslint.plugins).toEqual(['@nx/nx']);
}
function verifySuccessfulMigratedSetup(myapp: string, mylib: string) {
@ -476,7 +476,7 @@ describe('Linter', () => {
const libEslint = readJson(`libs/${mylib}/.eslintrc.json`);
// should directly refer to nx plugin
expect(rootEslint.plugins).toEqual(['@nrwl/nx']);
expect(rootEslint.plugins).toEqual(['@nx/nx']);
expect(appEslint.plugins).toBeUndefined();
expect(e2eEslint.plugins).toBeUndefined();
expect(libEslint.plugins).toBeUndefined();
@ -541,7 +541,7 @@ describe('Linter', () => {
// should have no plugin extends
expect(appEslint.overrides[0].extends).toEqual([
'plugin:@nrwl/nx/angular',
'plugin:@nx/nx/angular',
'plugin:@angular-eslint/template/process-inline-templates',
]);
expect(e2eEslint.overrides[0].extends).toBeUndefined();

View File

@ -1,22 +1,19 @@
import { ProjectConfiguration } from '@nx/devkit';
import {
checkFilesExist,
cleanupProject,
createFile,
expectTestsPass,
isNotWindows,
getPackageManagerCommand,
killPorts,
newProject,
readJson,
readProjectConfig,
runCLI,
runCLIAsync,
runCommand,
uniq,
updateFile,
createFile,
readFile,
removeFile,
cleanupProject,
runCommand,
getPackageManagerCommand,
updateJson,
} from '@nrwl/e2e/utils';
import type { PackageJson } from 'nx/src/utils/package-json';

View File

@ -179,7 +179,7 @@ describe('create-nx-workspace', () => {
expectNoAngularDevkit();
expectNoTsJestInJestConfig(appName);
const packageJson = readJson('package.json');
expect(packageJson.devDependencies['@nrwl/webpack']).toBeDefined();
expect(packageJson.devDependencies['@nx/webpack']).toBeDefined();
expectCodeIsFormatted();
});
@ -197,8 +197,8 @@ describe('create-nx-workspace', () => {
expectNoAngularDevkit();
const packageJson = readJson('package.json');
expect(packageJson.devDependencies['@nrwl/webpack']).not.toBeDefined();
expect(packageJson.devDependencies['@nrwl/vite']).toBeDefined();
expect(packageJson.devDependencies['@nx/webpack']).not.toBeDefined();
expect(packageJson.devDependencies['@nx/vite']).toBeDefined();
expectCodeIsFormatted();
});

View File

@ -11,7 +11,7 @@ exports[`addLinting generator should correctly generate the .eslintrc.json file
"overrides": [
{
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
],
"files": [
@ -38,7 +38,7 @@ exports[`addLinting generator should correctly generate the .eslintrc.json file
},
{
"extends": [
"plugin:@nrwl/nx/angular-template",
"plugin:@nx/nx/angular-template",
],
"files": [
"*.html",
@ -60,7 +60,7 @@ exports[`addLinting generator support angular v14 should correctly generate the
"overrides": [
{
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
],
"files": [
@ -87,7 +87,7 @@ exports[`addLinting generator support angular v14 should correctly generate the
},
{
"extends": [
"plugin:@nrwl/nx/angular-template",
"plugin:@nx/nx/angular-template",
],
"files": [
"*.html",

View File

@ -72,7 +72,7 @@ describe('addLinting generator', () => {
const project = readProjectConfiguration(tree, appProjectName);
expect(project.targets.lint).toEqual({
executor: '@nrwl/linter:eslint',
executor: '@nx/linter:eslint',
options: {
lintFilePatterns: [
`${appProjectRoot}/**/*.ts`,
@ -150,7 +150,7 @@ describe('addLinting generator', () => {
const project = readProjectConfiguration(tree, appProjectName);
expect(project.targets.lint).toEqual({
executor: '@nrwl/linter:eslint',
executor: '@nx/linter:eslint',
options: {
lintFilePatterns: [
`${appProjectRoot}/**/*.ts`,

View File

@ -18,7 +18,7 @@ export const extendAngularEslintJson = (
files: ['*.ts'],
extends: [
...(json.overrides[0].extends || []),
'plugin:@nrwl/nx/angular',
'plugin:@nx/nx/angular',
'plugin:@angular-eslint/template/process-inline-templates',
],
rules: {
@ -42,7 +42,7 @@ export const extendAngularEslintJson = (
},
{
files: ['*.html'],
extends: ['plugin:@nrwl/nx/angular-template'],
extends: ['plugin:@nx/nx/angular-template'],
/**
* Having an empty rules object present makes it more obvious to the user where they would
* extend things from if they needed to
@ -75,7 +75,7 @@ export function createEsLintConfiguration(
{
files: ['*.ts'],
extends: [
'plugin:@nrwl/nx/angular',
'plugin:@nx/nx/angular',
'plugin:@angular-eslint/template/process-inline-templates',
],
/**
@ -117,7 +117,7 @@ export function createEsLintConfiguration(
},
{
files: ['*.html'],
extends: ['plugin:@nrwl/nx/angular-template'],
extends: ['plugin:@nx/nx/angular-template'],
/**
* Having an empty rules object present makes it more obvious to the user where they would
* extend things from if they needed to

View File

@ -463,7 +463,7 @@ exports[`app nested should create project configs 1`] = `
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-dir/my-app/**/*.ts",
@ -499,7 +499,7 @@ exports[`app nested should create project configs 1`] = `
"codeCoverage": true,
},
},
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "apps/my-dir/my-app/jest.config.ts",
"passWithNoTests": true,
@ -533,7 +533,7 @@ exports[`app nested should create project configs 2`] = `
"devServerTarget": "my-dir-my-app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/my-dir/my-app-e2e/cypress.config.ts",
"devServerTarget": "my-dir-my-app:serve:development",
@ -541,7 +541,7 @@ exports[`app nested should create project configs 2`] = `
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-dir/my-app-e2e/**/*.{js,ts}",
@ -621,7 +621,7 @@ exports[`app not nested should create project configs 1`] = `
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-app/**/*.ts",
@ -657,7 +657,7 @@ exports[`app not nested should create project configs 1`] = `
"codeCoverage": true,
},
},
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "apps/my-app/jest.config.ts",
"passWithNoTests": true,
@ -691,7 +691,7 @@ exports[`app not nested should create project configs 2`] = `
"devServerTarget": "my-app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/my-app-e2e/cypress.config.ts",
"devServerTarget": "my-app:serve:development",
@ -699,7 +699,7 @@ exports[`app not nested should create project configs 2`] = `
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-app-e2e/**/*.{js,ts}",

View File

@ -463,7 +463,7 @@ describe('app', () => {
expect(readProjectConfiguration(appTree, 'my-app').targets.lint)
.toMatchInlineSnapshot(`
{
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-app/**/*.ts",
@ -478,7 +478,7 @@ describe('app', () => {
expect(readProjectConfiguration(appTree, 'my-app-e2e').targets.lint)
.toMatchInlineSnapshot(`
{
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-app-e2e/**/*.{js,ts}",
@ -506,7 +506,7 @@ describe('app', () => {
"overrides": [
{
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
],
"files": [
@ -533,7 +533,7 @@ describe('app', () => {
},
{
"extends": [
"plugin:@nrwl/nx/angular-template",
"plugin:@nx/nx/angular-template",
],
"files": [
"*.html",

View File

@ -14,7 +14,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
"*.jsx",
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/nx/enforce-module-boundaries": [
"error",
{
"allow": [
@ -92,7 +92,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
},
{
"extends": [
"plugin:@nrwl/nx/typescript",
"plugin:@nx/nx/typescript",
],
"files": [
"*.ts",
@ -102,7 +102,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
},
{
"extends": [
"plugin:@nrwl/nx/javascript",
"plugin:@nx/nx/javascript",
],
"files": [
"*.js",
@ -238,7 +238,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
},
],
"plugins": [
"@nrwl/nx",
"@nx/nx",
],
"root": true,
}
@ -255,7 +255,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
"overrides": [
{
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
],
"files": [
@ -287,7 +287,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
},
{
"extends": [
"plugin:@nrwl/nx/angular-template",
"plugin:@nx/nx/angular-template",
],
"files": [
"*.html",
@ -317,7 +317,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
"*.jsx",
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/nx/enforce-module-boundaries": [
"error",
{
"allow": [
@ -395,7 +395,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
},
{
"extends": [
"plugin:@nrwl/nx/typescript",
"plugin:@nx/nx/typescript",
],
"files": [
"*.ts",
@ -405,7 +405,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
},
{
"extends": [
"plugin:@nrwl/nx/javascript",
"plugin:@nx/nx/javascript",
],
"files": [
"*.js",
@ -541,7 +541,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
},
],
"plugins": [
"@nrwl/nx",
"@nx/nx",
],
"root": true,
}
@ -554,8 +554,8 @@ exports[`convert-tslint-to-eslint should work for Angular applications 1`] = `
"@angular-eslint/eslint-plugin": "~15.0.0",
"@angular-eslint/eslint-plugin-template": "~15.0.0",
"@angular-eslint/template-parser": "~15.0.0",
"@nrwl/eslint-plugin-nx": "0.0.1",
"@nrwl/linter": "0.0.1",
"@nx/eslint-plugin-nx": "0.0.1",
"@nx/linter": "0.0.1",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "~8.15.0",
@ -575,7 +575,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 2`] = `
"root": "apps/angular-app-1",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/angular-app-1/**/*.ts",
@ -604,7 +604,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = `
"*.jsx",
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/nx/enforce-module-boundaries": [
"error",
{
"allow": [
@ -682,7 +682,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = `
},
{
"extends": [
"plugin:@nrwl/nx/typescript",
"plugin:@nx/nx/typescript",
],
"files": [
"*.ts",
@ -692,7 +692,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = `
},
{
"extends": [
"plugin:@nrwl/nx/javascript",
"plugin:@nx/nx/javascript",
],
"files": [
"*.js",
@ -828,7 +828,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = `
},
],
"plugins": [
"@nrwl/nx",
"@nx/nx",
],
"root": true,
}
@ -845,7 +845,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 4`] = `
"overrides": [
{
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
],
"files": [
@ -883,7 +883,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 4`] = `
},
{
"extends": [
"plugin:@nrwl/nx/angular-template",
"plugin:@nx/nx/angular-template",
],
"files": [
"*.html",
@ -906,8 +906,8 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 1`] = `
"@angular-eslint/eslint-plugin": "~15.0.0",
"@angular-eslint/eslint-plugin-template": "~15.0.0",
"@angular-eslint/template-parser": "~15.0.0",
"@nrwl/eslint-plugin-nx": "0.0.1",
"@nrwl/linter": "0.0.1",
"@nx/eslint-plugin-nx": "0.0.1",
"@nx/linter": "0.0.1",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "~8.15.0",
@ -927,7 +927,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 2`] = `
"root": "libs/angular-lib-1",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/angular-lib-1/**/*.ts",
@ -956,7 +956,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = `
"*.jsx",
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/nx/enforce-module-boundaries": [
"error",
{
"allow": [
@ -1034,7 +1034,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = `
},
{
"extends": [
"plugin:@nrwl/nx/typescript",
"plugin:@nx/nx/typescript",
],
"files": [
"*.ts",
@ -1044,7 +1044,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = `
},
{
"extends": [
"plugin:@nrwl/nx/javascript",
"plugin:@nx/nx/javascript",
],
"files": [
"*.js",
@ -1180,7 +1180,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = `
},
],
"plugins": [
"@nrwl/nx",
"@nx/nx",
],
"root": true,
}
@ -1197,7 +1197,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 4`] = `
"overrides": [
{
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
],
"files": [
@ -1229,7 +1229,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 4`] = `
},
{
"extends": [
"plugin:@nrwl/nx/angular-template",
"plugin:@nx/nx/angular-template",
],
"files": [
"*.html",

View File

@ -321,7 +321,7 @@ describe('convert-tslint-to-eslint', () => {
* We will make a change to the eslint config before the next step
*/
eslintContent.overrides[0].rules[
'@nrwl/nx/enforce-module-boundaries'
'@nx/nx/enforce-module-boundaries'
][1].enforceBuildableLibDependency = false;
writeJson(host, '.eslintrc.json', eslintContent);

View File

@ -94,7 +94,7 @@ describe('Cypress Component Testing Configuration', () => {
expect(
readProjectConfiguration(tree, 'fancy-lib').targets['component-test']
).toEqual({
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: 'libs/fancy-lib/cypress.config.ts',
devServerTarget: 'fancy-app:build',
@ -156,7 +156,7 @@ describe('Cypress Component Testing Configuration', () => {
expect(
readProjectConfiguration(tree, 'fancy-lib').targets['component-test']
).toEqual({
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: 'libs/fancy-lib/cypress.config.ts',
devServerTarget: 'fancy-app:build:development',
@ -249,7 +249,7 @@ describe('Cypress Component Testing Configuration', () => {
expect(
readProjectConfiguration(tree, 'fancy-app').targets['component-test']
).toEqual({
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: 'apps/fancy-app/cypress.config.ts',
devServerTarget: 'fancy-app:build',
@ -309,7 +309,7 @@ describe('Cypress Component Testing Configuration', () => {
expect(
readProjectConfiguration(tree, 'fancy-lib').targets['component-test']
).toEqual({
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: 'libs/fancy-lib/cypress.config.ts',
devServerTarget: 'fancy-app:build',

View File

@ -130,7 +130,7 @@ describe('init', () => {
const { devDependencies } = readJson(tree, 'package.json');
// ASSERT
expect(devDependencies['@nrwl/jest']).toBeDefined();
expect(devDependencies['@nx/jest']).toBeDefined();
expect(devDependencies['jest']).toBeDefined();
expect(devDependencies['jest-preset-angular']).toBeDefined();
});
@ -184,7 +184,7 @@ describe('init', () => {
const { devDependencies } = readJson(tree, 'package.json');
// ASSERT
expect(devDependencies['@nrwl/cypress']).toBeDefined();
expect(devDependencies['@nx/cypress']).toBeDefined();
expect(devDependencies['cypress']).toBeDefined();
});
@ -482,7 +482,7 @@ bar
const { devDependencies } = readJson(tree, 'package.json');
// ASSERT
expect(devDependencies['@nrwl/jest']).toBeDefined();
expect(devDependencies['@nx/jest']).toBeDefined();
expect(devDependencies['jest']).toBeDefined();
expect(devDependencies['jest-preset-angular']).toEqual(
backwardCompatibleVersions.angularV14.jestPresetAngularVersion
@ -538,7 +538,7 @@ bar
const { devDependencies } = readJson(tree, 'package.json');
// ASSERT
expect(devDependencies['@nrwl/cypress']).toBeDefined();
expect(devDependencies['@nx/cypress']).toBeDefined();
expect(devDependencies['cypress']).toBeDefined();
});

View File

@ -1108,7 +1108,7 @@ describe('lib', () => {
expect(readProjectConfiguration(tree, 'my-lib').targets['lint'])
.toMatchInlineSnapshot(`
{
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/my-lib/**/*.ts",
@ -1140,7 +1140,7 @@ describe('lib', () => {
"overrides": [
{
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
],
"files": [
@ -1167,7 +1167,7 @@ describe('lib', () => {
},
{
"extends": [
"plugin:@nrwl/nx/angular-template",
"plugin:@nx/nx/angular-template",
],
"files": [
"*.html",

View File

@ -15,11 +15,12 @@ export default defineConfig({
exports[`e2e migrator cypress with project root at "" cypress version >=10 should create a cypress.config.ts file when it does not exist 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname)
});"
});
"
`;
exports[`e2e migrator cypress with project root at "" cypress version >=10 should keep paths in the e2e config when they differ from the nx preset defaults 1`] = `
@ -90,11 +91,12 @@ export default defineConfig({
exports[`e2e migrator cypress with project root at "projects/app1" cypress version >=10 should create a cypress.config.ts file when it does not exist 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname)
});"
});
"
`;
exports[`e2e migrator cypress with project root at "projects/app1" cypress version >=10 should keep paths in the e2e config when they differ from the nx preset defaults 1`] = `

View File

@ -30,7 +30,10 @@ export function addCypressOnErrorWorkaround(tree: Tree, schema: Schema) {
return;
}
if (e2eProject.targets.e2e.executor !== '@nrwl/cypress:cypress') {
if (
e2eProject.targets.e2e.executor !== '@nx/cypress:cypress' &&
e2eProject.targets.e2e.executor !== '@nrwl/cypress:cypress'
) {
// Not a cypress e2e project, skip
return;
}

View File

@ -4,6 +4,7 @@ import {
readProjectConfiguration,
Tree,
updateJson,
updateProjectConfiguration,
} from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports';
import {
@ -75,6 +76,18 @@ async function setup(tree: Tree, name: string) {
skipPackageJson: true,
});
const projectConfig = readProjectConfiguration(tree, name);
updateProjectConfiguration(tree, name, {
...projectConfig,
targets: {
...projectConfig.targets,
test: {
...projectConfig.targets.test,
executor: '@nrwl/jest:jest',
},
},
});
updateJson(tree, `${name}/tsconfig.spec.json`, (json) => {
// revert to before jest-preset-angular v13
delete json.compilerOptions.target;
@ -85,6 +98,18 @@ async function setup(tree: Tree, name: string) {
name: `${name}-lib`,
});
const libConfig = readProjectConfiguration(tree, `${name}-lib`);
updateProjectConfiguration(tree, `${name}-lib`, {
...libConfig,
targets: {
...libConfig.targets,
test: {
...libConfig.targets.test,
executor: '@nrwl/jest:jest',
},
},
});
updateJson(tree, `${name}/tsconfig.spec.json`, (json) => {
// revert to before jest-preset-angular v13
delete json.compilerOptions.target;

View File

@ -10,7 +10,7 @@
"files": ["**/*.ts"],
"excludedFiles": ["./src/migrations/**"],
"rules": {
"no-restricted-imports": ["error", "@nrwl/workspace"]
"no-restricted-imports": ["error", "@nx/workspace"]
}
},
{

View File

@ -37,7 +37,7 @@ describe('Cypress builder', () => {
projects: {
'my-app': {
targets: {
serve: { executor: '@nrwl/webpack:webpack', options: {} },
serve: { executor: '@nx/webpack:webpack', options: {} },
},
},
},

View File

@ -417,7 +417,7 @@ ${e.message || e}`);
let targetHasOpt = Object.keys(targetOpts).includes(property);
if (!targetHasOpt) {
// NOTE: readTargetOptions doesn't apply non defaulted values, i.e. @nrwl/vite has a port options but is optional
// NOTE: readTargetOptions doesn't apply non defaulted values, i.e. @nx/vite has a port options but is optional
// so we double check the schema if readTargetOptions didn't return a value for the property
const projectConfig =
context.projectsConfigurations?.projects?.[target.project];

View File

@ -4,8 +4,8 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 1`] = `
{
"dependencies": {},
"devDependencies": {
"@nrwl/eslint-plugin-nx": "0.0.1",
"@nrwl/linter": "0.0.1",
"@nx/eslint-plugin-nx": "0.0.1",
"@nx/linter": "0.0.1",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "~8.15.0",
@ -25,7 +25,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 2`] = `
"root": "apps/e2e-app-1",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/e2e-app-1/**/*.{js,ts}",
@ -53,7 +53,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = `
"*.jsx",
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/nx/enforce-module-boundaries": [
"error",
{
"allow": [
@ -131,7 +131,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = `
},
{
"extends": [
"plugin:@nrwl/nx/typescript",
"plugin:@nx/nx/typescript",
],
"files": [
"*.ts",
@ -141,7 +141,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = `
},
{
"extends": [
"plugin:@nrwl/nx/javascript",
"plugin:@nx/nx/javascript",
],
"files": [
"*.js",
@ -238,7 +238,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = `
},
],
"plugins": [
"@nrwl/nx",
"@nx/nx",
],
"root": true,
}

View File

@ -21,8 +21,8 @@ export async function conversionGenerator(
* to perform in order to convert a project from TSLint to ESLint, as well as some
* extensibility points for adjusting the behavior on a per package basis.
*
* E.g. @nrwl/angular projects might need to make different changes to the final
* ESLint config when compared with @nrwl/next projects.
* E.g. @nx/angular projects might need to make different changes to the final
* ESLint config when compared with @nx/next projects.
*
* See the ProjectConverter implementation for a full breakdown of what it does.
*/
@ -85,7 +85,7 @@ export async function conversionGenerator(
/**
* Store user preferences for the collection
*/
projectConverter.setDefaults('@nrwl/cypress', defaults);
projectConverter.setDefaults('@nx/cypress', defaults);
/**
* Based on user preference and remaining usage, remove TSLint from the workspace entirely.

View File

@ -2,7 +2,7 @@
exports[`Cypress Component Project should add base cypress component testing config 1`] = `
{
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "libs/cool-lib/cypress.config.ts",
"testingType": "component",
@ -12,7 +12,7 @@ exports[`Cypress Component Project should add base cypress component testing con
exports[`Cypress Component Project should not error when rerunning on an existing project 1`] = `
{
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "libs/cool-lib/cypress.config.ts",
"testingType": "component",

View File

@ -18,13 +18,13 @@ let projectConfig: ProjectConfiguration = {
root: 'libs/cool-lib',
targets: {
build: {
executor: '@nrwl/web:rollup',
executor: '@nx/web:rollup',
options: {
tsConfig: 'libs/cool-lib/tsconfig.lib.json',
},
},
test: {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'libs/cool-lib/jest.config.js',
},
@ -181,7 +181,7 @@ describe('Cypress Component Project', () => {
tree.write('libs/cool-lib/cypress.config.ts', '');
const newTarget = {
['component-test']: {
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: 'libs/cool-lib/cypress.config.ts',
testingType: 'component',

View File

@ -89,7 +89,7 @@ function addTargetToProject(
options: CypressComponentProjectSchema
) {
projectConfig.targets['component-test'] = {
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: joinPathFragments(projectConfig.root, 'cypress.config.ts'),
testingType: 'component',

View File

@ -12,7 +12,7 @@ exports[`Cypress e2e configuration v10+ should not override eslint settings if p
"overrides": [
{
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@nx/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
],
"files": [
@ -39,7 +39,7 @@ exports[`Cypress e2e configuration v10+ should not override eslint settings if p
},
{
"extends": [
"plugin:@nrwl/nx/angular-template",
"plugin:@nx/nx/angular-template",
],
"files": [
"*.html",

View File

@ -40,7 +40,7 @@ describe('Cypress e2e configuration', () => {
expect(tree.read('apps/my-app/cypress.config.ts', 'utf-8'))
.toMatchInlineSnapshot(`
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname, {
@ -57,7 +57,7 @@ describe('Cypress e2e configuration', () => {
"devServerTarget": "my-app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/my-app/cypress.config.ts",
"devServerTarget": "my-app:serve",
@ -100,7 +100,7 @@ describe('Cypress e2e configuration', () => {
expect(tree.read('libs/my-lib/cypress.config.ts', 'utf-8'))
.toMatchInlineSnapshot(`
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname, {
@ -248,13 +248,13 @@ describe('Cypress e2e configuration', () => {
],
},
extends: [
'plugin:@nrwl/nx/angular',
'plugin:@nx/nx/angular',
'plugin:@angular-eslint/template/process-inline-templates',
],
},
{
files: ['*.html'],
extends: ['plugin:@nrwl/nx/angular-template'],
extends: ['plugin:@nx/nx/angular-template'],
rules: {},
},
],

View File

@ -174,7 +174,7 @@ function addTarget(tree: Tree, opts: NormalizedSchema) {
const projectConfig = readProjectConfiguration(tree, opts.project);
const cyVersion = installedCypressVersion();
projectConfig.targets.e2e = {
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: joinPathFragments(
projectConfig.root,

View File

@ -1,5 +1,5 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname, {

View File

@ -40,7 +40,7 @@ exports[`Cypress Project < v7 nested should update configuration 1`] = `
"devServerTarget": "my-dir-my-app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/my-dir/my-app-e2e/cypress.json",
"devServerTarget": "my-dir-my-app:serve",
@ -49,7 +49,7 @@ exports[`Cypress Project < v7 nested should update configuration 1`] = `
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-dir/my-app-e2e/**/*.{js,ts}",
@ -86,7 +86,7 @@ exports[`Cypress Project < v7 project with directory in its name should update c
"devServerTarget": "my-dir-my-app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/my-dir/my-app-e2e/cypress.json",
"devServerTarget": "my-dir-my-app:serve",
@ -95,7 +95,7 @@ exports[`Cypress Project < v7 project with directory in its name should update c
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-dir/my-app-e2e/**/*.{js,ts}",
@ -111,7 +111,7 @@ exports[`Cypress Project < v7 project with directory in its name should update c
exports[`Cypress Project < v7 should update configuration (baseUrl) 1`] = `
{
"e2e": {
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"baseUrl": "http://localhost:3000",
"cypressConfig": "apps/my-app-e2e/cypress.json",
@ -120,7 +120,7 @@ exports[`Cypress Project < v7 should update configuration (baseUrl) 1`] = `
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-app-e2e/**/*.{js,ts}",
@ -141,7 +141,7 @@ exports[`Cypress Project < v7 should update configuration 1`] = `
"devServerTarget": "my-app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/my-app-e2e/cypress.json",
"devServerTarget": "my-app:serve",
@ -150,7 +150,7 @@ exports[`Cypress Project < v7 should update configuration 1`] = `
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-app-e2e/**/*.{js,ts}",
@ -171,7 +171,7 @@ exports[`Cypress Project < v7 should update configuration 2`] = `
"devServerTarget": "my-app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/my-app-e2e/cypress.json",
"devServerTarget": "my-app:serve:development",
@ -180,7 +180,7 @@ exports[`Cypress Project < v7 should update configuration 2`] = `
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-app-e2e/**/*.{js,ts}",
@ -195,7 +195,7 @@ exports[`Cypress Project < v7 should update configuration 2`] = `
exports[`Cypress Project > v10 for bundler:vite should pass the bundler info to nxE2EPreset in \`cypress.config.ts\` 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname, {
@ -207,7 +207,7 @@ export default defineConfig({
exports[`Cypress Project > v10 nested should set right path names in \`cypress.config.ts\` 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname),
@ -237,7 +237,7 @@ exports[`Cypress Project > v10 nested should set right path names in \`tsconfig.
exports[`Cypress Project > v10 should set right path names in \`cypress.config.ts\` 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname),
@ -267,7 +267,7 @@ exports[`Cypress Project > v10 should set right path names in \`tsconfig.e2e.jso
exports[`Cypress Project > v10 should update configuration when eslint is passed 1`] = `
{
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/my-app-e2e/**/*.{js,ts}",

View File

@ -96,7 +96,7 @@ function addProject(tree: Tree, options: CypressProjectSchema) {
projectType: 'application',
targets: {
e2e: {
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: joinPathFragments(
options.projectRoot,
@ -129,7 +129,7 @@ function addProject(tree: Tree, options: CypressProjectSchema) {
projectType: 'application',
targets: {
e2e: {
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: joinPathFragments(
options.projectRoot,

View File

@ -1,10 +1,10 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname<% if (bundler === 'vite'){ %>,
e2e: nxE2EPreset(__dirname<% if (bundler === 'vite'){ %>,
{
bundler: 'vite'
}
<% } %>)
});
});

View File

@ -15,7 +15,7 @@ describe('init', () => {
const existing = 'existing';
const existingVersion = '1.0.0';
updateJson(tree, 'package.json', (json) => {
json.dependencies['@nrwl/cypress'] = cypressVersion;
json.dependencies['@nx/cypress'] = cypressVersion;
json.dependencies[existing] = existingVersion;
json.devDependencies[existing] = existingVersion;
@ -25,10 +25,10 @@ describe('init', () => {
const packageJson = readJson(tree, 'package.json');
expect(packageJson.devDependencies.cypress).toBeDefined();
expect(packageJson.devDependencies['@nrwl/cypress']).toBeDefined();
expect(packageJson.devDependencies['@nx/cypress']).toBeDefined();
expect(packageJson.devDependencies['@types/node']).toBeDefined();
expect(packageJson.devDependencies[existing]).toBeDefined();
expect(packageJson.dependencies['@nrwl/cypress']).toBeUndefined();
expect(packageJson.dependencies['@nx/cypress']).toBeUndefined();
expect(packageJson.dependencies[existing]).toBeDefined();
});

View File

@ -37,13 +37,13 @@ function setupE2ETargetDefaults(tree: Tree) {
}
function updateDependencies(tree: Tree) {
removeDependenciesFromPackageJson(tree, ['@nrwl/cypress'], []);
removeDependenciesFromPackageJson(tree, ['@nx/cypress'], []);
return addDependenciesToPackageJson(
tree,
{},
{
['@nrwl/cypress']: nxVersion,
['@nx/cypress']: nxVersion,
cypress: cypressVersion,
'@types/node': typesNodeVersion,
}

View File

@ -2,7 +2,7 @@
exports[`convertToCypressTen convertCypressProject should handle custom target names 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
const cypressJsonConfig = {
fileServerFolder: '.',
@ -25,7 +25,7 @@ export default defineConfig({
exports[`convertToCypressTen convertCypressProject should handle multiple configurations 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
const cypressJsonConfig = {
fileServerFolder: '.',
@ -56,7 +56,7 @@ exports[`convertToCypressTen convertCypressProject should handle multiple config
"baseUrl": "http://localhost:3000",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/app-e2e/cypress.config.ts",
"devServerTarget": "app:serve",
@ -67,7 +67,7 @@ exports[`convertToCypressTen convertCypressProject should handle multiple config
exports[`convertToCypressTen convertCypressProject should handle multiple configurations with no default cypressConfig option 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
const cypressJsonConfig = {
fileServerFolder: '.',
@ -100,7 +100,7 @@ exports[`convertToCypressTen convertCypressProject should handle multiple config
"cypressConfig": "apps/app-e2e/cypress.config.ts",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"baseUrl": "http://localhost:4200",
"testingType": "e2e",
@ -110,7 +110,7 @@ exports[`convertToCypressTen convertCypressProject should handle multiple config
exports[`convertToCypressTen convertCypressProject should handle sharing the same config across projects 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
const cypressJsonConfig = {
fileServerFolder: '.',
@ -131,7 +131,7 @@ export default defineConfig({
exports[`convertToCypressTen convertCypressProject should infer targets with --all flag 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
const cypressJsonConfig = {
fileServerFolder: '.',
@ -160,7 +160,7 @@ exports[`convertToCypressTen convertCypressProject should infer targets with --a
"devServerTarget": "app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/app-e2e/cypress.config.ts",
"devServerTarget": "app:serve",
@ -173,7 +173,7 @@ exports[`convertToCypressTen convertCypressProject should infer targets with --a
"devServerTarget": "app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/app-e2e/cypress.config.ts",
"devServerTarget": "app:serve",
@ -181,7 +181,7 @@ exports[`convertToCypressTen convertCypressProject should infer targets with --a
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/app-e2e/**/*.{js,ts}",
@ -196,7 +196,7 @@ exports[`convertToCypressTen convertCypressProject should infer targets with --a
exports[`convertToCypressTen convertCypressProject should not break when an invalid target is passed in 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
const cypressJsonConfig = {
fileServerFolder: '.',
@ -225,7 +225,7 @@ exports[`convertToCypressTen convertCypressProject should not break when an inva
"devServerTarget": "app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/app-e2e/cypress.config.ts",
"devServerTarget": "app:serve",
@ -238,7 +238,7 @@ exports[`convertToCypressTen convertCypressProject should not break when an inva
"devServerTarget": "app:serve:production",
},
},
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/app-e2e/cypress.config.ts",
"devServerTarget": "app:serve",
@ -246,7 +246,7 @@ exports[`convertToCypressTen convertCypressProject should not break when an inva
},
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/app-e2e/**/*.{js,ts}",
@ -261,7 +261,7 @@ exports[`convertToCypressTen convertCypressProject should not break when an inva
exports[`convertToCypressTen convertCypressProject should update project w/customized config 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
import setupNodeEvents from './src/plugins/index';
const cypressJsonConfig = {
@ -287,7 +287,7 @@ export default defineConfig({
exports[`convertToCypressTen convertCypressProject should update project w/defaults 1`] = `
"import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
const cypressJsonConfig = {
fileServerFolder: '.',

View File

@ -324,7 +324,7 @@ export function writeNewConfig(
cypressConfigPathTs,
stripIndents`
import { defineConfig } from 'cypress'
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
${pluginImport}
const cypressJsonConfig = ${convertedConfig}

View File

@ -42,7 +42,7 @@ describe('convertToCypressTen', () => {
sourceRoot: 'apps/app/src',
targets: {
serve: {
executor: '@nrwl/web:file-server',
executor: '@nx/web:file-server',
options: {},
},
},
@ -255,7 +255,7 @@ describe('convertToCypressTen', () => {
pc.targets = {
...pc.targets,
e2e: {
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
baseUrl: 'http://localhost:4200',
},
@ -300,7 +300,7 @@ describe('convertToCypressTen', () => {
sourceRoot: 'apps/app-two/src',
targets: {
serve: {
executor: '@nrwl/web:file-server',
executor: '@nx/web:file-server',
options: {},
},
},
@ -341,7 +341,7 @@ describe('convertToCypressTen', () => {
expect(tree.exists('apps/app-e2e/src/e2e/app.cy.ts')).toBeTruthy();
expect(tree.exists('apps/app-e2e/src/support/e2e.ts')).toBeTruthy();
expect(readProjectConfiguration(tree, 'app-e2e').targets['e2e']).toEqual({
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: 'cypress.config.ts',
devServerTarget: 'app:serve',
@ -363,7 +363,7 @@ describe('convertToCypressTen', () => {
expect(
readProjectConfiguration(tree, 'app-two-e2e').targets['e2e']
).toEqual({
executor: '@nrwl/cypress:cypress',
executor: '@nx/cypress:cypress',
options: {
cypressConfig: 'cypress.config.ts',
devServerTarget: 'app-two:serve',

View File

@ -7,6 +7,7 @@ import {
installPackagesTask,
joinPathFragments,
logger,
ProjectConfiguration,
readProjectConfiguration,
stripIndents,
Tree,
@ -24,6 +25,98 @@ import {
writeNewConfig,
} from './conversion.util';
function migrateCypressExecutorOptions(
tree: Tree,
projectName: string,
target: string,
configuration: string,
previousCypressConfigs: Map<
string,
ReturnType<
(
tree: Tree,
projectConfig: ProjectConfiguration,
cypressConfigPathJson: string
) => {
cypressConfigTs: Record<string, any>;
cypressConfigJson: Record<string, any>;
}
>
>
) {
try {
const projectConfig = readProjectConfiguration(tree, projectName);
const { cypressConfigPathJson, cypressConfigPathTs } = findCypressConfigs(
tree,
projectConfig,
target,
configuration
);
if (!cypressConfigPathJson && !cypressConfigPathTs) {
return;
}
// a matching cypress ts file hasn't been made yet. need to migrate.
if (
tree.exists(cypressConfigPathJson) &&
!tree.exists(cypressConfigPathTs)
) {
let cypressConfigs = createNewCypressConfig(
tree,
projectConfig,
cypressConfigPathJson
);
cypressConfigs = updatePluginFile(tree, projectConfig, cypressConfigs);
writeNewConfig(tree, cypressConfigPathTs, cypressConfigs);
previousCypressConfigs.set(cypressConfigPathJson, cypressConfigs);
tree.delete(cypressConfigPathJson);
}
// ts file has been made and matching json file has been removed only need to update the project config
if (
!tree.exists(cypressConfigPathJson) &&
tree.exists(cypressConfigPathTs)
) {
const cypressConfigs = previousCypressConfigs.get(cypressConfigPathJson);
updateProjectPaths(tree, projectConfig, cypressConfigs);
addConfigToTsConfig(
tree,
(configuration
? projectConfig.targets?.[target]?.configurations?.[configuration]
?.tsConfig
: projectConfig.targets?.[target]?.options?.tsConfig) ||
joinPathFragments(projectConfig.root, 'tsconfig.json'),
cypressConfigPathTs
);
if (configuration) {
projectConfig.targets[target].configurations[configuration] = {
...projectConfig.targets[target].configurations[configuration],
cypressConfig: cypressConfigPathTs,
};
} else {
projectConfig.targets[target].options = {
...projectConfig.targets[target].options,
cypressConfig: cypressConfigPathTs,
};
}
projectConfig.targets[target].options.testingType = 'e2e';
updateProjectConfiguration(tree, projectName, projectConfig);
}
} catch (e) {
logger.error(stripIndents`
NX There was an error converting ${projectName}:${target}.
You can manually update the project by following the migration guide if need be.
https://nx.dev/cypress/v10-migration-guide
`);
throw e;
}
}
export async function migrateCypressProject(tree: Tree) {
assertMinimumCypressVersion(8);
if (installedCypressVersion() >= 10) {
@ -38,83 +131,31 @@ export async function migrateCypressProject(tree: Tree) {
ReturnType<typeof createNewCypressConfig>
>();
forEachExecutorOptions<CypressExecutorOptions>(
tree,
'@nx/cypress:cypress',
(currentValue, projectName, target, configuration) => {
migrateCypressExecutorOptions(
tree,
projectName,
target,
configuration,
previousCypressConfigs
);
}
);
forEachExecutorOptions<CypressExecutorOptions>(
tree,
'@nrwl/cypress:cypress',
(currentValue, projectName, target, configuration) => {
try {
const projectConfig = readProjectConfiguration(tree, projectName);
const { cypressConfigPathJson, cypressConfigPathTs } =
findCypressConfigs(tree, projectConfig, target, configuration);
if (!cypressConfigPathJson && !cypressConfigPathTs) {
return;
}
// a matching cypress ts file hasn't been made yet. need to migrate.
if (
tree.exists(cypressConfigPathJson) &&
!tree.exists(cypressConfigPathTs)
) {
let cypressConfigs = createNewCypressConfig(
tree,
projectConfig,
cypressConfigPathJson
);
cypressConfigs = updatePluginFile(
tree,
projectConfig,
cypressConfigs
);
writeNewConfig(tree, cypressConfigPathTs, cypressConfigs);
previousCypressConfigs.set(cypressConfigPathJson, cypressConfigs);
tree.delete(cypressConfigPathJson);
}
// ts file has been made and matching json file has been removed only need to update the project config
if (
!tree.exists(cypressConfigPathJson) &&
tree.exists(cypressConfigPathTs)
) {
const cypressConfigs = previousCypressConfigs.get(
cypressConfigPathJson
);
updateProjectPaths(tree, projectConfig, cypressConfigs);
addConfigToTsConfig(
tree,
(configuration
? projectConfig.targets?.[target]?.configurations?.[configuration]
?.tsConfig
: projectConfig.targets?.[target]?.options?.tsConfig) ||
joinPathFragments(projectConfig.root, 'tsconfig.json'),
cypressConfigPathTs
);
if (configuration) {
projectConfig.targets[target].configurations[configuration] = {
...projectConfig.targets[target].configurations[configuration],
cypressConfig: cypressConfigPathTs,
};
} else {
projectConfig.targets[target].options = {
...projectConfig.targets[target].options,
cypressConfig: cypressConfigPathTs,
};
}
projectConfig.targets[target].options.testingType = 'e2e';
updateProjectConfiguration(tree, projectName, projectConfig);
}
} catch (e) {
logger.error(stripIndents`
NX There was an error converting ${projectName}:${target}.
You can manually update the project by following the migration guide if need be.
https://nx.dev/cypress/v10-migration-guide
`);
throw e;
}
migrateCypressExecutorOptions(
tree,
projectName,
target,
configuration,
previousCypressConfigs
);
}
);

View File

@ -304,6 +304,10 @@ export default defineConfig({
});
await cypressProjectGenerator(tree, { project: appName, name: e2eName });
const e2eProjectConfig = readProjectConfiguration(tree, e2eName);
e2eProjectConfig.targets['e2e'] = {
...e2eProjectConfig.targets['e2e'],
executor: '@nrwl/cypress:cypress',
};
e2eProjectConfig.targets['e2e'].configurations = {
...e2eProjectConfig.targets['e2e'].configurations,
sb: {

View File

@ -192,6 +192,7 @@ async function setup(tree: Tree) {
executor: '@nrwl/angular:webpack-browser',
options: {},
};
myLib.targets['component-test'].executor = '@nrwl/cypress:cypress';
myLib.targets['component-test'].options.devServerTarget = 'my-lib:build';
updateProjectConfiguration(tree, 'my-lib', myLib);
const anotherLib = readProjectConfiguration(tree, 'another-lib');
@ -199,6 +200,7 @@ async function setup(tree: Tree) {
executor: '@nrwl/webpack:webpack',
options: {},
};
anotherLib.targets['component-test'].executor = '@nrwl/cypress:cypress';
anotherLib.targets['component-test'].options.devServerTarget =
'another-lib:build';
updateProjectConfiguration(tree, 'another-lib', anotherLib);

View File

@ -1,4 +1,9 @@
import { addProjectConfiguration, Tree } from '@nx/devkit';
import {
addProjectConfiguration,
readProjectConfiguration,
Tree,
updateProjectConfiguration,
} from '@nx/devkit';
import { libraryGenerator } from '@nx/js';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import updateToCypress11 from './cypress-11';
@ -118,6 +123,9 @@ async function setup(tree: Tree) {
project: 'my-react-lib',
skipFormat: true,
});
const projectConfig = readProjectConfiguration(tree, 'my-react-lib');
projectConfig.targets['component-test'].executor = '@nrwl/cypress:cypress';
updateProjectConfiguration(tree, 'my-react-lib', projectConfig);
tree.write(
'libs/my-react-lib/cypress/support/commands.ts',
`/// <reference types="cypress" />
@ -262,6 +270,9 @@ describe('again', () => {
project: 'my-ng-lib',
skipFormat: true,
});
const projectConfig2 = readProjectConfiguration(tree, 'my-ng-lib');
projectConfig2.targets['component-test'].executor = '@nrwl/cypress:cypress';
updateProjectConfiguration(tree, 'my-ng-lib', projectConfig2);
tree.write(
'libs/my-ng-lib/cypress/support/commands.ts',
`/// <reference types="cypress" />

View File

@ -78,7 +78,7 @@ export async function addLinterToCyProject(
joinPathFragments(projectConfig.root, '.eslintrc.json'),
(json) => {
if (options.rootProject) {
json.plugins = ['@nrwl/nx'];
json.plugins = ['@nx/nx'];
json.extends = ['plugin:cypress/recommended'];
} else {
json.extends = ['plugin:cypress/recommended', ...json.extends];

View File

@ -1,7 +1,7 @@
{
"name": "Nx Detox",
"version": "0.1",
"extends": ["@nrwl/workspace"],
"extends": ["@nx/workspace"],
"schematics": {
"init": {
"factory": "./src/generators/init/init#detoxInitSchematic",

View File

@ -1,7 +1,7 @@
{
"presets": [
[
"@nrwl/react/babel",
"@nx/react/babel",
{
"runtime": "automatic"
}

View File

@ -9,7 +9,7 @@
"verbose": true,
"setupFilesAfterEnv": ["<rootDir>/test-setup.ts"],
"transform": {
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "@nrwl/react/plugins/jest",
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "@nx/react/plugins/jest",
"^.+\\.[tj]sx?$": "babel-jest"
}
}

View File

@ -43,7 +43,7 @@ describe('Add Linting', () => {
const project = readProjectConfiguration(tree, 'my-app-e2e');
expect(project.targets.lint).toBeDefined();
expect(project.targets.lint.executor).toEqual('@nrwl/linter:eslint');
expect(project.targets.lint.executor).toEqual('@nx/linter:eslint');
});
it('should not add lint target when "none" is passed', async () => {

View File

@ -61,16 +61,16 @@ describe('Add Project', () => {
const project = readProjectConfiguration(tree, 'my-app-e2e');
expect(project.targets).toMatchObject({
'build-ios': {
executor: '@nrwl/detox:build',
executor: '@nx/detox:build',
},
'test-ios': {
executor: '@nrwl/detox:test',
executor: '@nx/detox:test',
},
'build-android': {
executor: '@nrwl/detox:build',
executor: '@nx/detox:build',
},
'test-android': {
executor: '@nrwl/detox:test',
executor: '@nx/detox:test',
},
});
});
@ -112,16 +112,16 @@ describe('Add Project', () => {
const project = readProjectConfiguration(tree, 'my-dir-my-app-e2e');
expect(project.targets).toMatchObject({
'build-ios': {
executor: '@nrwl/detox:build',
executor: '@nx/detox:build',
},
'test-ios': {
executor: '@nrwl/detox:test',
executor: '@nx/detox:test',
},
'build-android': {
executor: '@nrwl/detox:build',
executor: '@nx/detox:build',
},
'test-android': {
executor: '@nrwl/detox:test',
executor: '@nx/detox:test',
},
});
});

View File

@ -22,28 +22,28 @@ function getTargets(options: NormalizedSchema) {
const targets: { [key: string]: TargetConfiguration } = {};
targets['build-ios'] = {
executor: '@nrwl/detox:build',
executor: '@nx/detox:build',
...(options.framework === 'react-native'
? reactNativeBuildTarget('ios.sim')
: expoBuildTarget('ios.sim')),
};
targets['test-ios'] = {
executor: '@nrwl/detox:test',
executor: '@nx/detox:test',
...(options.framework === 'react-native'
? reactNativeTestTarget('ios.sim', options.e2eName)
: expoTestTarget('ios.sim', options.e2eName)),
};
targets['build-android'] = {
executor: '@nrwl/detox:build',
executor: '@nx/detox:build',
...(options.framework === 'react-native'
? reactNativeBuildTarget('android.emu')
: expoBuildTarget('android.emu')),
};
targets['test-android'] = {
executor: '@nrwl/detox:test',
executor: '@nx/detox:test',
...(options.framework === 'react-native'
? reactNativeTestTarget('android.emu', options.e2eName)
: expoTestTarget('android.emu', options.e2eName)),

View File

@ -12,7 +12,7 @@ describe('init', () => {
it('should add detox dependencies', async () => {
await detoxInitGenerator(tree, {});
const packageJson = readJson(tree, 'package.json');
expect(packageJson.devDependencies['@nrwl/detox']).toBeDefined();
expect(packageJson.devDependencies['@nx/detox']).toBeDefined();
expect(packageJson.devDependencies['@types/node']).toBeDefined();
expect(packageJson.devDependencies['detox']).toBeDefined();
});

View File

@ -36,7 +36,7 @@ export function updateDependencies(host: Tree) {
host,
{},
{
'@nrwl/detox': nxVersion,
'@nx/detox': nxVersion,
detox: detoxVersion,
'@testing-library/jest-dom': testingLibraryJestDom,
'@types/node': typesNodeVersion,
@ -46,7 +46,7 @@ export function updateDependencies(host: Tree) {
}
function moveDependency(host: Tree) {
return removeDependenciesFromPackageJson(host, ['@nrwl/detox'], []);
return removeDependenciesFromPackageJson(host, ['@nx/detox'], []);
}
export default detoxInitGenerator;

View File

@ -187,7 +187,7 @@ export async function* esbuildExecutor(
yield {
success: buildResult.errors.length === 0,
// Need to call getOutfile directly in the case of bundle=false and outfile is not set for esbuild.
// This field is needed for `@nrwl/js:node` executor to work.
// This field is needed for `@nx/js:node` executor to work.
outfile: join(context.root, getOutfile(format, options, context)),
};
}
@ -232,7 +232,7 @@ export async function* esbuildExecutor(
next({
success,
// Need to call getOutfile directly in the case of bundle=false and outfile is not set for esbuild.
// This field is needed for `@nrwl/js:node` executor to work.
// This field is needed for `@nx/js:node` executor to work.
outfile: join(
context.root,
getOutfile(format, options, context)
@ -332,7 +332,7 @@ function getTypeCheckOptions(
const { watch, tsConfig, outputPath } = options;
const typeCheckOptions: TypeCheckOptions = {
// TODO(jack): Add support for d.ts declaration files -- once the `@nrwl/js:tsc` changes are in we can use the same logic.
// TODO(jack): Add support for d.ts declaration files -- once the `@nx/js:tsc` changes are in we can use the same logic.
mode: 'noEmit',
tsConfigPath: tsConfig,
// outDir: outputPath,

View File

@ -28,7 +28,7 @@ describe('buildEsbuildOptions', () => {
root: path.join(__dirname, 'fixtures'),
cwd: path.join(__dirname, 'fixtures'),
target: {
executor: '@nrwl/esbuild:esbuild',
executor: '@nx/esbuild:esbuild',
options: {
outputPath: 'dist/apps/myapp',
},

View File

@ -71,7 +71,7 @@ export function normalizeOptions(
external: options.external ?? [],
singleEntry: false,
// Use the `main` file name as the output file name.
// This is needed for `@nrwl/js:node` to know the main file to execute.
// This is needed for `@nx/js:node` to know the main file to execute.
// NOTE: The .js default extension may be replaced later in getOutfile() call.
outputFileName: `${path.parse(options.main).name}.js`,
};

View File

@ -82,7 +82,7 @@ function addBuildTarget(tree: Tree, options: EsBuildProjectSchema) {
targets: {
...project.targets,
build: {
executor: '@nrwl/esbuild:esbuild',
executor: '@nx/esbuild:esbuild',
outputs: ['{options.outputPath}'],
defaultConfiguration: 'production',
options: buildOptions,

View File

@ -3,7 +3,7 @@
"rules": {
"no-restricted-imports": [
"error",
"@nrwl/workspace",
"@nx/workspace",
"@angular-devkit/core",
"@angular-devkit/architect",
"@angular-devkit/schematics"

View File

@ -8,8 +8,8 @@
*/
export default {
extends: [
'plugin:@nrwl/nx/react-base',
'plugin:@nrwl/nx/react-typescript',
'plugin:@nrwl/nx/react-jsx',
'plugin:@nx/nx/react-base',
'plugin:@nx/nx/react-typescript',
'plugin:@nx/nx/react-jsx',
],
};

View File

@ -11,6 +11,6 @@ export const WORKSPACE_PLUGIN_DIR = join(workspaceRoot, 'tools/eslint-rules');
* E.g. if a user writes a rule called "foo", then they will include it in their ESLint
* config files as:
*
* "@nrwl/nx/workspace/foo": "error"
* "@nx/nx/workspace/foo": "error"
*/
export const WORKSPACE_RULE_NAMESPACE = 'workspace';

View File

@ -31,7 +31,7 @@ export function ensureGlobalProjectGraph(ruleName: string) {
);
} catch {
const WARNING_PREFIX = `${chalk.reset.keyword('orange')('warning')}`;
const RULE_NAME_SUFFIX = `${chalk.reset.dim(`@nrwl/nx/${ruleName}`)}`;
const RULE_NAME_SUFFIX = `${chalk.reset.dim(`@nx/nx/${ruleName}`)}`;
process.stdout
.write(`${WARNING_PREFIX} No cached ProjectGraph is available. The rule will be skipped.
If you encounter this error as part of running standard \`nx\` commands then please open an issue on https://github.com/nrwl/nx

View File

@ -1,7 +1,7 @@
{
"name": "Nx Expo",
"version": "0.1",
"extends": ["@nrwl/workspace"],
"extends": ["@nx/workspace"],
"schematics": {
"init": {
"factory": "./src/generators/init/init#expoInitSchematic",

View File

@ -17,7 +17,7 @@ export async function withNxWebpack(config) {
options: {
presets: [
[
'@nrwl/react/babel',
'@nx/react/babel',
{
runtime: 'automatic',
},

View File

@ -1,4 +1,4 @@
const { withNxMetro } = require('@nrwl/expo');
const { withNxMetro } = require('@nx/expo');
const { getDefaultConfig } = require('@expo/metro-config');
const defaultConfig = getDefaultConfig(__dirname);

View File

@ -452,14 +452,14 @@ export const App = () => {
styles.marginBottomMd,
]}
>
nx g @nrwl/expo:lib ui
nx g @nx/expo:lib ui
</Text>
<Text style={[styles.textXS, styles.monospace, styles.comment]}>
# Add a component
</Text>
<Text style={[styles.textXS, styles.monospace]}>nx g \</Text>
<Text style={[styles.textXS, styles.monospace]}>
@nrwl/expo:component \
@nx/expo:component \
</Text>
<Text style={[styles.textXS, styles.monospace]}>
button --project ui

View File

@ -12,7 +12,7 @@
"declaration": true
},
"files": [
"../../node_modules/@nrwl/expo/typings/svg.d.ts"
"../../node_modules/@nx/expo/typings/svg.d.ts"
],
"include": [],
"references": [

View File

@ -28,7 +28,7 @@ function getTargets(options: NormalizedSchema) {
const architect: { [key: string]: TargetConfiguration } = {};
architect.start = {
executor: '@nrwl/expo:start',
executor: '@nx/expo:start',
options: {
port: 8081,
},
@ -42,63 +42,63 @@ function getTargets(options: NormalizedSchema) {
};
architect['run-ios'] = {
executor: '@nrwl/expo:run',
executor: '@nx/expo:run',
options: {
platform: 'ios',
},
};
architect['run-android'] = {
executor: '@nrwl/expo:run',
executor: '@nx/expo:run',
options: {
platform: 'android',
},
};
architect['build'] = {
executor: '@nrwl/expo:build',
executor: '@nx/expo:build',
options: {},
};
architect['build-list'] = {
executor: '@nrwl/expo:build-list',
executor: '@nx/expo:build-list',
options: {},
};
architect['download'] = {
executor: '@nrwl/expo:download',
executor: '@nx/expo:download',
options: {
output: `${options.appProjectRoot}/dist`,
},
};
architect['sync-deps'] = {
executor: '@nrwl/expo:sync-deps',
executor: '@nx/expo:sync-deps',
options: {},
};
architect['ensure-symlink'] = {
executor: '@nrwl/expo:ensure-symlink',
executor: '@nx/expo:ensure-symlink',
options: {},
};
architect['prebuild'] = {
executor: '@nrwl/expo:prebuild',
executor: '@nx/expo:prebuild',
options: {},
};
architect['install'] = {
executor: '@nrwl/expo:install',
executor: '@nx/expo:install',
options: {},
};
architect['update'] = {
executor: '@nrwl/expo:update',
executor: '@nx/expo:update',
options: {},
};
architect['export'] = {
executor: '@nrwl/expo:export',
executor: '@nx/expo:export',
options: {
platform: 'all',
outputDir: `${offsetFromRoot(options.appProjectRoot)}dist/${
@ -108,7 +108,7 @@ function getTargets(options: NormalizedSchema) {
};
architect['export-web'] = {
executor: '@nrwl/expo:export',
executor: '@nx/expo:export',
options: {
bundler: 'metro',
},

View File

@ -1,5 +1,5 @@
/**
* Same as the @nrwl/react library schema, except it removes keys: style, routing, globalCss
* Same as the @nx/react library schema, except it removes keys: style, routing, globalCss
*/
export interface Schema {
name: string;

View File

@ -92,7 +92,7 @@ export function updateDependencies(host: Tree) {
'react-native-svg': reactNativeSvgVersion,
},
{
'@nrwl/expo': nxVersion,
'@nx/expo': nxVersion,
'@types/react': typesReactVersion,
'@types/react-native': typesReactNativeVersion,
metro: metroVersion,
@ -108,7 +108,7 @@ export function updateDependencies(host: Tree) {
}
function moveDependency(host: Tree) {
return removeDependenciesFromPackageJson(host, ['@nrwl/react-native'], []);
return removeDependenciesFromPackageJson(host, ['@nx/react-native'], []);
}
export default expoInitGenerator;

View File

@ -1,7 +1,7 @@
{
"presets": [
[
"@nrwl/react/babel",
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"

View File

@ -39,7 +39,7 @@ describe('lib', () => {
expect(projectConfiguration.root).toEqual('libs/my-lib');
expect(projectConfiguration.targets.build).toBeUndefined();
expect(projectConfiguration.targets.lint).toEqual({
executor: '@nrwl/linter:eslint',
executor: '@nx/linter:eslint',
outputs: ['{options.outputFile}'],
options: {
lintFilePatterns: ['libs/my-lib/**/*.{ts,tsx,js,jsx}'],
@ -144,7 +144,7 @@ describe('lib', () => {
'my-dir-my-lib'
);
expect(projectConfiguration.targets.lint).toEqual({
executor: '@nrwl/linter:eslint',
executor: '@nx/linter:eslint',
outputs: ['{options.outputFile}'],
options: {
lintFilePatterns: ['libs/my-dir/my-lib/**/*.{ts,tsx,js,jsx}'],
@ -199,7 +199,7 @@ describe('lib', () => {
const projectConfiguration = readProjectConfiguration(appTree, 'my-lib');
expect(projectConfiguration.targets.test).toBeUndefined();
expect(projectConfiguration.targets.lint).toMatchObject({
executor: '@nrwl/linter:eslint',
executor: '@nx/linter:eslint',
options: {
lintFilePatterns: ['libs/my-lib/**/*.{ts,tsx,js,jsx}'],
},
@ -232,7 +232,7 @@ describe('lib', () => {
const projects = getProjects(appTree);
expect(projects.get('my-lib').targets.build).toMatchObject({
executor: '@nrwl/web:rollup',
executor: '@nx/web:rollup',
outputs: ['{options.outputPath}'],
options: {
external: ['react/jsx-runtime', 'react-native'],
@ -240,7 +240,7 @@ describe('lib', () => {
outputPath: 'dist/libs/my-lib',
project: 'libs/my-lib/package.json',
tsConfig: 'libs/my-lib/tsconfig.lib.json',
rollupConfig: '@nrwl/react/plugins/bundle-rollup',
rollupConfig: '@nx/react/plugins/bundle-rollup',
},
});
});

View File

@ -90,7 +90,7 @@ function addProject(host: Tree, options: NormalizedSchema) {
const external = ['react/jsx-runtime', 'react-native'];
targets.build = {
executor: '@nrwl/web:rollup',
executor: '@nx/web:rollup',
outputs: ['{options.outputPath}'],
options: {
outputPath: `dist/${libsDir}/${options.projectDirectory}`,
@ -98,7 +98,7 @@ function addProject(host: Tree, options: NormalizedSchema) {
project: `${options.projectRoot}/package.json`,
entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`),
external,
rollupConfig: `@nrwl/react/plugins/bundle-rollup`,
rollupConfig: `@nx/react/plugins/bundle-rollup`,
assets: [
{
glob: `${options.projectRoot}/README.md`,

View File

@ -1,7 +1,7 @@
import { Linter } from '@nx/linter';
/**
* Same as the @nrwl/react library schema, except it removes keys: style, component, routing, appProject
* Same as the @nx/react library schema, except it removes keys: style, component, routing, appProject
*/
export interface Schema {
name: string;

View File

@ -25,7 +25,7 @@ export async function addJest(
const configPath = `${appProjectRoot}/jest.config.${js ? 'js' : 'ts'}`;
const content = `module.exports = {
displayName: '${projectName}',
resolver: '@nrwl/jest/plugins/resolver',
resolver: '@nx/jest/plugins/resolver',
preset: 'react-native',
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)',
@ -33,7 +33,7 @@ export async function addJest(
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
setupFilesAfterEnv: ['<rootDir>/test-setup.${js ? 'js' : 'ts'}'],
moduleNameMapper: {
'\\\\.svg$': '@nrwl/expo/plugins/jest/svg-mock'
'\\\\.svg$': '@nx/expo/plugins/jest/svg-mock'
}
};`;
host.write(configPath, content);

View File

@ -26,7 +26,7 @@ describe('Add Linting', () => {
const project = readProjectConfiguration(tree, 'my-lib');
expect(project.targets.lint).toBeDefined();
expect(project.targets.lint.executor).toEqual('@nrwl/linter:eslint');
expect(project.targets.lint.executor).toEqual('@nx/linter:eslint');
});
it('should not add lint target when "none" is passed', async () => {

View File

@ -25,7 +25,7 @@ describe('ensureNodeModulesSymlink', () => {
JSON.stringify({
name: 'workspace',
dependencies: {
'@nrwl/react-native': '9999.9.9',
'@nx/react-native': '9999.9.9',
'@react-native-community/cli-platform-ios': '7777.7.7',
'@react-native-community/cli-platform-android': '7777.7.7',
'react-native': '0.9999.0',
@ -39,7 +39,7 @@ describe('ensureNodeModulesSymlink', () => {
});
it('should create symlinks', () => {
createNpmDirectory('@nrwl/react-native', '9999.9.9');
createNpmDirectory('@nx/react-native', '9999.9.9');
createNpmDirectory(
'@react-native-community/cli-platform-android',
'7777.7.7'
@ -52,7 +52,7 @@ describe('ensureNodeModulesSymlink', () => {
ensureNodeModulesSymlink(workspaceDir, appDir);
expectSymlinkToExist('@nrwl/react-native');
expectSymlinkToExist('@nx/react-native');
expectSymlinkToExist('react-native');
expectSymlinkToExist('jsc-android');
expectSymlinkToExist('hermes-engine');
@ -71,7 +71,7 @@ describe('ensureNodeModulesSymlink', () => {
},
})
);
createNpmDirectory('@nrwl/react-native', '9999.9.9');
createNpmDirectory('@nx/react-native', '9999.9.9');
createNpmDirectory(
'@react-native-community/cli-platform-android',
'7777.7.7'

View File

@ -50,12 +50,12 @@ test('findAllNpmDependencies', () => {
packageName: 'react-native-snackbar',
},
},
'npm:@nrwl/react-native': {
'npm:@nx/react-native': {
type: 'npm',
name: 'npm:@nrwl/react-native',
name: 'npm:@nx/react-native',
data: {
version: '1',
packageName: '@nrwl/react-native',
packageName: '@nx/react-native',
},
},
},
@ -71,7 +71,7 @@ test('findAllNpmDependencies', () => {
{
type: DependencyType.static,
source: 'myapp',
target: 'npm:@nrwl/react-native',
target: 'npm:@nx/react-native',
},
],
lib1: [

View File

@ -14,10 +14,13 @@ export function findAllNpmDependencies(
const node = graph.externalNodes[projectName];
// Don't want to include '@nrwl/react-native' because React Native
// Don't want to include '@nx/react-native' because React Native
// autolink will warn that the package has no podspec file for iOS.
if (node) {
if (node.name !== `npm:@nrwl/react-native`) {
if (
node.name !== `npm:@nx/react-native` &&
node.name !== `npm:@nrwl/react-native`
) {
list.push(node.data.packageName);
}
} else {

View File

@ -10,7 +10,7 @@
"files": ["**/*.ts"],
"excludedFiles": ["./src/migrations/**"],
"rules": {
"no-restricted-imports": ["error", "@nrwl/workspace"]
"no-restricted-imports": ["error", "@nx/workspace"]
}
},
{

View File

@ -2,7 +2,7 @@ import type { Config } from 'jest';
export const nxPreset: Config = {
// This is one of the patterns that jest finds by default https://jestjs.io/docs/configuration#testmatch-arraystring
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
resolver: '@nrwl/jest/plugins/resolver',
resolver: '@nx/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'mjs', 'html'],
coverageReporters: ['html'],
transform: {

View File

@ -44,7 +44,7 @@ describe('Jest Executor', () => {
root: 'proj',
targets: {
test: {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
},
},
},
@ -54,7 +54,7 @@ describe('Jest Executor', () => {
npmScope: 'test',
},
target: {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
},
cwd: '/root',
isVerbose: true,

View File

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`jest should generate files 1`] = `
"import { getJestProjects } from '@nrwl/jest';
"import { getJestProjects } from '@nx/jest';
export default {
projects: getJestProjects()
@ -9,13 +9,13 @@ projects: getJestProjects()
`;
exports[`jest should generate files 2`] = `
"const nxPreset = require('@nrwl/jest/preset').default;
"const nxPreset = require('@nx/jest/preset').default;
module.exports = { ...nxPreset }"
`;
exports[`jest should generate files with --js flag 1`] = `
"const { getJestProjects } = require('@nrwl/jest');
"const { getJestProjects } = require('@nx/jest');
module.exports = {
projects: getJestProjects()
@ -23,7 +23,7 @@ projects: getJestProjects()
`;
exports[`jest should generate files with --js flag 2`] = `
"const nxPreset = require('@nrwl/jest/preset').default;
"const nxPreset = require('@nx/jest/preset').default;
module.exports = { ...nxPreset }"
`;

View File

@ -49,7 +49,7 @@ describe('jest', () => {
sourceRoot: 'apps/my-app/src',
targets: {
test: {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'apps/my-app/jest.config.ts',
},
@ -57,7 +57,7 @@ describe('jest', () => {
},
});
const expected = stripIndents`
import { getJestProjects } from '@nrwl/jest';
import { getJestProjects } from '@nx/jest';
export default {
projects: getJestProjects(),
extraThing: "Goes Here"
@ -127,7 +127,7 @@ export default {
await jestInitGenerator(tree, {});
const packageJson = readJson(tree, 'package.json');
expect(packageJson.devDependencies.jest).toBeDefined();
expect(packageJson.devDependencies['@nrwl/jest']).toBeDefined();
expect(packageJson.devDependencies['@nx/jest']).toBeDefined();
expect(packageJson.devDependencies['@types/jest']).toBeDefined();
expect(packageJson.devDependencies['ts-jest']).toBeDefined();
expect(packageJson.devDependencies['ts-node']).toBeDefined();
@ -141,7 +141,7 @@ export default {
await jestInitGenerator(tree, { testEnvironment: 'node' });
const packageJson = readJson(tree, 'package.json');
expect(packageJson.devDependencies.jest).toBeDefined();
expect(packageJson.devDependencies['@nrwl/jest']).toBeDefined();
expect(packageJson.devDependencies['@nx/jest']).toBeDefined();
expect(packageJson.devDependencies['@types/jest']).toBeDefined();
expect(packageJson.devDependencies['ts-jest']).toBeDefined();
expect(packageJson.devDependencies['ts-node']).toBeDefined();
@ -155,7 +155,7 @@ export default {
await jestInitGenerator(tree, { testEnvironment: 'none' });
const packageJson = readJson(tree, 'package.json');
expect(packageJson.devDependencies.jest).toBeDefined();
expect(packageJson.devDependencies['@nrwl/jest']).toBeDefined();
expect(packageJson.devDependencies['@nx/jest']).toBeDefined();
expect(packageJson.devDependencies['@types/jest']).toBeDefined();
expect(packageJson.devDependencies['ts-jest']).toBeDefined();
expect(packageJson.devDependencies['ts-node']).toBeDefined();
@ -213,7 +213,7 @@ export default {
sourceRoot: 'src',
targets: {
test: {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'jest.config.ts',
},
@ -239,7 +239,7 @@ export default {
await jestInitGenerator(tree, { rootProject: false });
expect(tree.exists('jest.config.app.ts')).toBeTruthy();
expect(tree.read('jest.config.ts', 'utf-8'))
.toEqual(`import { getJestProjects } from '@nrwl/jest';
.toEqual(`import { getJestProjects } from '@nx/jest';
export default {
projects: getJestProjects()
@ -247,7 +247,7 @@ projects: getJestProjects()
expect(readProjectConfiguration(tree, 'my-project').targets.test)
.toMatchInlineSnapshot(`
{
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "jest.config.app.ts",
},
@ -262,7 +262,7 @@ projects: getJestProjects()
sourceRoot: 'src',
targets: {
test: {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'jest.config.js',
},
@ -288,7 +288,7 @@ module.exports = {
await jestInitGenerator(tree, { js: true, rootProject: false });
expect(tree.exists('jest.config.app.js')).toBeTruthy();
expect(tree.read('jest.config.js', 'utf-8'))
.toEqual(`const { getJestProjects } = require('@nrwl/jest');
.toEqual(`const { getJestProjects } = require('@nx/jest');
module.exports = {
projects: getJestProjects()

View File

@ -40,13 +40,13 @@ const schemaDefaults = {
function generateGlobalConfig(tree: Tree, isJS: boolean) {
const contents = isJS
? stripIndents`
const { getJestProjects } = require('@nrwl/jest');
const { getJestProjects } = require('@nx/jest');
module.exports = {
projects: getJestProjects()
};`
: stripIndents`
import { getJestProjects } from '@nrwl/jest';
import { getJestProjects } from '@nx/jest';
export default {
projects: getJestProjects()
@ -60,7 +60,7 @@ function createJestConfig(tree: Tree, options: NormalizedSchema) {
tree.write(
`jest.preset.js`,
`
const nxPreset = require('@nrwl/jest/preset').default;
const nxPreset = require('@nx/jest/preset').default;
module.exports = { ...nxPreset }`
);
@ -94,7 +94,8 @@ function createJestConfig(tree: Tree, options: NormalizedSchema) {
if (rootProject) {
const rootProjectConfig = projects.get(rootProject);
const jestTarget = Object.values(rootProjectConfig.targets || {}).find(
(t) => t?.executor === '@nrwl/jest:jest'
(t) =>
t?.executor === '@nx/jest:jest' || t?.executor === '@nrwl/jest:jest'
);
const isProjectConfig = jestTarget?.options?.jestConfig === rootJestPath;
// if root project doesn't have jest target, there's nothing to migrate
@ -146,7 +147,7 @@ function updateDependencies(tree: Tree, options: NormalizedSchema) {
tslib: tslibVersion,
};
const devDeps = {
'@nrwl/jest': nxVersion,
'@nx/jest': nxVersion,
jest: jestVersion,
// because the default jest-preset uses ts-jest,
@ -167,8 +168,8 @@ function updateDependencies(tree: Tree, options: NormalizedSchema) {
if (options.compiler === 'babel' || options.babelJest) {
devDeps['babel-jest'] = babelJestVersion;
// in some cases @nrwl/js will not already be present i.e. node only projects
devDeps['@nrwl/js'] = nxVersion;
// in some cases @nx/js will not already be present i.e. node only projects
devDeps['@nx/js'] = nxVersion;
} else if (options.compiler === 'swc') {
devDeps['@swc/jest'] = swcJestVersion;
}
@ -208,7 +209,7 @@ export async function jestInitGenerator(
createJestConfig(tree, options);
if (!options.skipPackageJson) {
removeDependenciesFromPackageJson(tree, ['@nrwl/jest'], []);
removeDependenciesFromPackageJson(tree, ['@nx/jest'], []);
const installTask = updateDependencies(tree, options);
tasks.push(installTask);
}

View File

@ -115,7 +115,7 @@ exports[`jestProject should use jest.config.js in project config with --js flag
"codeCoverage": true,
},
},
"executor": "@nrwl/jest:jest",
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "libs/lib1/jest.config.js",
"passWithNoTests": true,

View File

@ -73,7 +73,7 @@ describe('jestProject', () => {
} as JestProjectSchema);
const lib1 = readProjectConfiguration(tree, 'lib1');
expect(lib1.targets.test).toEqual({
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
options: {
jestConfig: 'libs/lib1/jest.config.ts',

View File

@ -13,7 +13,7 @@ export function updateWorkspace(
) {
const projectConfig = readProjectConfiguration(tree, options.project);
projectConfig.targets.test = {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
outputs: [
options.rootProject
? joinPathFragments('{workspaceRoot}', 'coverage', '{projectName}')

View File

@ -57,6 +57,17 @@ describe('Jest Migration (v14.1.2)', () => {
it('should update individual project jest configs', async () => {
await workspaceLib(tree, { name: 'lib-one' });
const projectConfiguration = readProjectConfiguration(tree, 'lib-one');
updateProjectConfiguration(tree, 'lib-one', {
...projectConfiguration,
targets: {
...projectConfiguration.targets,
test: {
...projectConfiguration.targets.test,
executor: '@nrwl/jest:jest',
},
},
});
tree.rename('jest.preset.js', 'jest.preset.ts');
tree.write(
'libs/lib-one/jest.config.ts',

View File

@ -1,4 +1,9 @@
import { readJson, updateJson } from '@nx/devkit';
import {
readJson,
readProjectConfiguration,
updateJson,
updateProjectConfiguration,
} from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import { libraryGenerator as workspaceLib } from '@nx/js';
import {
@ -155,6 +160,18 @@ module.exports = {
it('should update deps from jest.config.ts', async () => {
let tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
await workspaceLib(tree, { name: 'my-lib', unitTestRunner: 'jest' });
const projectConfiguration = readProjectConfiguration(tree, 'my-lib');
updateProjectConfiguration(tree, 'my-lib', {
...projectConfiguration,
targets: {
...projectConfiguration.targets,
test: {
...projectConfiguration.targets.test,
executor: '@nrwl/jest:jest',
},
},
});
updateJson(tree, 'package.json', (json) => {
json.devDependencies['jest'] = '27.1.1';
json.devDependencies['jest-environment-jsdom'] = '27.1.1';

View File

@ -19,6 +19,17 @@ describe('Jest Migration - jest 28 test files', () => {
linter: undefined,
unitTestRunner: 'jest',
});
const projectConfiguration = readProjectConfiguration(tree, 'blah');
updateProjectConfiguration(tree, 'blah', {
...projectConfiguration,
targets: {
...projectConfiguration.targets,
test: {
...projectConfiguration.targets.test,
executor: '@nrwl/jest:jest',
},
},
});
await workspaceLib(tree, {
name: 'blah-again',
@ -26,6 +37,17 @@ describe('Jest Migration - jest 28 test files', () => {
unitTestRunner: 'jest',
js: true,
});
const projectConfiguration2 = readProjectConfiguration(tree, 'blah-again');
updateProjectConfiguration(tree, 'blah-again', {
...projectConfiguration2,
targets: {
...projectConfiguration2.targets,
test: {
...projectConfiguration2.targets.test,
executor: '@nrwl/jest:jest',
},
},
});
tree.write(
'libs/blah/src/lib/something/something.spec.ts',

View File

@ -391,6 +391,7 @@ async function setup(tree: Tree, name: string, existingGraph?: ProjectGraph) {
const projectConfig = readProjectConfiguration(tree, name);
projectConfig.targets['test'] = {
...projectConfig.targets['test'],
executor: '@nrwl/jest:jest',
configurations: {
ci: {
ci: true,
@ -447,6 +448,22 @@ preset: '../../jest.preset.js'
`
);
tree.write(
'jest.config.ts',
tree
.read('jest.config.ts')
.toString()
.replace(new RegExp('@nx/jest', 'g'), '@nrwl/jest')
);
tree.write(
'jest.preset.js',
tree
.read('jest.preset.js')
.toString()
.replace(new RegExp('@nx/jest', 'g'), '@nrwl/jest')
);
projectGraph = {
dependencies: {
...existingGraph?.dependencies,

View File

@ -73,6 +73,7 @@ async function setup(tree: Tree, name: string) {
const projectConfig = readProjectConfiguration(tree, name);
projectConfig.targets['test'] = {
...projectConfig.targets['test'],
executor: '@nrwl/jest:jest',
configurations: {
ci: {
ci: true,

View File

@ -2,7 +2,7 @@
exports[`Jest AST Utils addTransformerToConfig should add transformer to export default config 1`] = `
"export default {
transform: { '^.+\\\\.[tj]sx?$': ['ts-jest', {tsconfig: '<rootDir>/tsconfig.spec.json'}], '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest' },
transform: { '^.+\\\\.[tj]sx?$': ['ts-jest', {tsconfig: '<rootDir>/tsconfig.spec.json'}], '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest' },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
displayName: 'blah',
preset: '../../jest.preset.js'
@ -20,7 +20,7 @@ transform: { '^.+\\\\.[tj]sx?$': ['ts-jest', {tsconfig: '<rootDir>/tsconfig.spec
exports[`Jest AST Utils addTransformerToConfig should add transformer to module.exports config 1`] = `
"module.exports = {
transform: { '^.+\\\\.[tj]sx?$': ['ts-jest', {tsconfig: '<rootDir>/tsconfig.spec.json'}], '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest' },
transform: { '^.+\\\\.[tj]sx?$': ['ts-jest', {tsconfig: '<rootDir>/tsconfig.spec.json'}], '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest' },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
displayName: 'blah',
preset: '../../jest.preset.js'

View File

@ -5,7 +5,7 @@ describe('Jest AST Utils', () => {
const actual = addTransformerToConfig(
`module.exports = {
transform: {
'^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest'
'^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest'
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
displayName: 'blah',
@ -21,7 +21,7 @@ describe('Jest AST Utils', () => {
const actual = addTransformerToConfig(
`export default {
transform: {
'^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest'
'^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest'
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
displayName: 'blah',

View File

@ -98,7 +98,7 @@ describe('jestConfigObject', () => {
it('should handle spread assignments', () => {
const content = `
import { nxPreset } from '@nrwl/jest/preset';
import { nxPreset } from '@nx/jest/preset';
export default {
...nxPreset,

View File

@ -10,7 +10,7 @@ describe('getJestProjects', () => {
root: 'blah',
targets: {
test: {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'test/jest/config/location/jest.config.js',
},
@ -36,7 +36,7 @@ describe('getJestProjects', () => {
root: 'blah',
targets: {
'test-with-jest': {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'test/jest/config/location/jest.config.js',
},
@ -62,7 +62,7 @@ describe('getJestProjects', () => {
root: '.',
targets: {
test: {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'jest.config.app.js',
},
@ -86,7 +86,7 @@ describe('getJestProjects', () => {
root: 'blah',
targets: {
'test-with-jest': {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'test/jest/config/location/jest.config.js',
},
@ -118,7 +118,7 @@ describe('getJestProjects', () => {
root: 'blah',
targets: {
'test-with-jest': {
executor: '@nrwl/jest:jest',
executor: '@nx/jest:jest',
options: {
jestConfig: 'test/jest/config/location/jest.config.js',
},

View File

@ -2,8 +2,6 @@ import { join } from 'path';
import type { ProjectsConfigurations } from '@nx/devkit';
import { readWorkspaceConfig } from 'nx/src/project-graph/file-utils';
const JEST_RUNNER_TOKEN = '@nrwl/jest:jest';
function getJestConfigProjectPath(projectJestConfigPath: string): string {
return join('<rootDir>', projectJestConfigPath);
}
@ -30,7 +28,10 @@ export function getJestProjects() {
continue;
}
for (const targetConfiguration of Object.values(projectConfig.targets)) {
if (targetConfiguration.executor !== JEST_RUNNER_TOKEN) {
if (
targetConfiguration.executor !== '@nx/jest:jest' &&
targetConfiguration.executor !== '@nrwl/jest:jest'
) {
continue;
}
if (targetConfiguration.options?.jestConfig) {

View File

@ -422,10 +422,8 @@ describe('lib', () => {
const packageJson = readJson(tree, 'package.json');
expect(packageJson.devDependencies['eslint']).toBeDefined();
expect(packageJson.devDependencies['@nrwl/linter']).toBeDefined();
expect(
packageJson.devDependencies['@nrwl/eslint-plugin-nx']
).toBeDefined();
expect(packageJson.devDependencies['@nx/linter']).toBeDefined();
expect(packageJson.devDependencies['@nx/eslint-plugin-nx']).toBeDefined();
});
describe('not nested', () => {
@ -435,7 +433,7 @@ describe('lib', () => {
name: 'myLib',
});
expect(readProjectConfiguration(tree, 'my-lib').targets.lint).toEqual({
executor: '@nrwl/linter:eslint',
executor: '@nx/linter:eslint',
outputs: ['{options.outputFile}'],
options: {
lintFilePatterns: ['libs/my-lib/**/*.ts'],
@ -499,7 +497,7 @@ describe('lib', () => {
expect(
readProjectConfiguration(tree, 'my-dir-my-lib').targets.lint
).toEqual({
executor: '@nrwl/linter:eslint',
executor: '@nx/linter:eslint',
outputs: ['{options.outputFile}'],
options: {
lintFilePatterns: ['libs/my-dir/my-lib/**/*.ts'],
@ -1073,10 +1071,10 @@ describe('lib', () => {
const project = readProjectConfiguration(tree, 'my-lib');
expect(project.targets.build).toMatchObject({
executor: '@nrwl/vite:build',
executor: '@nx/vite:build',
});
expect(project.targets.test).toMatchObject({
executor: '@nrwl/vite:test',
executor: '@nx/vite:test',
});
expect(tree.exists('libs/my-lib/vite.config.ts')).toBeTruthy();
});
@ -1084,7 +1082,7 @@ describe('lib', () => {
it.each`
unitTestRunner | executor
${'none'} | ${undefined}
${'jest'} | ${'@nrwl/jest:jest'}
${'jest'} | ${'@nx/jest:jest'}
`(
'should respect unitTestRunner if passed',
async ({ unitTestRunner, executor }) => {

View File

@ -545,7 +545,7 @@ function addProjectDependencies(
return addDependenciesToPackageJson(
tree,
{},
{ '@nrwl/rollup': nxVersion, '@types/node': typesNodeVersion }
{ '@nx/rollup': nxVersion, '@types/node': typesNodeVersion }
);
}

View File

@ -65,6 +65,10 @@ async function setup(tree: Tree) {
config: 'project',
});
const projectConfig = readProjectConfiguration(tree, 'my-lib');
projectConfig.targets.test.executor = '@nrwl/jest:jest';
updateProjectConfiguration(tree, 'my-lib', projectConfig);
tree.rename('libs/my-lib/.swcrc', 'libs/my-lib/.lib.swcrc');
tree.write(
'libs/my-lib/jest.config.ts',

View File

@ -10,7 +10,7 @@
"files": ["**/*.ts"],
"excludedFiles": ["./src/migrations/**"],
"rules": {
"no-restricted-imports": ["error", "@nrwl/workspace"]
"no-restricted-imports": ["error", "@nx/workspace"]
}
},
{

View File

@ -3,7 +3,7 @@ export { lintInitGenerator } from './src/generators/init/init';
export { Linter } from './src/generators/utils/linter';
export * from './src/utils/convert-tslint-to-eslint';
// @nrwl/angular needs it for the Angular CLI workspace migration to Nx to
// @nx/angular needs it for the Angular CLI workspace migration to Nx to
// infer whether a config is using type aware rules and set the
// `hasTypeAwareRules` option of the `@nrwl/linter:eslint` executor.
// `hasTypeAwareRules` option of the `@nx/linter:eslint` executor.
export { hasRulesRequiringTypeChecking } from './src/utils/rules-requiring-type-checking';

View File

@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`@nrwl/linter:init --linter eslint should generate the global eslint config 1`] = `
exports[`@nx/linter:init --linter eslint should generate the global eslint config 1`] = `
"{
"root": true,
"ignorePatterns": [
"**/*"
],
"plugins": [
"@nrwl/nx"
"@nx/nx"
],
"overrides": [
{
@ -18,7 +18,7 @@ exports[`@nrwl/linter:init --linter eslint should generate the global eslint con
"*.jsx"
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
@ -41,7 +41,7 @@ exports[`@nrwl/linter:init --linter eslint should generate the global eslint con
"*.tsx"
],
"extends": [
"plugin:@nrwl/nx/typescript"
"plugin:@nx/nx/typescript"
],
"rules": {}
},
@ -51,7 +51,7 @@ exports[`@nrwl/linter:init --linter eslint should generate the global eslint con
"*.jsx"
],
"extends": [
"plugin:@nrwl/nx/javascript"
"plugin:@nx/nx/javascript"
],
"rules": {}
}

View File

@ -6,7 +6,7 @@ import { ESLint, Linter as LinterType } from 'eslint';
*/
export const globalTypeScriptOverrides = {
files: ['*.ts', '*.tsx'],
extends: ['plugin:@nrwl/nx/typescript'],
extends: ['plugin:@nx/nx/typescript'],
/**
* Having an empty rules object present makes it more obvious to the user where they would
* extend things from if they needed to
@ -20,7 +20,7 @@ export const globalTypeScriptOverrides = {
*/
export const globalJavaScriptOverrides = {
files: ['*.js', '*.jsx'],
extends: ['plugin:@nrwl/nx/javascript'],
extends: ['plugin:@nx/nx/javascript'],
/**
* Having an empty rules object present makes it more obvious to the user where they would
* extend things from if they needed to
@ -35,7 +35,7 @@ export const globalJavaScriptOverrides = {
export const moduleBoundariesOverride = {
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {
'@nrwl/nx/enforce-module-boundaries': [
'@nx/nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
@ -53,7 +53,7 @@ export const getGlobalEsLintConfiguration = (
const config: ESLint.ConfigData = {
root: true,
ignorePatterns: rootProject ? ['!**/*'] : ['**/*'],
plugins: ['@nrwl/nx'],
plugins: ['@nx/nx'],
/**
* We leverage ESLint's "overrides" capability so that we can set up a root config which will support
* all permutations of Nx workspaces across all frameworks, libraries and tools.

Some files were not shown because too many files have changed in this diff Show More