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": [ "presets": [
[ [
"@nrwl/js/babel", "@nx/js/babel",
{ {
"useBuiltIns": "usage" "useBuiltIns": "usage"
} }

View File

@ -20,7 +20,7 @@ module.exports = function (api: any, options: NxWebBabelPresetOptions = {}) {
const isModern = api.caller((caller) => caller?.isModern); 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 isNxPackage = api.caller((caller) => caller?.isNxPackage);
const emitDecoratorMetadata = api.caller( const emitDecoratorMetadata = api.caller(

View File

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

View File

@ -50,9 +50,13 @@ function updateProjectBuildTargets(
) { ) {
for (const target of projectTargets) { for (const target of projectTargets) {
const targetConfiguration = projectConfiguration.targets[target]; 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; continue;
targetConfiguration.executor = '@nrwl/js:swc'; targetConfiguration.executor = '@nx/js:swc';
} }
updateProjectConfiguration(tree, projectName, projectConfiguration); updateProjectConfiguration(tree, projectName, projectConfiguration);

View File

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

View File

@ -756,7 +756,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib'); const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({ expect(config.targets.build).toEqual({
executor: '@nrwl/js:tsc', executor: '@nx/js:tsc',
options: { options: {
assets: ['libs/my-lib/*.md'], assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts', main: 'libs/my-lib/src/index.ts',
@ -776,7 +776,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib'); const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({ expect(config.targets.build).toEqual({
executor: '@nrwl/js:swc', executor: '@nx/js:swc',
options: { options: {
assets: ['libs/my-lib/*.md'], assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts', main: 'libs/my-lib/src/index.ts',
@ -830,7 +830,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib'); const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({ expect(config.targets.build).toEqual({
executor: '@nrwl/js:tsc', executor: '@nx/js:tsc',
options: { options: {
assets: ['libs/my-lib/*.md'], assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts', main: 'libs/my-lib/src/index.ts',
@ -851,7 +851,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib'); const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({ expect(config.targets.build).toEqual({
executor: '@nrwl/js:swc', executor: '@nx/js:swc',
options: { options: {
assets: ['libs/my-lib/*.md'], assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts', main: 'libs/my-lib/src/index.ts',
@ -935,7 +935,7 @@ describe('lib', () => {
const config = readProjectConfiguration(tree, 'my-lib'); const config = readProjectConfiguration(tree, 'my-lib');
expect(config.targets.build).toEqual({ expect(config.targets.build).toEqual({
executor: '@nrwl/js:tsc', executor: '@nx/js:tsc',
options: { options: {
assets: ['libs/my-lib/*.md'], assets: ['libs/my-lib/*.md'],
main: 'libs/my-lib/src/index.ts', main: 'libs/my-lib/src/index.ts',
@ -1011,7 +1011,7 @@ describe('lib', () => {
expect(tree.exists('libs/my-lib/.babelrc')).toBeFalsy(); 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) => { updateJson(tree, 'package.json', (json) => {
json.devDependencies = {}; json.devDependencies = {};
return json; return json;
@ -1030,7 +1030,7 @@ describe('lib', () => {
{ {
"presets": [ "presets": [
[ [
"@nrwl/js/babel", "@nx/js/babel",
{ {
"useBuiltIns": "usage", "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) => { updateJson(tree, 'package.json', (json) => {
json.devDependencies = { json.devDependencies = {
'@nrwl/angular': '1.1.1', '@nx/angular': '1.1.1',
'@nrwl/next': '1.1.1', '@nx/next': '1.1.1',
}; };
return json; return json;
}); });

View File

@ -267,7 +267,7 @@ function addBabelRc(tree: Tree, options: NormalizedSchema) {
const filename = '.babelrc'; const filename = '.babelrc';
const babelrc = { const babelrc = {
presets: [['@nrwl/js/babel', { useBuiltIns: 'usage' }]], presets: [['@nx/js/babel', { useBuiltIns: 'usage' }]],
}; };
writeJson(tree, join(options.projectRoot, filename), babelrc); 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. * 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. * 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'; options.bundler = options.bundler ?? options.compiler ?? 'tsc';
@ -534,7 +534,7 @@ function addProjectDependencies(
tree, tree,
{}, {},
{ {
'@nrwl/esbuild': nxVersion, '@nx/esbuild': nxVersion,
'@types/node': typesNodeVersion, '@types/node': typesNodeVersion,
esbuild: esbuildVersion, esbuild: esbuildVersion,
} }
@ -558,14 +558,14 @@ function addProjectDependencies(
function getBuildExecutor(bundler: Bundler) { function getBuildExecutor(bundler: Bundler) {
switch (bundler) { switch (bundler) {
case 'esbuild': case 'esbuild':
return `@nrwl/esbuild:esbuild`; return `@nx/esbuild:esbuild`;
case 'rollup': case 'rollup':
return `@nrwl/rollup:rollup`; return `@nx/rollup:rollup`;
case 'swc': case 'swc':
case 'tsc': case 'tsc':
return `@nrwl/js:${bundler}`; return `@nx/js:${bundler}`;
case 'vite': case 'vite':
return `@nrwl/vite:build`; return `@nx/vite:build`;
case 'none': case 'none':
default: default:
return undefined; return undefined;

View File

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

View File

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

View File

@ -10,7 +10,7 @@ const publishScriptContent = `
* You might need to authenticate with NPM before running this script. * 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 { execSync } from 'child_process';
import { readFileSync, writeFileSync } from 'fs'; import { readFileSync, writeFileSync } from 'fs';
import chalk from 'chalk'; import chalk from 'chalk';

View File

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

View File

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

View File

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

View File

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

View File

@ -224,7 +224,7 @@ describe('app', () => {
}); });
expect(tree.read('apps/my-app/jest.config.ts', 'utf-8')).toContain( 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'); const projectConfiguration = readProjectConfiguration(tree, 'my-app');
expect(projectConfiguration.targets.build.executor).toEqual( expect(projectConfiguration.targets.build.executor).toEqual(
'@nrwl/next:build' '@nx/next:build'
); );
expect(projectConfiguration.targets.build.options).toEqual({ expect(projectConfiguration.targets.build.options).toEqual({
root: 'apps/my-app', root: 'apps/my-app',
@ -252,7 +252,7 @@ describe('app', () => {
const projectConfiguration = readProjectConfiguration(tree, 'my-app'); const projectConfiguration = readProjectConfiguration(tree, 'my-app');
expect(projectConfiguration.targets.serve.executor).toEqual( expect(projectConfiguration.targets.serve.executor).toEqual(
'@nrwl/next:server' '@nx/next:server'
); );
expect(projectConfiguration.targets.serve.options).toEqual({ expect(projectConfiguration.targets.serve.options).toEqual({
buildTarget: 'my-app:build', buildTarget: 'my-app:build',
@ -275,7 +275,7 @@ describe('app', () => {
const projectConfiguration = readProjectConfiguration(tree, 'my-app'); const projectConfiguration = readProjectConfiguration(tree, 'my-app');
expect(projectConfiguration.targets.export.executor).toEqual( expect(projectConfiguration.targets.export.executor).toEqual(
'@nrwl/next:export' '@nx/next:export'
); );
expect(projectConfiguration.targets.export.options).toEqual({ expect(projectConfiguration.targets.export.options).toEqual({
buildTarget: 'my-app:build:production', buildTarget: 'my-app:build:production',
@ -339,7 +339,7 @@ describe('app', () => {
"jest": true, "jest": true,
}, },
"extends": [ "extends": [
"plugin:@nrwl/nx/react-typescript", "plugin:@nx/nx/react-typescript",
"next", "next",
"next/core-web-vitals", "next/core-web-vitals",
"../../.eslintrc.json", "../../.eslintrc.json",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,11 +13,8 @@ export function updateJestConfig(host: Tree, options: NormalizedSchema) {
const content = originalContent const content = originalContent
.replace( .replace(
'transform: {', '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( .replace(`'babel-jest'`, `['babel-jest', { presets: ['@nx/next/babel'] }]`);
`'babel-jest'`,
`['babel-jest', { presets: ['@nrwl/next/babel'] }]`
);
host.write(configPath, content); host.write(configPath, content);
} }

View File

@ -17,9 +17,12 @@ export async function customServerGenerator(
): Promise<void> { ): Promise<void> {
const project = readProjectConfiguration(host, options.project); 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( 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; return;
} }
@ -34,7 +37,7 @@ export async function customServerGenerator(
!project.targets?.build?.configurations?.production !project.targets?.build?.configurations?.production
) { ) {
logger.error( 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; return;
} }
@ -62,7 +65,7 @@ export async function customServerGenerator(
project.targets.serve.configurations.production.customServerTarget = `${options.project}:serve-custom-server:production`; project.targets.serve.configurations.production.customServerTarget = `${options.project}:serve-custom-server:production`;
project.targets['build-custom-server'] = { project.targets['build-custom-server'] = {
executor: '@nrwl/js:tsc', executor: '@nx/js:tsc',
defaultConfiguration: 'production', defaultConfiguration: 'production',
options: { options: {
outputPath, outputPath,
@ -78,7 +81,7 @@ export async function customServerGenerator(
}; };
project.targets['serve-custom-server'] = { project.targets['serve-custom-server'] = {
executor: '@nrwl/js:node', executor: '@nx/js:node',
defaultConfiguration: 'development', defaultConfiguration: 'development',
options: { options: {
buildTarget: `${options.project}:build-custom-server`, buildTarget: `${options.project}:build-custom-server`,

View File

@ -12,7 +12,7 @@ import * as path from 'path';
import next from 'next'; import next from 'next';
// Next.js server options: // 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. // - The fallback `__dirname` is for production builds.
// - Feel free to change this to suit your needs. // - Feel free to change this to suit your needs.
const dir = process.env.NX_NEXT_DIR || path.join(__dirname, '..'); const dir = process.env.NX_NEXT_DIR || path.join(__dirname, '..');

View File

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

View File

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

View File

@ -13,7 +13,7 @@ describe('next library', () => {
let mockedInstalledCypressVersion: jest.Mock< let mockedInstalledCypressVersion: jest.Mock<
ReturnType<typeof installedCypressVersion> ReturnType<typeof installedCypressVersion>
> = installedCypressVersion as never; > = 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 = { const baseOptions: Schema = {
name: '', name: '',
linter: Linter.EsLint, linter: Linter.EsLint,
@ -47,13 +47,13 @@ describe('next library', () => {
}); });
expect(readJson(appTree, 'libs/my-lib/.babelrc')).toEqual({ expect(readJson(appTree, 'libs/my-lib/.babelrc')).toEqual({
presets: ['@nrwl/next/babel'], presets: ['@nx/next/babel'],
plugins: [], plugins: [],
}); });
expect(readJson(appTree, 'libs/my-lib2/.babelrc')).toEqual({ expect(readJson(appTree, 'libs/my-lib2/.babelrc')).toEqual({
presets: [ presets: [
[ [
'@nrwl/next/babel', '@nx/next/babel',
{ {
'preset-react': { 'preset-react': {
runtime: 'automatic', runtime: 'automatic',
@ -65,16 +65,16 @@ describe('next library', () => {
plugins: ['@emotion/babel-plugin'], plugins: ['@emotion/babel-plugin'],
}); });
expect(readJson(appTree, 'libs/my-lib-styled-jsx/.babelrc')).toEqual({ expect(readJson(appTree, 'libs/my-lib-styled-jsx/.babelrc')).toEqual({
presets: ['@nrwl/next/babel'], presets: ['@nx/next/babel'],
plugins: [], plugins: [],
}); });
expect(readJson(appTree, 'libs/my-dir/my-lib3/.babelrc')).toEqual({ expect(readJson(appTree, 'libs/my-dir/my-lib3/.babelrc')).toEqual({
presets: ['@nrwl/next/babel'], presets: ['@nx/next/babel'],
plugins: [], plugins: [],
}); });
}); });
it('should use @nrwl/next images.d.ts file', async () => { it('should use @nx/next images.d.ts file', async () => {
const baseOptions: Schema = { const baseOptions: Schema = {
name: '', name: '',
linter: Linter.EsLint, linter: Linter.EsLint,
@ -96,10 +96,10 @@ describe('next library', () => {
).files; ).files;
expect(tsconfigFiles).toContain( expect(tsconfigFiles).toContain(
'../../node_modules/@nrwl/next/typings/image.d.ts' '../../node_modules/@nx/next/typings/image.d.ts'
); );
expect(tsconfigFiles).not.toContain( 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') { if (options.style === '@emotion/styled') {
json.presets = [ json.presets = [
[ [
'@nrwl/next/babel', '@nx/next/babel',
{ {
'preset-react': { 'preset-react': {
runtime: 'automatic', runtime: 'automatic',
@ -77,12 +77,12 @@ export async function libraryGenerator(host: Tree, rawOptions: Schema) {
} else if (options.style === 'styled-jsx') { } else if (options.style === 'styled-jsx') {
// next.js doesn't require the `styled-jsx/babel' plugin as it is already // next.js doesn't require the `styled-jsx/babel' plugin as it is already
// built-into the `next/babel` preset // built-into the `next/babel` preset
json.presets = ['@nrwl/next/babel']; json.presets = ['@nx/next/babel'];
json.plugins = (json.plugins || []).filter( json.plugins = (json.plugins || []).filter(
(x) => x !== 'styled-jsx/babel' (x) => x !== 'styled-jsx/babel'
); );
} else { } else {
json.presets = ['@nrwl/next/babel']; json.presets = ['@nx/next/babel'];
} }
return json; return json;
} }
@ -109,8 +109,8 @@ export async function libraryGenerator(host: Tree, rawOptions: Schema) {
json.files = json.files.map((path: string) => { json.files = json.files.map((path: string) => {
if (path.endsWith('react/typings/image.d.ts')) { if (path.endsWith('react/typings/image.d.ts')) {
return path.replace( return path.replace(
'@nrwl/react/typings/image.d.ts', '@nx/react/typings/image.d.ts',
'@nrwl/next/typings/image.d.ts' '@nx/next/typings/image.d.ts'
); );
} }
return path; return path;

View File

@ -1,6 +1,7 @@
import { import {
readProjectConfiguration, readProjectConfiguration,
Tree, Tree,
updateJson,
updateProjectConfiguration, updateProjectConfiguration,
} from '@nx/devkit'; } from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
@ -22,6 +23,13 @@ describe('Migration: enable SWC', () => {
skipFormat: false, skipFormat: false,
swc: 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 // rename jest config to js as that was standard at this version of nx
tree.delete('apps/demo/jest.config.ts'); tree.delete('apps/demo/jest.config.ts');
updateProjectConfiguration(tree, 'demo', { updateProjectConfiguration(tree, 'demo', {

View File

@ -12,7 +12,7 @@ export function createGlobPatternsOfDependentProjects(
fileGlobPattern: string = '/**/!(*.stories|*.spec).tsx' fileGlobPattern: string = '/**/!(*.stories|*.spec).tsx'
): string[] { ): string[] {
logger.warn( 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 { try {

View File

@ -35,7 +35,7 @@ describe('NxPlugin Plugin Generator', () => {
const project = readProjectConfiguration(tree, 'my-plugin'); const project = readProjectConfiguration(tree, 'my-plugin');
expect(project.root).toEqual('libs/my-plugin'); expect(project.root).toEqual('libs/my-plugin');
expect(project.targets.build).toEqual({ expect(project.targets.build).toEqual({
executor: '@nrwl/js:tsc', executor: '@nx/js:tsc',
outputs: ['{options.outputPath}'], outputs: ['{options.outputPath}'],
options: { options: {
outputPath: 'dist/libs/my-plugin', outputPath: 'dist/libs/my-plugin',
@ -139,7 +139,7 @@ describe('NxPlugin Plugin Generator', () => {
const { build } = readProjectConfiguration(tree, 'my-plugin').targets; 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 () => { it('should specify swc as compiler', async () => {
@ -152,7 +152,7 @@ describe('NxPlugin Plugin Generator', () => {
const { build } = readProjectConfiguration(tree, 'my-plugin').targets; 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", "name": "Nx React Native",
"version": "0.1", "version": "0.1",
"extends": ["@nrwl/workspace"], "extends": ["@nx/workspace"],
"schematics": { "schematics": {
"init": { "init": {
"factory": "./src/generators/init/init#reactNativeInitSchematic", "factory": "./src/generators/init/init#reactNativeInitSchematic",

View File

@ -134,18 +134,6 @@
"version": "0.64.1", "version": "0.64.1",
"alwaysAddToPackageJson": false "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": { "@types/react": {
"version": "17.0.6", "version": "17.0.6",
"alwaysAddToPackageJson": false "alwaysAddToPackageJson": false
@ -191,14 +179,6 @@
"12.5.0": { "12.5.0": {
"version": "12.5.0-beta.0", "version": "12.5.0-beta.0",
"packages": { "packages": {
"@nrwl/jest": {
"version": "12.5.7",
"alwaysAddToPackageJson": false
},
"@nrwl/linter": {
"version": "12.5.7",
"alwaysAddToPackageJson": false
},
"react": { "react": {
"version": "17.0.2", "version": "17.0.2",
"alwaysAddToPackageJson": false "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 { getDefaultConfig } = require('metro-config');
const exclusionList = require('metro-config/src/defaults/exclusionList'); const exclusionList = require('metro-config/src/defaults/exclusionList');
@ -35,4 +35,4 @@ module.exports = (async () => {
watchFolders: [] watchFolders: []
} }
); );
})(); })();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -268,7 +268,7 @@ describe('lib', () => {
const projectConfiguration = readProjectConfiguration(appTree, 'my-lib'); const projectConfiguration = readProjectConfiguration(appTree, 'my-lib');
expect(projectConfiguration.targets.build).toMatchObject({ expect(projectConfiguration.targets.build).toMatchObject({
executor: '@nrwl/web:rollup', executor: '@nx/web:rollup',
outputs: ['{options.outputPath}'], outputs: ['{options.outputPath}'],
options: { options: {
external: ['react/jsx-runtime', 'react-native'], external: ['react/jsx-runtime', 'react-native'],
@ -276,7 +276,7 @@ describe('lib', () => {
outputPath: 'dist/libs/my-lib', outputPath: 'dist/libs/my-lib',
project: 'libs/my-lib/package.json', project: 'libs/my-lib/package.json',
tsConfig: 'libs/my-lib/tsconfig.lib.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']; const external = ['react/jsx-runtime', 'react-native'];
targets.build = { targets.build = {
executor: '@nrwl/web:rollup', executor: '@nx/web:rollup',
outputs: ['{options.outputPath}'], outputs: ['{options.outputPath}'],
options: { options: {
outputPath: `dist/${libsDir}/${options.projectDirectory}`, outputPath: `dist/${libsDir}/${options.projectDirectory}`,
@ -92,7 +92,7 @@ function addProject(host: Tree, options: NormalizedSchema) {
project: `${options.projectRoot}/package.json`, project: `${options.projectRoot}/package.json`,
entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`), entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`),
external, external,
rollupConfig: `@nrwl/react/plugins/bundle-rollup`, rollupConfig: `@nx/react/plugins/bundle-rollup`,
assets: [ assets: [
{ {
glob: `${options.projectRoot}/README.md`, glob: `${options.projectRoot}/README.md`,

View File

@ -1,7 +1,7 @@
import { Linter } from '@nx/linter'; 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 { export interface Schema {
name: string; 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. // 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 // under the specified 'lib' directory
expect( expect(
appTree.exists( appTree.exists(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,10 +14,13 @@ export function findAllNpmDependencies(
const node = graph.externalNodes[projectName]; 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. // autolink will warn that the package has no podspec file for iOS.
if (node) { 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); list.push(node.data.packageName);
} }
} else { } else {

View File

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

View File

@ -1,7 +1,7 @@
{ {
"name": "Nx React", "name": "Nx React",
"version": "0.1", "version": "0.1",
"extends": ["@nrwl/workspace"], "extends": ["@nx/workspace"],
"schematics": { "schematics": {
"init": { "init": {
"factory": "./src/generators/init/init#reactInitSchematic", "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) { function withSchemaDefaults(target: Target, context: ExecutorContext) {
const options = readTargetOptions(target, context); const options = readTargetOptions(target, context);
@ -213,7 +213,7 @@ function buildTargetWebpack(
return async () => { return async () => {
customWebpack = await customWebpack; 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, { const defaultWebpack = getWebpackConfig(context, {
...options, ...options,
root: workspaceRoot, root: workspaceRoot,

View File

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

View File

@ -63,7 +63,7 @@ export const webpack = async (
options: any options: any
): Promise<Configuration> => { ): Promise<Configuration> => {
logger.info( 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. // In case anyone is missing dep and did not run migrations.
// See: https://github.com/nrwl/nx/issues/14455 // See: https://github.com/nrwl/nx/issues/14455

View File

@ -4,7 +4,7 @@ import { withReact } from './with-react';
const legacyExport: any = withReact(); const legacyExport: any = withReact();
legacyExport.withReact = 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. // This is here for backward compatibility if anyone imports {getWebpackConfig} directly.
// TODO(jack): Remove in Nx 16 // TODO(jack): Remove in Nx 16
const getWebpackConfig = withReact(); const getWebpackConfig = withReact();

View File

@ -32,7 +32,7 @@ export default async function* moduleFederationDevServer(
} catch { } catch {
// TODO(jack): Add a link to guide // TODO(jack): Add a link to guide
throw new Error( 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 { } catch {
// TODO(jack): Add a link to guide // TODO(jack): Add a link to guide
throw new Error( 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(); expect(appTree.exists('apps/my-app/src/app/app.module.css')).toBeTruthy();
const jestConfig = appTree.read('apps/my-app/jest.config.ts').toString(); 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'); const tsconfig = readJson(appTree, 'apps/my-app/tsconfig.json');
expect(tsconfig.references).toEqual([ expect(tsconfig.references).toEqual([
@ -131,7 +131,7 @@ describe('app', () => {
const eslintJson = readJson(appTree, 'apps/my-app/.eslintrc.json'); const eslintJson = readJson(appTree, 'apps/my-app/.eslintrc.json');
expect(eslintJson.extends).toEqual([ expect(eslintJson.extends).toEqual([
'plugin:@nrwl/nx/react', 'plugin:@nx/nx/react',
'../../.eslintrc.json', '../../.eslintrc.json',
]); ]);
@ -247,7 +247,7 @@ describe('app', () => {
{ {
path: 'apps/my-dir/my-app/.eslintrc.json', path: 'apps/my-dir/my-app/.eslintrc.json',
lookupFn: (json) => json.extends, lookupFn: (json) => json.extends,
expectedValue: ['plugin:@nrwl/nx/react', '../../../.eslintrc.json'], expectedValue: ['plugin:@nx/nx/react', '../../../.eslintrc.json'],
}, },
].forEach(hasJsonValue); ].forEach(hasJsonValue);
}); });
@ -304,7 +304,7 @@ describe('app', () => {
await applicationGenerator(appTree, { ...schema, name: 'my-app' }); await applicationGenerator(appTree, { ...schema, name: 'my-app' });
expect(appTree.read('apps/my-app/jest.config.ts').toString()).toContain( 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 projectsConfigurations = getProjects(appTree);
const targetConfig = projectsConfigurations.get('my-app').targets; 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.outputs).toEqual(['{options.outputPath}']);
expect(targetConfig.build.options).toEqual({ expect(targetConfig.build.options).toEqual({
compiler: 'babel', compiler: 'babel',
@ -387,7 +387,7 @@ describe('app', () => {
const projectsConfigurations = getProjects(appTree); const projectsConfigurations = getProjects(appTree);
const targetConfig = projectsConfigurations.get('my-app').targets; 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({ expect(targetConfig.serve.options).toEqual({
buildTarget: 'my-app:build', buildTarget: 'my-app:build',
hmr: true, hmr: true,
@ -532,7 +532,7 @@ describe('app', () => {
expect(eslintJson).toMatchInlineSnapshot(` expect(eslintJson).toMatchInlineSnapshot(`
{ {
"extends": [ "extends": [
"plugin:@nrwl/nx/react", "plugin:@nx/nx/react",
"../../.eslintrc.json", "../../.eslintrc.json",
], ],
"ignorePatterns": [ "ignorePatterns": [
@ -609,7 +609,7 @@ describe('app', () => {
await applicationGenerator(appTree, { ...schema, style: 'none' }); await applicationGenerator(appTree, { ...schema, style: 'none' });
const nxJson = readNxJson(appTree); const nxJson = readNxJson(appTree);
expect(nxJson.generators['@nrwl/react']).toMatchObject({ expect(nxJson.generators['@nx/react']).toMatchObject({
application: { application: {
style: 'none', style: 'none',
}, },
@ -842,7 +842,7 @@ describe('app', () => {
}); });
const nxJson = readNxJson(appTree); const nxJson = readNxJson(appTree);
expect(nxJson.generators['@nrwl/react']).toMatchObject({ expect(nxJson.generators['@nx/react']).toMatchObject({
application: { application: {
babel: true, babel: true,
style: 'styled-components', style: 'styled-components',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ export function installCommonDependencies(
let devDependencies = null; let devDependencies = null;
// Vite requires style preprocessors to be installed manually. // 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 // TODO(jack): Once we clean up webpack we can remove this check
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') { if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
switch (options.style) { switch (options.style) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@ describe('hostGenerator', () => {
expect(tree.exists('apps/test/src/remotes.d.ts')); 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' }); const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
await hostGenerator(tree, { await hostGenerator(tree, {
name: 'test', name: 'test',
@ -39,7 +39,7 @@ describe('hostGenerator', () => {
}); });
const packageJson = readJson(tree, 'package.json'); 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 () => { it('should generate host files and configs for SSR', async () => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ export async function addRollupBuildTarget(
nxVersion nxVersion
); );
// These are used in `@nrwl/react/plugins/bundle-rollup` // These are used in `@nx/react/plugins/bundle-rollup`
addDependenciesToPackageJson( addDependenciesToPackageJson(
host, host,
{}, {},
@ -47,7 +47,7 @@ export async function addRollupBuildTarget(
} }
targets.build = { targets.build = {
executor: '@nrwl/rollup:rollup', executor: '@nx/rollup:rollup',
outputs: ['{options.outputPath}'], outputs: ['{options.outputPath}'],
options: { options: {
outputPath: outputPath:
@ -58,7 +58,7 @@ export async function addRollupBuildTarget(
project: `${options.projectRoot}/package.json`, project: `${options.projectRoot}/package.json`,
entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`), entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`),
external, external,
rollupConfig: `@nrwl/react/plugins/bundle-rollup`, rollupConfig: `@nx/react/plugins/bundle-rollup`,
compiler: options.compiler ?? 'babel', compiler: options.compiler ?? 'babel',
assets: [ assets: [
{ {

View File

@ -22,7 +22,7 @@ export function installCommonDependencies(
const devDependencies = {}; const devDependencies = {};
// Vite requires style preprocessors to be installed manually. // 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 // TODO(jack): Once we clean up webpack we can remove this check
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') { if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
switch (options.style) { switch (options.style) {

View File

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

View File

@ -194,7 +194,7 @@ describe('lib', () => {
expect(eslintJson).toMatchInlineSnapshot(` expect(eslintJson).toMatchInlineSnapshot(`
{ {
"extends": [ "extends": [
"plugin:@nrwl/nx/react", "plugin:@nx/nx/react",
"../../.eslintrc.json", "../../.eslintrc.json",
], ],
"ignorePatterns": [ "ignorePatterns": [
@ -235,7 +235,7 @@ describe('lib', () => {
compiler: 'babel', compiler: 'babel',
}); });
expect(tree.read('libs/my-lib/jest.config.ts', 'utf-8')).toContain( 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', compiler: 'babel',
}); });
expect(tree.read('libs/my-dir/my-lib/jest.config.ts', 'utf-8')).toContain( 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); const projectsConfigurations = getProjects(tree);
expect(projectsConfigurations.get('my-lib').targets.build).toMatchObject({ expect(projectsConfigurations.get('my-lib').targets.build).toMatchObject({
executor: '@nrwl/rollup:rollup', executor: '@nx/rollup:rollup',
outputs: ['{options.outputPath}'], outputs: ['{options.outputPath}'],
options: { options: {
external: ['react/jsx-runtime'], external: ['react/jsx-runtime'],
@ -501,7 +501,7 @@ describe('lib', () => {
outputPath: 'dist/libs/my-lib', outputPath: 'dist/libs/my-lib',
project: 'libs/my-lib/package.json', project: 'libs/my-lib/package.json',
tsConfig: 'libs/my-lib/tsconfig.lib.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}`); 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. * to serve your Host application with this Remote application.
* This message allows Nx to determine when the Remote is ready to be * This message allows Nx to determine when the Remote is ready to be
* consumed by the Host. * consumed by the Host.

View File

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

View File

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

View File

@ -52,7 +52,7 @@ export function updateHostWithRemote(
} else { } else {
// TODO(jack): Point to the nx.dev guide when ready. // TODO(jack): Point to the nx.dev guide when ready.
logger.warn( 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 { } else {
logger.warn( 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 { } else {
logger.warn( 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'; import remote from './remote';
describe('remote generator', () => { 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' }); const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
await remote(tree, { await remote(tree, {
name: 'test', name: 'test',
@ -17,7 +17,7 @@ describe('remote generator', () => {
}); });
const packageJson = readJson(tree, 'package.json'); 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 () => { 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, ...projectConfig.targets,
server: { server: {
dependsOn: ['build'], dependsOn: ['build'],
executor: '@nrwl/webpack:webpack', executor: '@nx/webpack:webpack',
outputs: ['{options.outputPath}'], outputs: ['{options.outputPath}'],
defaultConfiguration: 'production', defaultConfiguration: 'production',
options: { options: {
@ -140,7 +140,7 @@ export async function setupSsrGenerator(tree: Tree, options: Schema) {
}, },
'serve-browser': projectConfig.targets.serve, 'serve-browser': projectConfig.targets.serve,
'serve-server': { 'serve-server': {
executor: '@nrwl/js:node', executor: '@nx/js:node',
defaultConfiguration: 'development', defaultConfiguration: 'development',
options: { options: {
buildTarget: `${options.project}:server:development`, buildTarget: `${options.project}:server:development`,
@ -156,7 +156,7 @@ export async function setupSsrGenerator(tree: Tree, options: Schema) {
}, },
}, },
serve: { serve: {
executor: '@nrwl/webpack:ssr-dev-server', executor: '@nx/webpack:ssr-dev-server',
defaultConfiguration: 'development', defaultConfiguration: 'development',
options: { options: {
browserTarget: `${options.project}:build:development`, 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'); const { join } = require('path');
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */

View File

@ -8,7 +8,10 @@ export function updateProject(
config: ProjectConfiguration, config: ProjectConfiguration,
options: SetupTailwindOptions 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 ??= {};
config.targets.build.options.postcssConfig = joinPathFragments( config.targets.build.options.postcssConfig = joinPathFragments(
config.root, config.root,

View File

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

View File

@ -70,8 +70,8 @@ export async function createTestUIApp(name: string): Promise<Tree> {
const config = readProjectConfiguration(tree, name); const config = readProjectConfiguration(tree, name);
config.sourceRoot = config.root; config.sourceRoot = config.root;
config.targets.build.executor = '@nrwl/next:build'; config.targets.build.executor = '@nx/next:build';
config.targets.serve.executor = '@nrwl/next:server'; config.targets.serve.executor = '@nx/next:server';
updateProjectConfiguration(tree, name, config); updateProjectConfiguration(tree, name, config);
return tree; 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. // 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 // under the specified 'lib' directory
expect( expect(
appTree.exists( appTree.exists(

View File

@ -44,7 +44,8 @@ export async function storybookConfigurationGenerator(
if ( if (
projectConfig.projectType === 'application' && 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'; bundler = 'vite';
if (schema.bundler !== 'vite') { if (schema.bundler !== 'vite') {

View File

@ -17,7 +17,7 @@ export function loadModuleFederationConfigFromContext(
} catch { } catch {
// TODO(jack): Add a link to guide // TODO(jack): Add a link to guide
throw new Error( 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 = projectConfig.targets.serve.executor =
'@nrwl/react:module-federation-dev-server'; '@nx/react:module-federation-dev-server';
projectConfig.targets.serve.options.port = options.devServerPort; projectConfig.targets.serve.options.port = options.devServerPort;
// `serve-static` for remotes that don't need to be in development mode // `serve-static` for remotes that don't need to be in development mode
projectConfig.targets['serve-static'] = { projectConfig.targets['serve-static'] = {
executor: '@nrwl/web:file-server', executor: '@nx/web:file-server',
defaultConfiguration: 'development', defaultConfiguration: 'development',
options: { options: {
buildTarget: `${options.projectName}:build`, buildTarget: `${options.projectName}:build`,
@ -52,5 +52,5 @@ export function updateModuleFederationProject(
updateProjectConfiguration(host, options.projectName, projectConfig); 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 return content
.replace( .replace(
'transform: {', '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( .replace(
`'babel-jest'`, `'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; const { extends: pluginExtends, ...config } = json;
return { return {
extends: ['plugin:@nrwl/nx/react', ...(pluginExtends || [])], extends: ['plugin:@nx/nx/react', ...(pluginExtends || [])],
...config, ...config,
}; };
}; };
@ -34,7 +34,7 @@ export const createReactEslintJson = (
setParserOptionsProject: boolean setParserOptionsProject: boolean
): Linter.Config => ({ ): Linter.Config => ({
extends: [ extends: [
'plugin:@nrwl/nx/react', 'plugin:@nx/nx/react',
`${offsetFromRoot(projectRoot)}.eslintrc.json`, `${offsetFromRoot(projectRoot)}.eslintrc.json`,
], ],
ignorePatterns: ['!**/*'], ignorePatterns: ['!**/*'],

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