fix(core): convert to monorepo generator should respect nested libs (#18795)
This commit is contained in:
parent
e3b513b6c0
commit
413e57f99a
@ -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',
|
||||
|
||||
@ -34,11 +34,15 @@ 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',
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user