Skip to content

Commit

Permalink
feat(node): replace usages of @nrwl with @nx (nrwl#16379)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and peppoasap committed Apr 18, 2023
1 parent 0662083 commit aba3386
Show file tree
Hide file tree
Showing 22 changed files with 35 additions and 40 deletions.
2 changes: 1 addition & 1 deletion packages/express/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"rules": {
"no-restricted-imports": [
"error",
"@nrwl/workspace",
"@nx/workspace",
"@angular-devkit/core",
"@angular-devkit/architect",
"@angular-devkit/schematics"
Expand Down
2 changes: 1 addition & 1 deletion packages/express/generators.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Nx Express",
"version": "0.1",
"extends": ["@nrwl/workspace"],
"extends": ["@nx/workspace"],
"generators": {
"init": {
"factory": "./src/generators/init/init#initGenerator",
Expand Down
7 changes: 1 addition & 6 deletions packages/express/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,8 @@ server.on('error', console.error);
toJS(tree);
}
}
// TODO (nicholas): Remove After Nx 16
// @deprecated Use `nx g @nrwl/node:app --framework=express instead.
export async function applicationGenerator(tree: Tree, schema: Schema) {
console.warn(
'As of Nx 16 using `nx g @nrwl/express:app` has been deprecated! Use `nx g @nrwl/node:app --framework=express instead.'
);

export async function applicationGenerator(tree: Tree, schema: Schema) {
const options = normalizeOptions(tree, schema);
const initTask = await initGenerator(tree, { ...options, skipFormat: true });
const applicationTask = await nodeApplicationGenerator(tree, {
Expand Down
8 changes: 4 additions & 4 deletions packages/express/src/generators/init/init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('init', () => {
const existingVersion = '1.0.0';
addDependenciesToPackageJson(
tree,
{ '@nrwl/express': expressVersion, [existing]: existingVersion },
{ '@nx/express': expressVersion, [existing]: existingVersion },
{ [existing]: existingVersion }
);
await initGenerator(tree, {});
Expand All @@ -29,9 +29,9 @@ describe('init', () => {
expect(packageJson.dependencies['express']).toBeDefined();
// add tslib
expect(packageJson.dependencies['tslib']).toBeDefined();
// move `@nrwl/express` to dev
expect(packageJson.dependencies['@nrwl/express']).toBeUndefined();
expect(packageJson.devDependencies['@nrwl/express']).toBeDefined();
// move `@nx/express` to dev
expect(packageJson.dependencies['@nx/express']).toBeUndefined();
expect(packageJson.devDependencies['@nx/express']).toBeDefined();
// add express types
expect(packageJson.devDependencies['@types/express']).toBeDefined();
// keep existing packages
Expand Down
4 changes: 2 additions & 2 deletions packages/express/src/generators/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import type { Schema } from './schema';

function updateDependencies(tree: Tree) {
removeDependenciesFromPackageJson(tree, ['@nrwl/express'], []);
removeDependenciesFromPackageJson(tree, ['@nx/express'], []);

return addDependenciesToPackageJson(
tree,
Expand All @@ -25,7 +25,7 @@ function updateDependencies(tree: Tree) {
},
{
'@types/express': expressTypingsVersion,
'@nrwl/express': nxVersion,
'@nx/express': nxVersion,
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@angular-devkit/architect",
"@angular-devkit/core",
"@angular-devkit/schematics",
"@nrwl/workspace"
"@nx/workspace"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/generators.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nx/nest",
"version": "0.1",
"extends": ["@nrwl/workspace"],
"extends": ["@nx/workspace"],
"schematics": {
"application": {
"factory": "./src/generators/application/application#applicationSchematic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export async function conversionGenerator(
* to perform in order to convert a project from TSLint to ESLint, as well as some
* extensibility points for adjusting the behavior on a per package basis.
*
* E.g. @nrwl/angular projects might need to make different changes to the final
* ESLint config when compared with @nrwl/nest projects.
* E.g. @nx/angular projects might need to make different changes to the final
* ESLint config when compared with @nx/nest projects.
*
* See the ProjectConverter implementation for a full breakdown of what it does.
*/
Expand Down Expand Up @@ -113,7 +113,7 @@ export async function conversionGenerator(
/**
* Store user preferences for the collection
*/
projectConverter.setDefaults('@nrwl/nest', defaults);
projectConverter.setDefaults('@nx/nest', defaults);

/**
* Based on user preference and remaining usage, remove TSLint from the workspace entirely.
Expand Down
4 changes: 2 additions & 2 deletions packages/nest/src/generators/init/init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ describe('init generator', () => {
expect(packageJson.dependencies['reflect-metadata']).toBeDefined();
expect(packageJson.dependencies['rxjs']).toBeDefined();
expect(packageJson.dependencies['tslib']).toBeDefined();
expect(packageJson.dependencies['@nrwl/nest']).toBeUndefined();
expect(packageJson.dependencies['@nx/nest']).toBeUndefined();
expect(packageJson.devDependencies['@nestjs/schematics']).toBe(
nestJsVersion
);
expect(packageJson.devDependencies['@nestjs/testing']).toBe(nestJsVersion);
expect(packageJson.devDependencies['@nrwl/nest']).toBe(nxVersion);
expect(packageJson.devDependencies['@nx/nest']).toBe(nxVersion);
});

it('should add jest config when unitTestRunner is jest', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/src/generators/init/lib/add-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function addDependencies(tree: Tree): GeneratorCallback {
{
'@nestjs/schematics': nestJsVersion,
'@nestjs/testing': nestJsVersion,
'@nrwl/nest': nxVersion,
'@nx/nest': nxVersion,
}
);
}
2 changes: 1 addition & 1 deletion packages/nest/src/generators/library/lib/add-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function addProject(tree: Tree, options: NormalizedOptions): void {

const project = readProjectConfiguration(tree, options.projectName);
project.targets.build = {
executor: '@nrwl/js:tsc',
executor: '@nx/js:tsc',
outputs: ['{options.outputPath}'],
options: {
outputPath:
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('lib', () => {
).toMatchSnapshot();
});

it('should remove the default file from @nrwl/node:lib', async () => {
it('should remove the default file from @nx/node:lib', async () => {
await libraryGenerator(tree, { name: libName, global: true });

expect(
Expand Down
2 changes: 1 addition & 1 deletion packages/node/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"rules": {
"no-restricted-imports": [
"error",
"@nrwl/workspace",
"@nx/workspace",
"@angular-devkit/core",
"@angular-devkit/architect",
"@angular-devkit/schematics"
Expand Down
2 changes: 1 addition & 1 deletion packages/node/generators.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nx/node",
"version": "0.1",
"extends": ["@nrwl/workspace"],
"extends": ["@nx/workspace"],
"generators": {
"init": {
"factory": "./src/generators/init/init",
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/executors/webpack/webpack.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function* webpackExecutor(
context: ExecutorContext
) {
logger.warn(
'"@nrwl/node:webpack" executor is deprecated. Use "@nrwl/webpack:webpack" instead in your project.json.'
'"@nx/node:webpack" executor is deprecated. Use "@nx/webpack:webpack" instead in your project.json.'
);
yield* baseWebpackExecutor(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('app', () => {
},
},
serve: {
executor: '@nrwl/js:node',
executor: '@nx/js:node',
defaultConfiguration: 'development',
options: {
buildTarget: 'my-node-app:build',
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function getEsBuildConfig(

function getServeConfig(options: NormalizedSchema): TargetConfiguration {
return {
executor: '@nrwl/js:node',
executor: '@nx/js:node',
defaultConfiguration: 'development',
options: {
buildTarget: `${options.name}:build`,
Expand Down Expand Up @@ -298,7 +298,7 @@ function addProjectDependencies(
'@nx/webpack': nxVersion,
},
esbuild: {
'@nrwl/esbuild': nxVersion,
'@nx/esbuild': nxVersion,
esbuild: esbuildVersion,
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { composePlugins, withNx} = require('@nrwl/webpack');
const { composePlugins, withNx} = require('@nx/webpack');

// Nx plugins for webpack.
module.exports = composePlugins(withNx(), (config) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/node/src/generators/init/init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('init', () => {
addDependenciesToPackageJson(
tree,
{
'@nrwl/node': nxVersion,
'@nx/node': nxVersion,
[existing]: existingVersion,
},
{
Expand All @@ -33,10 +33,10 @@ describe('init', () => {
await initGenerator(tree, {});

const packageJson = readJson(tree, 'package.json');
expect(packageJson.dependencies['@nrwl/node']).toBeUndefined();
expect(packageJson.dependencies['@nx/node']).toBeUndefined();
expect(packageJson.dependencies['tslib']).toBeDefined();
expect(packageJson.dependencies[existing]).toBeDefined();
expect(packageJson.devDependencies['@nrwl/node']).toBeDefined();
expect(packageJson.devDependencies['@nx/node']).toBeDefined();
expect(packageJson.devDependencies[existing]).toBeDefined();
});

Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/generators/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import {
import { Schema } from './schema';

function updateDependencies(tree: Tree) {
removeDependenciesFromPackageJson(tree, ['@nrwl/node'], []);
removeDependenciesFromPackageJson(tree, ['@nx/node'], []);

return addDependenciesToPackageJson(
tree,
{
tslib: tslibVersion,
},
{ '@nrwl/node': nxVersion, '@types/node': typesNodeVersion }
{ '@nx/node': nxVersion, '@types/node': typesNodeVersion }
);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/node/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ describe('lib', () => {

const { build } = readProjectConfiguration(tree, 'my-lib').targets;

expect(build.executor).toEqual('@nrwl/js:tsc');
expect(build.executor).toEqual('@nx/js:tsc');
});

it('should specify swc as compiler', async () => {
Expand All @@ -323,7 +323,7 @@ describe('lib', () => {

const { build } = readProjectConfiguration(tree, 'my-lib').targets;

expect(build.executor).toEqual('@nrwl/js:swc');
expect(build.executor).toEqual('@nx/js:swc');
});
});

Expand Down Expand Up @@ -361,7 +361,7 @@ describe('lib', () => {

expect(projectConfiguration.targets.build).toMatchInlineSnapshot(`
{
"executor": "@nrwl/js:tsc",
"executor": "@nx/js:tsc",
"options": {
"assets": [
"libs/my-lib/*.md",
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function updateProject(tree: Tree, options: NormalizedSchema) {

project.targets = project.targets || {};
project.targets.build = {
executor: `@nrwl/js:${options.compiler}`,
executor: `@nx/js:${options.compiler}`,
outputs: ['{options.outputPath}'],
options: {
outputPath: joinPathFragments(
Expand Down

0 comments on commit aba3386

Please sign in to comment.