Skip to content

Commit

Permalink
Revert "Revert "fix(misc): move library without given importPath shou…
Browse files Browse the repository at this point in the history
…ld default to contain slashes (#11869)""

This reverts commit 33c0f94.
  • Loading branch information
FrozenPandaz committed Sep 23, 2022
1 parent 231429b commit c8de6f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Tree } from '@nrwl/devkit';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import { Linter } from '@nrwl/linter';
import { moveGenerator } from '@nrwl/workspace/generators';
import { UnitTestRunner } from '../../../utils/test-runners';
import libraryGenerator from '../../library/library';
import { Schema } from '../schema';
import { updateModuleName } from './update-module-name';
import libraryGenerator from '../../library/library';
import { Linter } from '@nrwl/linter';
import { UnitTestRunner } from '../../../utils/test-runners';

describe('updateModuleName Rule', () => {
let tree: Tree;
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('updateModuleName Rule', () => {

const importerFile = tree.read(secondModulePath).toString('utf-8');
expect(importerFile).toContain(
`import { SharedMyFirstModule } from '@proj/shared-my-first';`
`import { SharedMyFirstModule } from '@proj/shared/my-first';`
);
expect(importerFile).toContain(
`export class MySecondModule extends SharedMyFirstModule {}`
Expand Down
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 c8de6f1

Please sign in to comment.