Skip to content

Commit c8bac90

Browse files
committed
fix(core): read js lib defaults when generating js lib
1 parent 771de5b commit c8bac90

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

packages/core/src/generators/add-swagger-target/add-swagger-target.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ async function generateShellProject(
114114
};
115115

116116
const { tasks: codegenTasks, name: codegenProjectName } =
117-
await generateCodegenProject(host, options);
117+
await generateCodegenProject(
118+
host,
119+
options as NormalizedOptions & { codegenProject: string },
120+
);
118121

119122
tasks.push(...codegenTasks);
120123

@@ -155,21 +158,30 @@ async function generateShellProject(
155158

156159
async function generateCodegenProject(
157160
host: Tree,
158-
options: AddSwaggerJsonExecutorSchema,
161+
options: AddSwaggerJsonExecutorSchema & {
162+
codegenProject: string;
163+
},
159164
): Promise<{ name: string; tasks: GeneratorCallback[] }> {
160165
const tasks: GeneratorCallback[] = [];
161166
const nameWithDirectory = `generated-${options.codegenProject}`;
162167

168+
const nxJson = readNxJson(host);
169+
163170
const {
164171
libraryGenerator,
165172
}: // eslint-disable-next-line @typescript-eslint/no-var-requires
166173
typeof import('@nx/js') = require('@nx/js');
174+
const libraryGeneratorDefaults = {
175+
...nxJson?.generators?.['@nx/js:library'],
176+
...nxJson?.generators?.['@nx/js']?.library,
177+
};
167178
tasks.push(
168179
await libraryGenerator(host, {
169180
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
170-
name: options.codegenProject!,
181+
...libraryGeneratorDefaults,
182+
name: options.codegenProject,
171183
directory: 'generated',
172-
buildable: true,
184+
unitTestRunner: 'none',
173185
}),
174186
);
175187
await updateProjectConfiguration(

project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"options": {
66
"port": 4872,
77
"config": ".verdaccio/config.yml",
8-
"storage": "build/local-registry/storage"
8+
"storage": "dist/local-registry/storage"
99
}
1010
}
1111
},

0 commit comments

Comments
 (0)