Skip to content

Commit 7d57f9f

Browse files
committed
fixes
1 parent 9f75cfb commit 7d57f9f

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

sources/commands/Base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export abstract class BaseCommand extends Command<Context> {
4444
const {data, indent} = nodeUtils.readPackageJson(content);
4545

4646
const previousPackageManager = data.packageManager ?? `unknown`;
47-
data.packageManager = `${info.locator.name}@${info.locator.reference}+${info.hash}`;
47+
data.packageManager = `${info.locator.name}@${info.locator.reference}${typeof info.locator.reference === `string` ? `+` : `#`}${info.hash}`;
4848

4949
const newContent = nodeUtils.normalizeLineEndings(content, `${JSON.stringify(data, null, indent)}\n`);
5050
await fs.promises.writeFile(lookup.target, newContent, `utf8`);

sources/commands/Use.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ export class UseCommand extends BaseCommand {
4545
const location = `https://registry.npmjs.com/${this.pattern}/-/${this.pattern}-${version}.tgz`;
4646
packageManagerInfo = {
4747
locator: {
48-
name: this.pattern as any,
49-
reference: location,
48+
// @ts-expect-error Needs type update from the other PR
49+
name: this.pattern,
50+
// @ts-expect-error Needs type update from the other PR
51+
reference: new URL(location),
5052
},
5153
spec: {
5254
bin: {},

tests/Use.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe(`UseCommand`, () => {
7878
});
7979

8080
await expect(xfs.readJsonPromise(ppath.join(cwd, `package.json`))).resolves.toMatchObject({
81-
packageManager: `test@https://registry.npmjs.com/test/-/test-3.3.0.tgz+sha1.a2b56c6aa386c5732065793e8d9d92074a9cdd41`,
81+
packageManager: `test@https://registry.npmjs.com/test/-/test-3.3.0.tgz#sha1.a2b56c6aa386c5732065793e8d9d92074a9cdd41`,
8282
});
8383
});
8484
});
7 Bytes
Binary file not shown.
24.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)