Skip to content

Commit

Permalink
Revert "fix(release): do not update dependents when they already use …
Browse files Browse the repository at this point in the history
…"*" (#20607)"

This reverts commit 6d68236.
  • Loading branch information
FrozenPandaz committed Dec 8, 2023
1 parent 702ccf2 commit 837c8ba
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 98 deletions.
92 changes: 0 additions & 92 deletions packages/js/src/generators/release-version/release-version.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,98 +419,6 @@ To fix this you will either need to add a package.json file at that location, or
`);
});

it(`should not update dependents when they are using version "*"`, async () => {
projectGraph = createWorkspaceWithPackageDependencies(tree, {
'my-lib': {
projectRoot: 'libs/my-lib',
packageName: 'my-lib',
version: '0.0.1',
packageJsonPath: 'libs/my-lib/package.json',
localDependencies: [],
},
'project-with-dependency-on-my-pkg': {
projectRoot: 'libs/project-with-dependency-on-my-pkg',
packageName: 'project-with-dependency-on-my-pkg',
version: '0.0.1',
packageJsonPath:
'libs/project-with-dependency-on-my-pkg/package.json',
localDependencies: [
{
projectName: 'my-lib',
dependencyCollection: 'dependencies',
version: '*',
},
],
},
'project-with-devDependency-on-my-pkg': {
projectRoot: 'libs/project-with-devDependency-on-my-pkg',
packageName: 'project-with-devDependency-on-my-pkg',
version: '0.0.1',
packageJsonPath:
'libs/project-with-devDependency-on-my-pkg/package.json',
localDependencies: [
{
projectName: 'my-lib',
dependencyCollection: 'devDependencies',
version: '*',
},
],
},
});

expect(readJson(tree, 'libs/my-lib/package.json').version).toEqual(
'0.0.1'
);
expect(
readJson(tree, 'libs/project-with-dependency-on-my-pkg/package.json')
.version
).toEqual('0.0.1');

await releaseVersionGenerator(tree, {
projects: Object.values(projectGraph.nodes), // version all projects
projectGraph,
specifier: '4.5.6', // user CLI specifier override set, no prompting should occur
currentVersionResolver: 'disk',
specifierSource: 'prompt',
releaseGroup: createReleaseGroup('independent'),
});

expect(readJson(tree, 'libs/my-lib/package.json'))
.toMatchInlineSnapshot(`
{
"name": "my-lib",
"version": "4.5.6",
}
`);

expect(
readJson(tree, 'libs/project-with-dependency-on-my-pkg/package.json')
).toMatchInlineSnapshot(`
{
"dependencies": {
"my-lib": "*",
},
"name": "project-with-dependency-on-my-pkg",
"version": "4.5.6",
}
`);

expect(
readJson(
tree,
'libs/project-with-devDependency-on-my-pkg/package.json'
)
).toMatchInlineSnapshot(`
{
"devDependencies": {
"my-lib": "*",
},
"name": "project-with-devDependency-on-my-pkg",
"version": "4.5.6",
}
`);
});

it(`should update dependents even when filtering to a subset of projects which do not include those dependents`, async () => {
expect(readJson(tree, 'libs/my-lib/package.json').version).toEqual(
'0.0.1'
Expand Down
6 changes: 0 additions & 6 deletions packages/js/src/generators/release-version/release-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,6 @@ To fix this you will either need to add a package.json file at that location, or
'package.json'
),
(json) => {
// Do not update "*" as it already matches all possible versions including the new one
if (
json[dependentProject.dependencyCollection][packageName] === '*'
) {
return json;
}
json[dependentProject.dependencyCollection][packageName] =
newVersion;
return json;
Expand Down

0 comments on commit 837c8ba

Please sign in to comment.