Skip to content

Commit 3e289fe

Browse files
committed
fix(provenance): avoid attempting to update provenance when a package is missing publishConfig
1 parent 28888eb commit 3e289fe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/project-type/publishable/provenance/lifter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {mergeIntoExistingPackageJson} from '@form8ion/javascript-core';
33
import enhanceSlsa from './slsa.js';
44

55
export default async function ({projectRoot, packageDetails}) {
6-
const {publishConfig: {access}} = packageDetails;
6+
const {publishConfig: {access} = {}} = packageDetails;
77

88
if ('public' === access) {
99
await mergeIntoExistingPackageJson({projectRoot, config: {publishConfig: {provenance: true}}});

src/project-type/publishable/provenance/lifter.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ describe('provenance lifter', () => {
3636
expect(enhanceSlsa).not.toHaveBeenCalled();
3737
expect(mergeIntoExistingPackageJson).not.toHaveBeenCalled();
3838
});
39+
40+
it('should not configure provenance for a package without `publishConfig`', async () => {
41+
const packageDetails = any.simpleObject();
42+
43+
expect(await lift({packageDetails, projectRoot})).toEqual({});
44+
expect(enhanceSlsa).not.toHaveBeenCalled();
45+
expect(mergeIntoExistingPackageJson).not.toHaveBeenCalled();
46+
});
3947
});

0 commit comments

Comments
 (0)