Skip to content

Commit

Permalink
fix(misc): move library without given importPath should default to co…
Browse files Browse the repository at this point in the history
…ntain slashes

`nx g mv --projectName lib/child-1 --destionation lib/child-2` would result in the ts-config and import paths of `@<project>/lib-child-2` when it is expected to be `@<project>/lib/child-2`

Closes #9281
  • Loading branch information
jordems committed Sep 4, 2022
1 parent a75e8f9 commit 475f63f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('normalizeSchema', () => {
it('should calculate importPath, projectName and relativeToRootDestination correctly', () => {
const expected: NormalizedSchema = {
destination: 'my/library',
importPath: '@proj/my-library',
importPath: '@proj/my/library',
newProjectName: 'my-library',
projectName: 'my-library',
relativeToRootDestination: 'libs/my/library',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ProjectConfiguration, Tree, getWorkspaceLayout } from '@nrwl/devkit';
import { getWorkspaceLayout, ProjectConfiguration, Tree } from '@nrwl/devkit';
import { getImportPath } from 'nx/src/utils/path';
import type { NormalizedSchema, Schema } from '../schema';
import { getDestination, getNewProjectName, normalizeSlashes } from './utils';
Expand All @@ -19,7 +19,7 @@ export function normalizeSchema(
destination,
importPath:
schema.importPath ??
normalizeSlashes(getImportPath(npmScope, newProjectName)),
normalizeSlashes(getImportPath(npmScope, destination)),
newProjectName,
relativeToRootDestination: getDestination(
tree,
Expand Down

0 comments on commit 475f63f

Please sign in to comment.