feat(web): replace usages of @nrwl with @nx (#16376)

This commit is contained in:
Jason Jean 2023-04-19 10:59:41 -04:00 committed by GitHub
parent 1780aac6a0
commit 76dfc62412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
119 changed files with 305 additions and 305 deletions

View File

@ -1,7 +1,7 @@
{
"presets": [
[
"@nrwl/js/babel",
"@nx/js/babel",
{
"useBuiltIns": "usage"
}

View File

@ -20,7 +20,7 @@ module.exports = function (api: any, options: NxWebBabelPresetOptions = {}) {
const isModern = api.caller((caller) => caller?.isModern);
// This is set by `@nrwl/web:rollup` executor
// This is set by `@nx/web:rollup` executor
const isNxPackage = api.caller((caller) => caller?.isNxPackage);
const emitDecoratorMetadata = api.caller(

View File

@ -36,13 +36,13 @@ describe('convert to swc', () => {
expect(
readProjectConfiguration(tree, 'tsc-lib').targets['build']['executor']
).toEqual('@nrwl/js:tsc');
).toEqual('@nx/js:tsc');
await convertToSwcGenerator(tree, { project: 'tsc-lib' });
expect(
readProjectConfiguration(tree, 'tsc-lib').targets['build']['executor']
).toEqual('@nrwl/js:swc');
).toEqual('@nx/js:swc');
expect(
tree.exists(
join(readProjectConfiguration(tree, 'tsc-lib').root, '.swcrc')

View File

@ -50,9 +50,13 @@ function updateProjectBuildTargets(
) {
for (const target of projectTargets) {
const targetConfiguration = projectConfiguration.targets[target];
if (!targetConfiguration || targetConfiguration.executor !== '@nrwl/js:tsc')
if (
!targetConfiguration ||
(targetConfiguration.executor !== '@nx/js:tsc' &&
targetConfiguration.executor !== '@nrwl/js:tsc')
)
continue;
targetConfiguration.executor = '@nrwl/js:swc';
targetConfiguration.executor = '@nx/js:swc';
}
updateProjectConfiguration(tree, projectName, projectConfiguration);

View File

@ -33,7 +33,7 @@ export async function initGenerator(
});
}
const devDependencies = {
'@nrwl/js': nxVersion,
'@nx/js': nxVersion,
prettier: prettierVersion,
};

View File

@ -756,7 +756,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({
executor: '@nrwl/js:tsc',
executor: '@nx/js:tsc',
options: {
assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts',
@ -776,7 +776,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({
executor: '@nrwl/js:swc',
executor: '@nx/js:swc',
options: {
assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts',
@ -830,7 +830,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({
executor: '@nrwl/js:tsc',
executor: '@nx/js:tsc',
options: {
assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts',
@ -851,7 +851,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({
executor: '@nrwl/js:swc',
executor: '@nx/js:swc',
options: {
assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts',
@ -935,7 +935,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({
executor: '@nrwl/js:tsc',
executor: '@nx/js:tsc',
options: {
assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts',
@ -1011,7 +1011,7 @@ describe('lib', () => {
expect(tree.exists('libs/my-lib/.babelrc')).toBeFalsy();
});
it('should generate a .babelrc when flag is set to true (even if there is no `@nrwl/web` plugin installed)', async () => {
it('should generate a .babelrc when flag is set to true (even if there is no `@nx/web` plugin installed)', async () => {
updateJson(tree, 'package.json', (json) => {
json.devDependencies = {};
return json;
@ -1030,7 +1030,7 @@ describe('lib', () => {
{
"presets": [
[
"@nrwl/js/babel",
"@nx/js/babel",
{
"useBuiltIns": "usage",
},
@ -1040,11 +1040,11 @@ describe('lib', () => {
`);
});
it('should not generate a .babelrc when flag is not set and there is NOT a `@nrwl/web` package installed', async () => {
it('should not generate a .babelrc when flag is not set and there is NOT a `@nx/web` package installed', async () => {
updateJson(tree, 'package.json', (json) => {
json.devDependencies = {
'@nrwl/angular': '1.1.1',
'@nrwl/next': '1.1.1',
'@nx/angular': '1.1.1',
'@nx/next': '1.1.1',
};
return json;
});

View File

@ -267,7 +267,7 @@ function addBabelRc(tree: Tree, options: NormalizedSchema) {
const filename = '.babelrc';
const babelrc = {
presets: [['@nrwl/js/babel', { useBuiltIns: 'usage' }]],
presets: [['@nx/js/babel', { useBuiltIns: 'usage' }]],
};
writeJson(tree, join(options.projectRoot, filename), babelrc);
@ -426,7 +426,7 @@ function normalizeOptions(
*
* In the past, the only way to get a non-buildable library was to set buildable to false.
* Now, the only way to get a non-buildble library is to set bundler to none.
* By default, with nothing provided, libraries are buildable with `@nrwl/js:tsc`.
* By default, with nothing provided, libraries are buildable with `@nx/js:tsc`.
*/
options.bundler = options.bundler ?? options.compiler ?? 'tsc';
@ -534,7 +534,7 @@ function addProjectDependencies(
tree,
{},
{
'@nrwl/esbuild': nxVersion,
'@nx/esbuild': nxVersion,
'@types/node': typesNodeVersion,
esbuild: esbuildVersion,
}
@ -558,14 +558,14 @@ function addProjectDependencies(
function getBuildExecutor(bundler: Bundler) {
switch (bundler) {
case 'esbuild':
return `@nrwl/esbuild:esbuild`;
return `@nx/esbuild:esbuild`;
case 'rollup':
return `@nrwl/rollup:rollup`;
return `@nx/rollup:rollup`;
case 'swc':
case 'tsc':
return `@nrwl/js:${bundler}`;
return `@nx/js:${bundler}`;
case 'vite':
return `@nrwl/vite:build`;
return `@nx/vite:build`;
case 'none':
default:
return undefined;

View File

@ -66,6 +66,7 @@ async function setup(tree: Tree) {
});
const projectConfig = readProjectConfiguration(tree, 'my-lib');
projectConfig.targets.build.executor = '@nrwl/js:swc';
projectConfig.targets.test.executor = '@nrwl/jest:jest';
updateProjectConfiguration(tree, 'my-lib', projectConfig);

View File

@ -16,12 +16,12 @@ export enum HelperDependency {
}
const jsExecutors = {
'@nrwl/js:tsc': {
'@nx/js:tsc': {
helperDependency: HelperDependency.tsc,
getConfigPath: (options: ExecutorOptions, contextRoot: string, _: string) =>
join(contextRoot, options.tsConfig),
} as const,
'@nrwl/js:swc': {
'@nx/js:swc': {
helperDependency: HelperDependency.swc,
getConfigPath: (
options: SwcExecutorOptions,

View File

@ -10,7 +10,7 @@ const publishScriptContent = `
* You might need to authenticate with NPM before running this script.
*/
import { readCachedProjectGraph } from '@nrwl/devkit';
import { readCachedProjectGraph } from '@nx/devkit';
import { execSync } from 'child_process';
import { readFileSync, writeFileSync } from 'fs';
import chalk from 'chalk';

View File

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

View File

@ -1,7 +1,7 @@
{
"name": "nx/next",
"version": "0.1",
"extends": ["@nrwl/react"],
"extends": ["@nx/react"],
"schematics": {
"init": {
"factory": "./src/generators/init/init#nextInitSchematic",

View File

@ -80,7 +80,10 @@ function getNxContext(
} {
const targetConfig = getTargetConfig(graph, target);
if ('@nrwl/next:build' === targetConfig.executor) {
if (
'@nx/next:build' === targetConfig.executor ||
'@nrwl/next:build' === targetConfig.executor
) {
return {
node: graph.nodes[target.project],
options: getOptions(graph, target),
@ -101,7 +104,12 @@ function getNxContext(
return getNxContext(graph, devServerTarget);
} else if (
['@nrwl/next:server', '@nrwl/next:export'].includes(targetConfig.executor)
[
'@nx/next:server',
'@nx/next:export',
'@nrwl/next:server',
'@nrwl/next:export',
].includes(targetConfig.executor)
) {
const buildTarget = parseTargetString(targetOptions.buildTarget, graph);
return getNxContext(graph, buildTarget);

View File

@ -347,9 +347,9 @@ exports[`app --style styled-jsx should use <style jsx> in index page 1`] = `
</summary>
<pre>
<span># Generate UI lib</span>
nx g @nrwl/next:library ui
nx g @nx/next:library ui
<span># Add a component</span>
nx g @nrwl/next:component button --project=ui
nx g @nx/next:component button --project=ui
</pre>
</details>
<details>

View File

@ -224,7 +224,7 @@ describe('app', () => {
});
expect(tree.read('apps/my-app/jest.config.ts', 'utf-8')).toContain(
`'^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest'`
`'^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest'`
);
});
@ -236,7 +236,7 @@ describe('app', () => {
const projectConfiguration = readProjectConfiguration(tree, 'my-app');
expect(projectConfiguration.targets.build.executor).toEqual(
'@nrwl/next:build'
'@nx/next:build'
);
expect(projectConfiguration.targets.build.options).toEqual({
root: 'apps/my-app',
@ -252,7 +252,7 @@ describe('app', () => {
const projectConfiguration = readProjectConfiguration(tree, 'my-app');
expect(projectConfiguration.targets.serve.executor).toEqual(
'@nrwl/next:server'
'@nx/next:server'
);
expect(projectConfiguration.targets.serve.options).toEqual({
buildTarget: 'my-app:build',
@ -275,7 +275,7 @@ describe('app', () => {
const projectConfiguration = readProjectConfiguration(tree, 'my-app');
expect(projectConfiguration.targets.export.executor).toEqual(
'@nrwl/next:export'
'@nx/next:export'
);
expect(projectConfiguration.targets.export.options).toEqual({
buildTarget: 'my-app:build:production',
@ -339,7 +339,7 @@ describe('app', () => {
"jest": true,
},
"extends": [
"plugin:@nrwl/nx/react-typescript",
"plugin:@nx/nx/react-typescript",
"next",
"next/core-web-vitals",
"../../.eslintrc.json",

View File

@ -2,7 +2,7 @@
"presets": [
<% if (style === '@emotion/styled') { %>
[
"@nrwl/next/babel",
"@nx/next/babel",
{
"preset-react": {
"runtime": "automatic",
@ -11,7 +11,7 @@
}
]
<% } else { %>
"@nrwl/next/babel"
"@nx/next/babel"
<% } %>
],
"plugins": [

View File

@ -1,15 +1,15 @@
//@ts-check
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { composePlugins, withNx } = require('@nrwl/next');
const { composePlugins, withNx } = require('@nx/next');
<% if (style === 'less') { %>
// This plugin is needed until this PR is merged.
// https://github.com/vercel/next.js/pull/23185
const { withLess } = require('@nrwl/next/plugins/with-less');
const { withLess } = require('@nx/next/plugins/with-less');
/**
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
@ -18,7 +18,7 @@ const nextConfig = {
svgr: false,
},
<% if(appDir) { %>
experimental: {
experimental: {
appDir: true
},
<% } %>
@ -32,10 +32,10 @@ const plugins = [
module.exports = composePlugins(...plugins)(nextConfig));
<% } else if (style === 'styl') { %>
const { withStylus } = require('@nrwl/next/plugins/with-stylus');
const { withStylus } = require('@nx/next/plugins/with-stylus');
/**
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
@ -44,7 +44,7 @@ const nextConfig = {
svgr: false,
},
<% if(appDir) { %>
experimental: {
experimental: {
appDir: true
},
<% } %>
@ -64,7 +64,7 @@ module.exports = composePlugins(...plugins)(nextConfig);
|| style === 'none'
) { %>
/**
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
@ -73,7 +73,7 @@ const nextConfig = {
svgr: false,
},
<% if(appDir) { %>
experimental: {
experimental: {
appDir: true
},
<% } %>
@ -88,7 +88,7 @@ module.exports = composePlugins(...plugins)(nextConfig);
<% } else {
// Defaults to CSS/SASS (which don't need plugin as of Next 9.3) %>
/**
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
@ -97,7 +97,7 @@ const nextConfig = {
svgr: false,
},
<% if(appDir) { %>
experimental: {
experimental: {
appDir: true
},
<% } %>

View File

@ -78,10 +78,10 @@ export async function addLinting(
json.extends.unshift(...['next', 'next/core-web-vitals']);
// remove nx/react plugin, as it conflicts with the next.js one
json.extends = json.extends.filter(
(name) => name !== 'plugin:@nrwl/nx/react'
(name) => name !== 'plugin:@nx/nx/react'
);
json.extends.unshift('plugin:@nrwl/nx/react-typescript');
json.extends.unshift('plugin:@nx/nx/react-typescript');
if (!json.env) {
json.env = {};
}

View File

@ -10,7 +10,7 @@ export function addProject(host: Tree, options: NormalizedSchema) {
const targets: Record<string, any> = {};
targets.build = {
executor: '@nrwl/next:build',
executor: '@nx/next:build',
outputs: ['{options.outputPath}'],
defaultConfiguration: 'production',
options: {
@ -26,7 +26,7 @@ export function addProject(host: Tree, options: NormalizedSchema) {
};
targets.serve = {
executor: '@nrwl/next:server',
executor: '@nx/next:server',
defaultConfiguration: 'development',
options: {
buildTarget: `${options.projectName}:build`,
@ -45,7 +45,7 @@ export function addProject(host: Tree, options: NormalizedSchema) {
};
targets.export = {
executor: '@nrwl/next:export',
executor: '@nx/next:export',
options: {
buildTarget: `${options.projectName}:build:production`,
},

View File

@ -322,9 +322,9 @@ export function createAppJsx(name: string) {
</summary>
<pre>
<span># Generate UI lib</span>
nx g @nrwl/next:library ui
nx g @nx/next:library ui
<span># Add a component</span>
nx g @nrwl/next:component button --project=ui
nx g @nx/next:component button --project=ui
</pre>
</details>
<details>

View File

@ -5,20 +5,11 @@ import { NormalizedSchema } from './normalize-options';
export function setDefaults(host: Tree, options: NormalizedSchema) {
const nxJson = readNxJson(host);
nxJson.generators = nxJson.generators || {};
nxJson.generators['@nrwl/next'] = nxJson.generators['@nrwl/next'] || {};
const prev = nxJson.generators['@nrwl/next'];
nxJson.generators ??= {};
nxJson.generators['@nx/next'] ??= {};
nxJson.generators['@nx/next'].application ??= {};
nxJson.generators['@nx/next'].application.style ??= options.style;
nxJson.generators['@nx/next'].application.linter ??= options.linter;
nxJson.generators = {
...nxJson.generators,
'@nrwl/next': {
...prev,
application: {
style: options.style,
linter: options.linter,
...prev.application,
},
},
};
updateNxJson(host, nxJson);
}

View File

@ -13,11 +13,8 @@ export function updateJestConfig(host: Tree, options: NormalizedSchema) {
const content = originalContent
.replace(
'transform: {',
"transform: {\n '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',"
"transform: {\n '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',"
)
.replace(
`'babel-jest'`,
`['babel-jest', { presets: ['@nrwl/next/babel'] }]`
);
.replace(`'babel-jest'`, `['babel-jest', { presets: ['@nx/next/babel'] }]`);
host.write(configPath, content);
}

View File

@ -17,9 +17,12 @@ export async function customServerGenerator(
): Promise<void> {
const project = readProjectConfiguration(host, options.project);
if (project.targets?.build?.executor !== '@nrwl/next:build') {
if (
project.targets?.build?.executor !== '@nx/next:build' &&
project.targets?.build?.executor !== '@nrwl/next:build'
) {
logger.error(
`Project ${options.project} is not a Next.js project. Did you generate it with "nx g @nrwl/next:app"?`
`Project ${options.project} is not a Next.js project. Did you generate it with "nx g @nx/next:app"?`
);
return;
}
@ -34,7 +37,7 @@ export async function customServerGenerator(
!project.targets?.build?.configurations?.production
) {
logger.error(
`Project ${options.project} has invalid config. Did you generate it with "nx g @nrwl/next:app"?`
`Project ${options.project} has invalid config. Did you generate it with "nx g @nx/next:app"?`
);
return;
}
@ -62,7 +65,7 @@ export async function customServerGenerator(
project.targets.serve.configurations.production.customServerTarget = `${options.project}:serve-custom-server:production`;
project.targets['build-custom-server'] = {
executor: '@nrwl/js:tsc',
executor: '@nx/js:tsc',
defaultConfiguration: 'production',
options: {
outputPath,
@ -78,7 +81,7 @@ export async function customServerGenerator(
};
project.targets['serve-custom-server'] = {
executor: '@nrwl/js:node',
executor: '@nx/js:node',
defaultConfiguration: 'development',
options: {
buildTarget: `${options.project}:build-custom-server`,

View File

@ -12,7 +12,7 @@ import * as path from 'path';
import next from 'next';
// Next.js server options:
// - The environment variable is set by `@nrwl/next:server` when running the dev server.
// - The environment variable is set by `@nx/next:server` when running the dev server.
// - The fallback `__dirname` is for production builds.
// - Feel free to change this to suit your needs.
const dir = process.env.NX_NEXT_DIR || path.join(__dirname, '..');

View File

@ -13,8 +13,8 @@ describe('init', () => {
it('should add react dependencies', async () => {
await nextInitGenerator(tree, {});
const packageJson = readJson(tree, 'package.json');
expect(packageJson.dependencies['@nrwl/react']).toBeUndefined();
expect(packageJson.dependencies['@nrwl/next']).toBeDefined();
expect(packageJson.dependencies['@nx/react']).toBeUndefined();
expect(packageJson.dependencies['@nx/next']).toBeDefined();
expect(packageJson.dependencies['next']).toBeDefined();
});

View File

@ -24,7 +24,7 @@ function updateDependencies(host: Tree) {
return addDependenciesToPackageJson(
host,
{
'@nrwl/next': nxVersion,
'@nx/next': nxVersion,
next: nextVersion,
react: reactVersion,
'react-dom': reactDomVersion,

View File

@ -13,7 +13,7 @@ describe('next library', () => {
let mockedInstalledCypressVersion: jest.Mock<
ReturnType<typeof installedCypressVersion>
> = installedCypressVersion as never;
it('should use "@nrwl/next/babel" preset in babelrc', async () => {
it('should use "@nx/next/babel" preset in babelrc', async () => {
const baseOptions: Schema = {
name: '',
linter: Linter.EsLint,
@ -47,13 +47,13 @@ describe('next library', () => {
});
expect(readJson(appTree, 'libs/my-lib/.babelrc')).toEqual({
presets: ['@nrwl/next/babel'],
presets: ['@nx/next/babel'],
plugins: [],
});
expect(readJson(appTree, 'libs/my-lib2/.babelrc')).toEqual({
presets: [
[
'@nrwl/next/babel',
'@nx/next/babel',
{
'preset-react': {
runtime: 'automatic',
@ -65,16 +65,16 @@ describe('next library', () => {
plugins: ['@emotion/babel-plugin'],
});
expect(readJson(appTree, 'libs/my-lib-styled-jsx/.babelrc')).toEqual({
presets: ['@nrwl/next/babel'],
presets: ['@nx/next/babel'],
plugins: [],
});
expect(readJson(appTree, 'libs/my-dir/my-lib3/.babelrc')).toEqual({
presets: ['@nrwl/next/babel'],
presets: ['@nx/next/babel'],
plugins: [],
});
});
it('should use @nrwl/next images.d.ts file', async () => {
it('should use @nx/next images.d.ts file', async () => {
const baseOptions: Schema = {
name: '',
linter: Linter.EsLint,
@ -96,10 +96,10 @@ describe('next library', () => {
).files;
expect(tsconfigFiles).toContain(
'../../node_modules/@nrwl/next/typings/image.d.ts'
'../../node_modules/@nx/next/typings/image.d.ts'
);
expect(tsconfigFiles).not.toContain(
'../../node_modules/@nrwl/react/typings/image.d.ts'
'../../node_modules/@nx/react/typings/image.d.ts'
);
});

View File

@ -65,7 +65,7 @@ export async function libraryGenerator(host: Tree, rawOptions: Schema) {
if (options.style === '@emotion/styled') {
json.presets = [
[
'@nrwl/next/babel',
'@nx/next/babel',
{
'preset-react': {
runtime: 'automatic',
@ -77,12 +77,12 @@ export async function libraryGenerator(host: Tree, rawOptions: Schema) {
} else if (options.style === 'styled-jsx') {
// next.js doesn't require the `styled-jsx/babel' plugin as it is already
// built-into the `next/babel` preset
json.presets = ['@nrwl/next/babel'];
json.presets = ['@nx/next/babel'];
json.plugins = (json.plugins || []).filter(
(x) => x !== 'styled-jsx/babel'
);
} else {
json.presets = ['@nrwl/next/babel'];
json.presets = ['@nx/next/babel'];
}
return json;
}
@ -109,8 +109,8 @@ export async function libraryGenerator(host: Tree, rawOptions: Schema) {
json.files = json.files.map((path: string) => {
if (path.endsWith('react/typings/image.d.ts')) {
return path.replace(
'@nrwl/react/typings/image.d.ts',
'@nrwl/next/typings/image.d.ts'
'@nx/react/typings/image.d.ts',
'@nx/next/typings/image.d.ts'
);
}
return path;

View File

@ -1,6 +1,7 @@
import {
readProjectConfiguration,
Tree,
updateJson,
updateProjectConfiguration,
} from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
@ -22,6 +23,13 @@ describe('Migration: enable SWC', () => {
skipFormat: false,
swc: false,
});
updateJson(tree, 'apps/demo/.babelrc', (json) => {
json.presets[0] = '@nrwl/next/babel';
return json;
});
// rename jest config to js as that was standard at this version of nx
tree.delete('apps/demo/jest.config.ts');
updateProjectConfiguration(tree, 'demo', {

View File

@ -12,7 +12,7 @@ export function createGlobPatternsOfDependentProjects(
fileGlobPattern: string = '/**/!(*.stories|*.spec).tsx'
): string[] {
logger.warn(
`createGlobPatternsOfDependentProjects is deprecated. Use "createGlobPatternsForDependencies(__dirname)" from "@nrwl/next/tailwind" instead`
`createGlobPatternsOfDependentProjects is deprecated. Use "createGlobPatternsForDependencies(__dirname)" from "@nx/next/tailwind" instead`
);
try {

View File

@ -35,7 +35,7 @@ describe('NxPlugin Plugin Generator', () => {
const project = readProjectConfiguration(tree, 'my-plugin');
expect(project.root).toEqual('libs/my-plugin');
expect(project.targets.build).toEqual({
executor: '@nrwl/js:tsc',
executor: '@nx/js:tsc',
outputs: ['{options.outputPath}'],
options: {
outputPath: 'dist/libs/my-plugin',
@ -139,7 +139,7 @@ describe('NxPlugin Plugin Generator', () => {
const { build } = readProjectConfiguration(tree, 'my-plugin').targets;
expect(build.executor).toEqual('@nrwl/js:tsc');
expect(build.executor).toEqual('@nx/js:tsc');
});
it('should specify swc as compiler', async () => {
@ -152,7 +152,7 @@ describe('NxPlugin Plugin Generator', () => {
const { build } = readProjectConfiguration(tree, 'my-plugin').targets;
expect(build.executor).toEqual('@nrwl/js:swc');
expect(build.executor).toEqual('@nx/js:swc');
});
});

View File

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

View File

@ -134,18 +134,6 @@
"version": "0.64.1",
"alwaysAddToPackageJson": false
},
"@nrwl/react": {
"version": "12.3.6",
"alwaysAddToPackageJson": false
},
"@nrwl/jest": {
"version": "12.3.6",
"alwaysAddToPackageJson": false
},
"@nrwl/linter": {
"version": "12.3.6",
"alwaysAddToPackageJson": false
},
"@types/react": {
"version": "17.0.6",
"alwaysAddToPackageJson": false
@ -191,14 +179,6 @@
"12.5.0": {
"version": "12.5.0-beta.0",
"packages": {
"@nrwl/jest": {
"version": "12.5.7",
"alwaysAddToPackageJson": false
},
"@nrwl/linter": {
"version": "12.5.7",
"alwaysAddToPackageJson": false
},
"react": {
"version": "17.0.2",
"alwaysAddToPackageJson": false

View File

@ -1,4 +1,4 @@
const { withNxMetro } = require('@nrwl/react-native');
const { withNxMetro } = require('@nx/react-native');
const { getDefaultConfig } = require('metro-config');
const exclusionList = require('metro-config/src/defaults/exclusionList');
@ -35,4 +35,4 @@ module.exports = (async () => {
watchFolders: []
}
);
})();
})();

View File

@ -452,14 +452,14 @@ export const App = () => {
styles.marginBottomMd,
]}
>
nx g @nrwl/react-native:lib ui
nx g @nx/react-native: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/react-native:component \
@nx/react-native:component \
</Text>
<Text style={[styles.textXS, styles.monospace]}>
button --project ui

View File

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

View File

@ -24,7 +24,7 @@ function getTargets(options: NormalizedSchema) {
const architect: { [key: string]: TargetConfiguration } = {};
architect.start = {
executor: '@nrwl/react-native:start',
executor: '@nx/react-native:start',
options: {
port: 8081,
},
@ -38,12 +38,12 @@ function getTargets(options: NormalizedSchema) {
};
architect['run-ios'] = {
executor: '@nrwl/react-native:run-ios',
executor: '@nx/react-native:run-ios',
options: {},
};
architect['bundle-ios'] = {
executor: '@nrwl/react-native:bundle',
executor: '@nx/react-native:bundle',
outputs: ['{options.bundleOutput}'],
options: {
entryFile: options.entryFile,
@ -53,12 +53,12 @@ function getTargets(options: NormalizedSchema) {
};
architect['run-android'] = {
executor: '@nrwl/react-native:run-android',
executor: '@nx/react-native:run-android',
options: {},
};
architect['build-android'] = {
executor: '@nrwl/react-native:build-android',
executor: '@nx/react-native:build-android',
outputs: [
`{projectRoot}/android/app/build/outputs/bundle`,
`{projectRoot}/android/app/build/outputs/apk`,
@ -67,18 +67,18 @@ function getTargets(options: NormalizedSchema) {
};
architect['build-ios'] = {
executor: '@nrwl/react-native:build-ios',
executor: '@nx/react-native:build-ios',
outputs: ['{projectRoot}/ios/build/Build'],
options: {},
};
architect['pod-install'] = {
executor: '@nrwl/react-native:pod-install',
executor: '@nx/react-native:pod-install',
options: {},
};
architect['bundle-android'] = {
executor: '@nrwl/react-native:bundle',
executor: '@nx/react-native:bundle',
outputs: ['{options.bundleOutput}'],
options: {
entryFile: options.entryFile,
@ -88,12 +88,12 @@ function getTargets(options: NormalizedSchema) {
};
architect['sync-deps'] = {
executor: '@nrwl/react-native:sync-deps',
executor: '@nx/react-native:sync-deps',
options: {},
};
architect['ensure-symlink'] = {
executor: '@nrwl/react-native:ensure-symlink',
executor: '@nx/react-native:ensure-symlink',
options: {},
};

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

@ -90,7 +90,7 @@ export function updateDependencies(host: Tree) {
'react-native': reactNativeVersion,
},
{
'@nrwl/react-native': nxVersion,
'@nx/react-native': nxVersion,
'@types/node': typesNodeVersion,
'@types/react': typesReactVersion,
'@types/react-native': typesReactNativeVersion,
@ -124,7 +124,7 @@ export function updateDependencies(host: Tree) {
}
function moveDependency(host: Tree) {
return removeDependenciesFromPackageJson(host, ['@nrwl/react-native'], []);
return removeDependenciesFromPackageJson(host, ['@nx/react-native'], []);
}
export default reactNativeInitGenerator;

View File

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

View File

@ -268,7 +268,7 @@ describe('lib', () => {
const projectConfiguration = readProjectConfiguration(appTree, 'my-lib');
expect(projectConfiguration.targets.build).toMatchObject({
executor: '@nrwl/web:rollup',
executor: '@nx/web:rollup',
outputs: ['{options.outputPath}'],
options: {
external: ['react/jsx-runtime', 'react-native'],
@ -276,7 +276,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

@ -84,7 +84,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}`,
@ -92,7 +92,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

@ -95,7 +95,7 @@ describe('react-native:storybook-configuration', () => {
});
// Currently the auto-generate stories feature only picks up components under the 'lib' directory.
// In our 'createTestAppLib' function, we call @nrwl/react-native:component to generate a component
// In our 'createTestAppLib' function, we call @nx/react-native:component to generate a component
// under the specified 'lib' directory
expect(
appTree.exists(

View File

@ -59,7 +59,7 @@ export async function storybookConfigurationGenerator(
function addStorybookTask(host: Tree, projectName: string) {
const projectConfig = readProjectConfiguration(host, projectName);
projectConfig.targets['storybook'] = {
executor: '@nrwl/react-native:storybook',
executor: '@nx/react-native:storybook',
options: {
searchDir: [projectConfig.root],
outputFile: './.storybook/story-loader.js',

View File

@ -25,6 +25,8 @@ export async function createStorybookFiles(
// do not proceed if not a react native project
if (
targets?.start?.executor !== '@nx/react-native:start' &&
targets?.start?.executor !== '@nx/expo:start' &&
targets?.start?.executor !== '@nrwl/react-native:start' &&
targets?.start?.executor !== '@nrwl/expo:start'
) {

View File

@ -29,11 +29,11 @@ export async function addJest(
const content = `module.exports = {
displayName: '${projectName}',
preset: 'react-native',
resolver: '@nrwl/jest/plugins/resolver',
resolver: '@nx/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
setupFilesAfterEnv: ['<rootDir>/test-setup.${js ? 'js' : 'ts'}'],
moduleNameMapper: {
'\\\\.svg$': '@nrwl/react-native/plugins/jest/svg-mock'
'\\\\.svg$': '@nx/react-native/plugins/jest/svg-mock'
}
};`;
host.write(configPath, content);

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: '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

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

View File

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

View File

@ -135,7 +135,7 @@ export function nxComponentTestingPreset(
}
/**
* apply the schema.json defaults from the @nrwl/web:webpack executor to the target options
* apply the schema.json defaults from the @nx/web:webpack executor to the target options
*/
function withSchemaDefaults(target: Target, context: ExecutorContext) {
const options = readTargetOptions(target, context);
@ -213,7 +213,7 @@ function buildTargetWebpack(
return async () => {
customWebpack = await customWebpack;
// TODO(jack): Once webpackConfig is always set in @nrwl/webpack:webpack, we no longer need this default.
// TODO(jack): Once webpackConfig is always set in @nx/webpack:webpack, we no longer need this default.
const defaultWebpack = getWebpackConfig(context, {
...options,
root: workspaceRoot,

View File

@ -71,7 +71,7 @@ export function buildBaseWebpackConfig({
test: /\.(js|jsx|mjs|ts|tsx)$/,
loader: require.resolve('babel-loader'),
options: {
presets: [`@nrwl/react/babel`],
presets: [`@nx/react/babel`],
rootMode: 'upward',
babelrc: true,
},

View File

@ -63,7 +63,7 @@ export const webpack = async (
options: any
): Promise<Configuration> => {
logger.info(
'=> Loading Nx React Storybook Addon from "@nrwl/react/plugins/storybook"'
'=> Loading Nx React Storybook Addon from "@nx/react/plugins/storybook"'
);
// In case anyone is missing dep and did not run migrations.
// See: https://github.com/nrwl/nx/issues/14455

View File

@ -4,7 +4,7 @@ import { withReact } from './with-react';
const legacyExport: any = withReact();
legacyExport.withReact = withReact;
/** @deprecated use `import { withReact } from '@nrwl/react'` */
/** @deprecated use `import { withReact } from '@nx/react'` */
// This is here for backward compatibility if anyone imports {getWebpackConfig} directly.
// TODO(jack): Remove in Nx 16
const getWebpackConfig = withReact();

View File

@ -32,7 +32,7 @@ export default async function* moduleFederationDevServer(
} catch {
// TODO(jack): Add a link to guide
throw new Error(
`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nrwl/react:host"?`
`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/react:host"?`
);
}

View File

@ -41,7 +41,7 @@ export default async function* moduleFederationSsrDevServer(
} catch {
// TODO(jack): Add a link to guide
throw new Error(
`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nrwl/react:host"?`
`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/react:host"?`
);
}

View File

@ -102,7 +102,7 @@ describe('app', () => {
expect(appTree.exists('apps/my-app/src/app/app.module.css')).toBeTruthy();
const jestConfig = appTree.read('apps/my-app/jest.config.ts').toString();
expect(jestConfig).toContain('@nrwl/react/plugins/jest');
expect(jestConfig).toContain('@nx/react/plugins/jest');
const tsconfig = readJson(appTree, 'apps/my-app/tsconfig.json');
expect(tsconfig.references).toEqual([
@ -131,7 +131,7 @@ describe('app', () => {
const eslintJson = readJson(appTree, 'apps/my-app/.eslintrc.json');
expect(eslintJson.extends).toEqual([
'plugin:@nrwl/nx/react',
'plugin:@nx/nx/react',
'../../.eslintrc.json',
]);
@ -247,7 +247,7 @@ describe('app', () => {
{
path: 'apps/my-dir/my-app/.eslintrc.json',
lookupFn: (json) => json.extends,
expectedValue: ['plugin:@nrwl/nx/react', '../../../.eslintrc.json'],
expectedValue: ['plugin:@nx/nx/react', '../../../.eslintrc.json'],
},
].forEach(hasJsonValue);
});
@ -304,7 +304,7 @@ describe('app', () => {
await applicationGenerator(appTree, { ...schema, name: 'my-app' });
expect(appTree.read('apps/my-app/jest.config.ts').toString()).toContain(
"['babel-jest', { presets: ['@nrwl/react/babel'] }]"
"['babel-jest', { presets: ['@nx/react/babel'] }]"
);
});
@ -325,7 +325,7 @@ describe('app', () => {
const projectsConfigurations = getProjects(appTree);
const targetConfig = projectsConfigurations.get('my-app').targets;
expect(targetConfig.build.executor).toEqual('@nrwl/webpack:webpack');
expect(targetConfig.build.executor).toEqual('@nx/webpack:webpack');
expect(targetConfig.build.outputs).toEqual(['{options.outputPath}']);
expect(targetConfig.build.options).toEqual({
compiler: 'babel',
@ -387,7 +387,7 @@ describe('app', () => {
const projectsConfigurations = getProjects(appTree);
const targetConfig = projectsConfigurations.get('my-app').targets;
expect(targetConfig.serve.executor).toEqual('@nrwl/webpack:dev-server');
expect(targetConfig.serve.executor).toEqual('@nx/webpack:dev-server');
expect(targetConfig.serve.options).toEqual({
buildTarget: 'my-app:build',
hmr: true,
@ -532,7 +532,7 @@ describe('app', () => {
expect(eslintJson).toMatchInlineSnapshot(`
{
"extends": [
"plugin:@nrwl/nx/react",
"plugin:@nx/nx/react",
"../../.eslintrc.json",
],
"ignorePatterns": [
@ -609,7 +609,7 @@ describe('app', () => {
await applicationGenerator(appTree, { ...schema, style: 'none' });
const nxJson = readNxJson(appTree);
expect(nxJson.generators['@nrwl/react']).toMatchObject({
expect(nxJson.generators['@nx/react']).toMatchObject({
application: {
style: 'none',
},
@ -842,7 +842,7 @@ describe('app', () => {
});
const nxJson = readNxJson(appTree);
expect(nxJson.generators['@nrwl/react']).toMatchObject({
expect(nxJson.generators['@nx/react']).toMatchObject({
application: {
babel: true,
style: 'styled-components',

View File

@ -5,9 +5,9 @@
"types": ["node"]
},
"files": [
<% if (style === 'styled-jsx') { %>"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/styled-jsx.d.ts",<% } %>
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/cssmodule.d.ts",
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/image.d.ts"
<% if (style === 'styled-jsx') { %>"<%= offsetFromRoot %>node_modules/@nx/react/typings/styled-jsx.d.ts",<% } %>
"<%= offsetFromRoot %>node_modules/@nx/react/typings/cssmodule.d.ts",
"<%= offsetFromRoot %>node_modules/@nx/react/typings/image.d.ts"
],
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]

View File

@ -1,7 +1,7 @@
{
"presets": [
[
"@nrwl/react/babel", {
"@nx/react/babel", {
"runtime": "automatic"<% if (style === '@emotion/styled') { %>,<% } %>
<% if (style === '@emotion/styled') { %>"importSource": "@emotion/react" <% } %>
}

View File

@ -5,9 +5,9 @@
"types": ["node"]
},
"files": [
<% if (style === 'styled-jsx') { %>"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/styled-jsx.d.ts",<% } %>
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/cssmodule.d.ts",
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/image.d.ts"
<% if (style === 'styled-jsx') { %>"<%= offsetFromRoot %>node_modules/@nx/react/typings/styled-jsx.d.ts",<% } %>
"<%= offsetFromRoot %>node_modules/@nx/react/typings/cssmodule.d.ts",
"<%= offsetFromRoot %>node_modules/@nx/react/typings/image.d.ts"
],
"exclude": ["jest.config.ts","src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]

View File

@ -1,5 +1,5 @@
const { composePlugins, withNx } = require('@nrwl/webpack');
const { withReact } = require('@nrwl/react');
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
// Nx plugins for webpack.
module.exports = composePlugins(withNx(), withReact(), (config) => {

View File

@ -768,9 +768,9 @@ export function NxWelcome({ title }: { title: string }) {
</summary>
<pre>
<span># Generate UI lib</span>
nx g @nrwl/react:lib ui
nx g @nx/react:lib ui
<span># Add a component</span>
nx g @nrwl/react:component button --project ui
nx g @nx/react:component button --project ui
</pre>
</details>
<details>

View File

@ -35,7 +35,7 @@ function maybeJs(options: NormalizedSchema, path: string): string {
function createBuildTarget(options: NormalizedSchema): TargetConfiguration {
return {
executor: '@nrwl/webpack:webpack',
executor: '@nx/webpack:webpack',
outputs: ['{options.outputPath}'],
defaultConfiguration: 'production',
options: {
@ -106,7 +106,7 @@ function createBuildTarget(options: NormalizedSchema): TargetConfiguration {
function createServeTarget(options: NormalizedSchema): TargetConfiguration {
return {
executor: '@nrwl/webpack:dev-server',
executor: '@nx/webpack:dev-server',
defaultConfiguration: 'development',
options: {
buildTarget: `${options.projectName}:build`,

View File

@ -13,7 +13,7 @@ export function installCommonDependencies(
let devDependencies = null;
// Vite requires style preprocessors to be installed manually.
// `@nrwl/webpack` installs them automatically for now.
// `@nx/webpack` installs them automatically for now.
// TODO(jack): Once we clean up webpack we can remove this check
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
switch (options.style) {

View File

@ -13,9 +13,9 @@ export function setDefaults(host: Tree, options: NormalizedSchema) {
}
nxJson.generators = nxJson.generators || {};
nxJson.generators['@nrwl/react'] = nxJson.generators['@nrwl/react'] || {};
nxJson.generators['@nx/react'] = nxJson.generators['@nx/react'] || {};
const prev = { ...nxJson.generators['@nrwl/react'] };
const prev = { ...nxJson.generators['@nx/react'] };
const appDefaults = {
style: options.style,
@ -35,7 +35,7 @@ export function setDefaults(host: Tree, options: NormalizedSchema) {
nxJson.generators = {
...nxJson.generators,
'@nrwl/react': {
'@nx/react': {
...prev,
application: appDefaults,
component: componentDefaults,

View File

@ -10,12 +10,12 @@ export function updateSpecConfig(host: Tree, options: NormalizedSchema) {
updateJson(host, `${options.appProjectRoot}/tsconfig.spec.json`, (json) => {
const offset = offsetFromRoot(options.appProjectRoot);
json.files = [
`${offset}node_modules/@nrwl/react/typings/cssmodule.d.ts`,
`${offset}node_modules/@nrwl/react/typings/image.d.ts`,
`${offset}node_modules/@nx/react/typings/cssmodule.d.ts`,
`${offset}node_modules/@nx/react/typings/image.d.ts`,
];
if (options.style === 'styled-jsx') {
json.files.unshift(
`${offset}node_modules/@nrwl/react/typings/styled-jsx.d.ts`
`${offset}node_modules/@nx/react/typings/styled-jsx.d.ts`
);
}
return json;

View File

@ -2,7 +2,7 @@
exports[`React:CypressComponentTestConfiguration should generate cypress component test config with --build-target 1`] = `
"import { defineConfig } from 'cypress';
import { nxComponentTestingPreset } from '@nrwl/react/plugins/component-testing';
import { nxComponentTestingPreset } from '@nx/react/plugins/component-testing';
export default defineConfig({
component: nxComponentTestingPreset(__filename, {
@ -14,7 +14,7 @@ export default defineConfig({
exports[`React:CypressComponentTestConfiguration should generate cypress component test config with project graph 1`] = `
"import { defineConfig } from 'cypress';
import { nxComponentTestingPreset } from '@nrwl/react/plugins/component-testing';
import { nxComponentTestingPreset } from '@nx/react/plugins/component-testing';
export default defineConfig({
component: nxComponentTestingPreset(__filename, {
@ -26,7 +26,7 @@ export default defineConfig({
exports[`React:CypressComponentTestConfiguration should generate cypress component test config with webpack 1`] = `
"import { defineConfig } from 'cypress';
import { nxComponentTestingPreset } from '@nrwl/react/plugins/component-testing';
import { nxComponentTestingPreset } from '@nx/react/plugins/component-testing';
export default defineConfig({
component: nxComponentTestingPreset(__filename, {
@ -38,7 +38,7 @@ export default defineConfig({
exports[`React:CypressComponentTestConfiguration should generate cypress config with vite 1`] = `
"import { defineConfig } from 'cypress';
import { nxComponentTestingPreset } from '@nrwl/react/plugins/component-testing';
import { nxComponentTestingPreset } from '@nx/react/plugins/component-testing';
export default defineConfig({
component: nxComponentTestingPreset(__filename, {

View File

@ -1,5 +1,5 @@
import { defineConfig } from 'cypress';
import { nxComponentTestingPreset } from '@nrwl/react/plugins/component-testing';
import { nxComponentTestingPreset } from '@nx/react/plugins/component-testing';
export default defineConfig({
component: nxComponentTestingPreset(__filename, {

View File

@ -1,7 +1,7 @@
// @ts-check
/**
* @type {import('@nrwl/devkit').ModuleFederationConfig}
* @type {import('@nx/devkit').ModuleFederationConfig}
**/
const moduleFederationConfig = {
name: '<%= projectName %>',

View File

@ -1,6 +1,6 @@
const { composePlugins, withNx } = require('@nrwl/webpack');
const { withReact } = require('@nrwl/react');
const { withModuleFederationForSSR } = require('@nrwl/react/module-federation');
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const { withModuleFederationForSSR } = require('@nx/react/module-federation');
const baseConfig = require('./module-federation.config');

View File

@ -1,6 +1,6 @@
const { composePlugins, withNx } = require('@nrwl/webpack');
const { withReact } = require('@nrwl/react');
const { withModuleFederation } = require('@nrwl/react/module-federation');
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const { withModuleFederation } = require('@nx/react/module-federation');
const baseConfig = require('./module-federation.config');

View File

@ -1,6 +1,6 @@
const { composePlugins, withNx } = require('@nrwl/webpack');
const { withReact } = require('@nrwl/react');
const { withModuleFederation } = require('@nrwl/react/module-federation');
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const { withModuleFederation } = require('@nx/react/module-federation');
const baseConfig = require('./module-federation.config');

View File

@ -28,7 +28,7 @@ describe('hostGenerator', () => {
expect(tree.exists('apps/test/src/remotes.d.ts'));
});
it('should install @nrwl/web for the file-server executor', async () => {
it('should install @nx/web for the file-server executor', async () => {
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
await hostGenerator(tree, {
name: 'test',
@ -39,7 +39,7 @@ describe('hostGenerator', () => {
});
const packageJson = readJson(tree, 'package.json');
expect(packageJson.devDependencies['@nrwl/web']).toBeDefined();
expect(packageJson.devDependencies['@nx/web']).toBeDefined();
});
it('should generate host files and configs for SSR', async () => {

View File

@ -21,8 +21,7 @@ export async function setupSsrForHost(
) {
const tasks: GeneratorCallback[] = [];
let project = readProjectConfiguration(tree, appName);
project.targets.serve.executor =
'@nrwl/react:module-federation-ssr-dev-server';
project.targets.serve.executor = '@nx/react:module-federation-ssr-dev-server';
updateProjectConfiguration(tree, appName, project);
generateFiles(

View File

@ -30,10 +30,10 @@ function setDefault(host: Tree) {
const workspace = readNxJson(host);
workspace.generators = workspace.generators || {};
const reactGenerators = workspace.generators['@nrwl/react'] || {};
const reactGenerators = workspace.generators['@nx/react'] || {};
const generators = {
...workspace.generators,
'@nrwl/react': {
'@nx/react': {
...reactGenerators,
application: {
...reactGenerators.application,
@ -46,7 +46,7 @@ function setDefault(host: Tree) {
}
function updateDependencies(host: Tree, schema: InitSchema) {
removeDependenciesFromPackageJson(host, ['@nrwl/react'], []);
removeDependenciesFromPackageJson(host, ['@nx/react'], []);
const dependencies = {
react: reactVersion,
@ -58,7 +58,7 @@ function updateDependencies(host: Tree, schema: InitSchema) {
}
return addDependenciesToPackageJson(host, dependencies, {
'@nrwl/react': nxVersion,
'@nx/react': nxVersion,
'@types/node': typesNodeVersion,
'@types/react': typesReactVersion,
'@types/react-dom': typesReactDomVersion,

View File

@ -1,7 +1,7 @@
{
"presets": [
[
"@nrwl/react/babel", {
"@nx/react/babel", {
"runtime": "automatic",
"useBuiltIns": "usage"
<% if (style === '@emotion/styled') { %>,"importSource": "@emotion/react"<% } %>

View File

@ -5,9 +5,9 @@
"types": ["node"]
},
"files": [<% if (style === 'styled-jsx') { %>
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/styled-jsx.d.ts",<% } %>
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/cssmodule.d.ts",
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/image.d.ts"
"<%= offsetFromRoot %>node_modules/@nx/react/typings/styled-jsx.d.ts",<% } %>
"<%= offsetFromRoot %>node_modules/@nx/react/typings/cssmodule.d.ts",
"<%= offsetFromRoot %>node_modules/@nx/react/typings/image.d.ts"
],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]

View File

@ -5,9 +5,9 @@
"types": ["node"]
},
"files": [<% if (style === 'styled-jsx') { %>
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/styled-jsx.d.ts",<% } %>
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/cssmodule.d.ts",
"<%= offsetFromRoot %>node_modules/@nrwl/react/typings/image.d.ts"
"<%= offsetFromRoot %>node_modules/@nx/react/typings/styled-jsx.d.ts",<% } %>
"<%= offsetFromRoot %>node_modules/@nx/react/typings/cssmodule.d.ts",
"<%= offsetFromRoot %>node_modules/@nx/react/typings/image.d.ts"
],
"exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "**/*.spec.js", "**/*.test.js", "**/*.spec.jsx", "**/*.test.jsx"],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]

View File

@ -25,7 +25,7 @@ export async function addRollupBuildTarget(
nxVersion
);
// These are used in `@nrwl/react/plugins/bundle-rollup`
// These are used in `@nx/react/plugins/bundle-rollup`
addDependenciesToPackageJson(
host,
{},
@ -47,7 +47,7 @@ export async function addRollupBuildTarget(
}
targets.build = {
executor: '@nrwl/rollup:rollup',
executor: '@nx/rollup:rollup',
outputs: ['{options.outputPath}'],
options: {
outputPath:
@ -58,7 +58,7 @@ export async function addRollupBuildTarget(
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`,
compiler: options.compiler ?? 'babel',
assets: [
{

View File

@ -22,7 +22,7 @@ export function installCommonDependencies(
const devDependencies = {};
// Vite requires style preprocessors to be installed manually.
// `@nrwl/webpack` installs them automatically for now.
// `@nx/webpack` installs them automatically for now.
// TODO(jack): Once we clean up webpack we can remove this check
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
switch (options.style) {

View File

@ -5,9 +5,9 @@ export function setDefaults(host: Tree, options: NormalizedSchema) {
const nxJson = readNxJson(host);
nxJson.generators = nxJson.generators || {};
nxJson.generators['@nrwl/react'] = nxJson.generators['@nrwl/react'] || {};
nxJson.generators['@nx/react'] = nxJson.generators['@nx/react'] || {};
const prev = { ...nxJson.generators['@nrwl/react'] };
const prev = { ...nxJson.generators['@nx/react'] };
const libDefaults = {
...prev.library,
@ -16,7 +16,7 @@ export function setDefaults(host: Tree, options: NormalizedSchema) {
nxJson.generators = {
...nxJson.generators,
'@nrwl/react': {
'@nx/react': {
...prev,
library: libDefaults,
},

View File

@ -194,7 +194,7 @@ describe('lib', () => {
expect(eslintJson).toMatchInlineSnapshot(`
{
"extends": [
"plugin:@nrwl/nx/react",
"plugin:@nx/nx/react",
"../../.eslintrc.json",
],
"ignorePatterns": [
@ -235,7 +235,7 @@ describe('lib', () => {
compiler: 'babel',
});
expect(tree.read('libs/my-lib/jest.config.ts', 'utf-8')).toContain(
"['babel-jest', { presets: ['@nrwl/react/babel'] }]"
"['babel-jest', { presets: ['@nx/react/babel'] }]"
);
});
});
@ -292,7 +292,7 @@ describe('lib', () => {
compiler: 'babel',
});
expect(tree.read('libs/my-dir/my-lib/jest.config.ts', 'utf-8')).toContain(
"['babel-jest', { presets: ['@nrwl/react/babel'] }]"
"['babel-jest', { presets: ['@nx/react/babel'] }]"
);
});
@ -493,7 +493,7 @@ describe('lib', () => {
const projectsConfigurations = getProjects(tree);
expect(projectsConfigurations.get('my-lib').targets.build).toMatchObject({
executor: '@nrwl/rollup:rollup',
executor: '@nx/rollup:rollup',
outputs: ['{options.outputPath}'],
options: {
external: ['react/jsx-runtime'],
@ -501,7 +501,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

@ -34,7 +34,7 @@ const server = app.listen(port, () => {
console.log(`Express server listening on http://localhost:${port}`);
/**
* DO NOT REMOVE IF USING @nrwl/react:module-federation-dev-ssr executor
* DO NOT REMOVE IF USING @nx/react:module-federation-dev-ssr executor
* to serve your Host application with this Remote application.
* This message allows Nx to determine when the Remote is ready to be
* consumed by the Host.

View File

@ -1,6 +1,6 @@
const { composePlugins, withNx } = require('@nrwl/webpack');
const { withReact } = require('@nrwl/react');
const { withModuleFederationForSSR } = require('@nrwl/react/module-federation');
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const { withModuleFederationForSSR } = require('@nx/react/module-federation');
const baseConfig = require("./module-federation.server.config");

View File

@ -1,6 +1,6 @@
const { composePlugins, withNx } = require('@nrwl/webpack');
const { withReact } = require('@nrwl/react');
const { withModuleFederation } = require('@nrwl/react/module-federation');
const { composePlugins, withNx } = require('@nx/webpack');
const { withReact } = require('@nx/react');
const { withModuleFederation } = require('@nx/react/module-federation');
const baseConfig = require('./module-federation.config');

View File

@ -52,7 +52,7 @@ export function updateHostWithRemote(
} else {
// TODO(jack): Point to the nx.dev guide when ready.
logger.warn(
`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nrwl/react:host"?`
`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nx/react:host"?`
);
}
@ -70,7 +70,7 @@ export function updateHostWithRemote(
);
} else {
logger.warn(
`Could not find remote definitions at ${remoteDefsPath}. Did you generate this project with "@nrwl/react:host"?`
`Could not find remote definitions at ${remoteDefsPath}. Did you generate this project with "@nx/react:host"?`
);
}
@ -91,7 +91,7 @@ export function updateHostWithRemote(
);
} else {
logger.warn(
`Could not find app component at ${appComponentPath}. Did you generate this project with "@nrwl/react:host"?`
`Could not find app component at ${appComponentPath}. Did you generate this project with "@nx/react:host"?`
);
}
}

View File

@ -4,7 +4,7 @@ import { Linter } from '@nx/linter';
import remote from './remote';
describe('remote generator', () => {
it('should install @nrwl/web for the file-server executor', async () => {
it('should install @nx/web for the file-server executor', async () => {
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
await remote(tree, {
name: 'test',
@ -17,7 +17,7 @@ describe('remote generator', () => {
});
const packageJson = readJson(tree, 'package.json');
expect(packageJson.devDependencies['@nrwl/web']).toBeDefined();
expect(packageJson.devDependencies['@nx/web']).toBeDefined();
});
it('should not set the remote as the default project', async () => {

View File

@ -108,7 +108,7 @@ export async function setupSsrGenerator(tree: Tree, options: Schema) {
...projectConfig.targets,
server: {
dependsOn: ['build'],
executor: '@nrwl/webpack:webpack',
executor: '@nx/webpack:webpack',
outputs: ['{options.outputPath}'],
defaultConfiguration: 'production',
options: {
@ -140,7 +140,7 @@ export async function setupSsrGenerator(tree: Tree, options: Schema) {
},
'serve-browser': projectConfig.targets.serve,
'serve-server': {
executor: '@nrwl/js:node',
executor: '@nx/js:node',
defaultConfiguration: 'development',
options: {
buildTarget: `${options.project}:server:development`,
@ -156,7 +156,7 @@ export async function setupSsrGenerator(tree: Tree, options: Schema) {
},
},
serve: {
executor: '@nrwl/webpack:ssr-dev-server',
executor: '@nx/webpack:ssr-dev-server',
defaultConfiguration: 'development',
options: {
browserTarget: `${options.project}:build:development`,

View File

@ -1,4 +1,4 @@
const { createGlobPatternsForDependencies } = require('@nrwl/react/tailwind');
const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
const { join } = require('path');
/** @type {import('tailwindcss').Config} */

View File

@ -8,7 +8,10 @@ export function updateProject(
config: ProjectConfiguration,
options: SetupTailwindOptions
) {
if (config?.targets?.build?.executor === '@nrwl/webpack:webpack') {
if (
config?.targets?.build?.executor === '@nx/webpack:webpack' ||
config?.targets?.build?.executor === '@nrwl/webpack:webpack'
) {
config.targets.build.options ??= {};
config.targets.build.options.postcssConfig = joinPathFragments(
config.root,

View File

@ -49,7 +49,7 @@ describe('setup-tailwind', () => {
sourceRoot: 'apps/example/src',
targets: {
build: {
executor: '@nrwl/webpack:webpack',
executor: '@nx/webpack:webpack',
options: {},
},
},

View File

@ -70,8 +70,8 @@ export async function createTestUIApp(name: string): Promise<Tree> {
const config = readProjectConfiguration(tree, name);
config.sourceRoot = config.root;
config.targets.build.executor = '@nrwl/next:build';
config.targets.serve.executor = '@nrwl/next:server';
config.targets.build.executor = '@nx/next:build';
config.targets.serve.executor = '@nx/next:server';
updateProjectConfiguration(tree, name, config);
return tree;

View File

@ -129,7 +129,7 @@ describe('react:storybook-configuration', () => {
});
// Currently the auto-generate stories feature only picks up components under the 'lib' directory.
// In our 'createTestAppLib' function, we call @nrwl/react:component to generate a component
// In our 'createTestAppLib' function, we call @nx/react:component to generate a component
// under the specified 'lib' directory
expect(
appTree.exists(

View File

@ -44,7 +44,8 @@ export async function storybookConfigurationGenerator(
if (
projectConfig.projectType === 'application' &&
projectConfig.targets['build']?.executor === '@nrwl/vite:build'
(projectConfig.targets['build']?.executor === '@nx/vite:build' ||
projectConfig.targets['build']?.executor === '@nrwl/vite:build')
) {
bundler = 'vite';
if (schema.bundler !== 'vite') {

View File

@ -17,7 +17,7 @@ export function loadModuleFederationConfigFromContext(
} catch {
// TODO(jack): Add a link to guide
throw new Error(
`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nrwl/react:host"?`
`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/react:host"?`
);
}
}

View File

@ -29,12 +29,12 @@ export function updateModuleFederationProject(
};
projectConfig.targets.serve.executor =
'@nrwl/react:module-federation-dev-server';
'@nx/react:module-federation-dev-server';
projectConfig.targets.serve.options.port = options.devServerPort;
// `serve-static` for remotes that don't need to be in development mode
projectConfig.targets['serve-static'] = {
executor: '@nrwl/web:file-server',
executor: '@nx/web:file-server',
defaultConfiguration: 'development',
options: {
buildTarget: `${options.projectName}:build`,
@ -52,5 +52,5 @@ export function updateModuleFederationProject(
updateProjectConfiguration(host, options.projectName, projectConfig);
return addDependenciesToPackageJson(host, {}, { '@nrwl/web': nxVersion });
return addDependenciesToPackageJson(host, {}, { '@nx/web': nxVersion });
}

View File

@ -2,10 +2,10 @@ export function updateJestConfigContent(content: string) {
return content
.replace(
'transform: {',
"transform: {\n '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',"
"transform: {\n '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',"
)
.replace(
`'babel-jest'`,
`['babel-jest', { presets: ['@nrwl/react/babel'] }]`
`['babel-jest', { presets: ['@nx/react/babel'] }]`
);
}

View File

@ -21,7 +21,7 @@ export const extendReactEslintJson = (json: Linter.Config) => {
const { extends: pluginExtends, ...config } = json;
return {
extends: ['plugin:@nrwl/nx/react', ...(pluginExtends || [])],
extends: ['plugin:@nx/nx/react', ...(pluginExtends || [])],
...config,
};
};
@ -34,7 +34,7 @@ export const createReactEslintJson = (
setParserOptionsProject: boolean
): Linter.Config => ({
extends: [
'plugin:@nrwl/nx/react',
'plugin:@nx/nx/react',
`${offsetFromRoot(projectRoot)}.eslintrc.json`,
],
ignorePatterns: ['!**/*'],

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