Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ describe(`Features`, () => {

const packedManifest = await xfs.readJsonPromise(`${path}/package/package.json` as PortablePath);

expect(packedManifest.dependencies[`no-deps`]).toBe(`npm:^2.0.0`);
expect(packedManifest.devDependencies[`one-fixed-dep`]).toBe(`npm:~1.0.0`);
expect(packedManifest.dependencies[`no-deps`]).toBe(`^2.0.0`);
expect(packedManifest.devDependencies[`one-fixed-dep`]).toBe(`~1.0.0`);
},
),
);
Expand Down
6 changes: 5 additions & 1 deletion packages/plugin-catalog/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ const plugin: Plugin<CoreHooks & PackHooks> = {
// Resolve the catalog reference to get the actual version range
const resolvedDescriptor = resolveDescriptorFromCatalog(project, descriptor, resolver, resolveOptions);

let {protocol, source, params, selector} = structUtils.parseRange(structUtils.convertToManifestRange(resolvedDescriptor.range));
if (protocol === workspace.project.configuration.get(`defaultProtocol`))
protocol = null;

// Replace the catalog reference with the resolved range
dependencies[identStr] = resolvedDescriptor.range;
dependencies[identStr] = structUtils.makeRange({protocol, source, params, selector});
}
}
},
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-catalog/sources/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const resolveDescriptorFromCatalog = (project: Project, dependency: Descr
if (!resolvedRange)
throw new ReportError(MessageName.RESOLUTION_FAILED, `${structUtils.prettyDescriptor(project.configuration, dependency)}: entry not found in ${getCatalogErrorDisplayName(catalogName)}`);


// The range resolved from the catalog may need to be normalized (.i.e. ^2.4.0 -> npm:^2.4.0)
// This process typically happens before the reduceDependency hook, but we need to do it here since
// when it is first called the dependency range still refers to the catalog
Expand Down
Loading