Skip to content

Commit

Permalink
fix(nest): ensure dependencies are installed when generating nest lib…
Browse files Browse the repository at this point in the history
…raries
  • Loading branch information
jaysoo committed Feb 2, 2024
1 parent 0f3e860 commit bf2b559
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion e2e/node/src/node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ ${jslib}();
);
}, 60000);

it('should be able to generate a nest library w/ service', async () => {
it('xyz should be able to generate a nest library w/ service', async () => {
const nestlib = uniq('nestlib');

runCLI(`generate @nx/nest:lib ${nestlib} --service`);
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { applicationGenerator as nodeApplicationGenerator } from '@nx/node';
import { initGenerator } from '../init/init';
import {
createFiles,
ensureDependencies,
normalizeOptions,
toNodeApplicationGeneratorOptions,
updateTsConfig,
} from './lib';
import type { ApplicationGeneratorOptions } from './schema';
import { ensureDependencies } from '../../utils/ensure-dependencies';

export async function applicationGenerator(
tree: Tree,
Expand Down
1 change: 0 additions & 1 deletion packages/nest/src/generators/application/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './create-files';
export * from './ensure-dependencies';
export * from './normalize-options';
export * from './update-tsconfig';
4 changes: 3 additions & 1 deletion packages/nest/src/generators/library/library.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { GeneratorCallback, Tree } from '@nx/devkit';
import { formatFiles, runTasksInSerial } from '@nx/devkit';
import { libraryGenerator as jsLibraryGenerator } from '@nx/js';
import { addDependencies } from '../init/lib';
import {
addExportsToBarrelFile,
addProject,
Expand All @@ -14,6 +13,7 @@ import {
import type { LibraryGeneratorOptions } from './schema';
import initGenerator from '../init/init';
import { logShowProjectCommand } from '@nx/devkit/src/utils/log-show-project-command';
import { ensureDependencies } from '../../utils/ensure-dependencies';

export async function libraryGenerator(
tree: Tree,
Expand All @@ -33,6 +33,7 @@ export async function libraryGeneratorInternal(
const options = await normalizeOptions(tree, rawOptions);
await jsLibraryGenerator(tree, toJsLibraryGeneratorOptions(options));
const initTask = await initGenerator(tree, rawOptions);
const depsTask = ensureDependencies(tree);
deleteFiles(tree, options);
createFiles(tree, options);
addExportsToBarrelFile(tree, options);
Expand All @@ -46,6 +47,7 @@ export async function libraryGeneratorInternal(
return runTasksInSerial(
...[
initTask,
depsTask,
() => {
logShowProjectCommand(options.projectName);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
reflectMetadataVersion,
rxjsVersion,
tsLibVersion,
} from '../../../utils/versions';
} from './versions';

export function ensureDependencies(tree: Tree): GeneratorCallback {
return addDependenciesToPackageJson(
Expand Down

0 comments on commit bf2b559

Please sign in to comment.