Skip to content

Commit b82ca22

Browse files
authored
fix(js): generate nx release config correctly for js libraries in new ts setup and set tags (#28218)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> When setting the Nx configuration for a JS library in the `package.json` file, the provided tags is not set and the relevant `nx release` configuration in `nx.json` is not set either. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> When setting the Nx configuration for a JS library in the `package.json` file, the provided tags should be set and the relevant `nx release` configuration in `nx.json` should be configured. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> <!-- Fixes NXC-1074 --> Fixes #
1 parent c24292a commit b82ca22

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

packages/js/src/generators/library/library.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,27 @@ async function configureProject(
267267
}
268268

269269
if (!options.useProjectJson) {
270+
// we create a cleaner project configuration for the package.json file
271+
const projectConfiguration: ProjectConfiguration = {
272+
root: options.projectRoot,
273+
};
274+
270275
if (options.name !== options.importPath) {
271276
// if the name is different than the package.json name, we need to set
272277
// the proper name in the configuration
273-
updateProjectConfiguration(tree, options.name, {
274-
name: options.name,
275-
root: options.projectRoot,
276-
});
278+
projectConfiguration.name = options.name;
279+
}
280+
281+
if (options.parsedTags?.length) {
282+
projectConfiguration.tags = options.parsedTags;
277283
}
278284

285+
if (options.publishable) {
286+
await addProjectToNxReleaseConfig(tree, options, projectConfiguration);
287+
}
288+
289+
updateProjectConfiguration(tree, options.name, projectConfiguration);
290+
279291
return;
280292
}
281293

0 commit comments

Comments
 (0)