Skip to content

Commit

Permalink
fix(core): convert to monorepo generator should respect nested libs
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham committed Aug 24, 2023
1 parent 12db1e0 commit 3b1cf2e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,34 @@ describe('monorepo generator', () => {
expect(tree.exists('.eslintrc.base.json')).toBeTruthy();
});

it('should respect nested libraries', async () => {
await reactAppGenerator(tree, {
name: 'demo',
style: 'css',
bundler: 'vite',
unitTestRunner: 'vitest',
e2eTestRunner: 'none',
linter: 'eslint',
rootProject: true,
});

await libraryGenerator(tree, {
name: 'my-lib',
directory: 'inner',
style: 'css',
bundler: 'vite',
unitTestRunner: 'none',
e2eTestRunner: 'none',
linter: 'eslint',
rootProject: true,
});

await monorepoGenerator(tree, {});

expect(tree.exists('libs/inner/my-lib/tsconfig.json')).toBeTruthy();
expect(tree.exists('libs/inner/my-lib/src/index.ts')).toBeTruthy();
});

it('should convert root React app (Webpack, Jest)', async () => {
await reactAppGenerator(tree, {
name: 'demo',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ export async function monorepoGenerator(tree: Tree, options: {}) {
for (const project of projectsToMove) {
await moveGenerator(tree, {
projectName: project.name,
newProjectName: project.name,
newProjectName:
project.projectType === 'application' ? project.name : project.root,
destination:
project.projectType === 'application'
? joinPathFragments(appsDir, project.name)
: joinPathFragments(libsDir, project.name),
: joinPathFragments(libsDir, project.root === '.' ? project.name : project.root),
destinationRelativeToRoot: true,
updateImportPath: project.projectType === 'library',
});
Expand Down

0 comments on commit 3b1cf2e

Please sign in to comment.