Skip to content

Commit 3334acc

Browse files
authored
chore(node-bundle): ignore invalid package.json files (#23799)
package.json files are required to have a `name` property. However, for some reason some deps can have embedded package.json files that do not adhere to this. For example, `minimatch/dist/cjs/package.json` looks like this: ```json { "type": "commonjs" } ``` This kills `yarn pkglint` because pkglint is expecting a real package (with a real name), which is running `node-bundle`. I've decided that simply ignoring these invalid package.jsons is the right thing to do. Can confirm that this does fix `yarn pkglint`. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 4a701f1 commit 3334acc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/@aws-cdk/node-bundle/src/api/bundle.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export class Bundle {
355355
}
356356
const inputs = Object.keys(this.bundle.metafile!.inputs);
357357
const packages = new Set(Array.from(inputs).map(i => this.closestPackagePath(path.join(this.packageDir, i))));
358-
this._dependencies = Array.from(packages).map(p => this.createPackage(p)).filter(d => d.name !== this.manifest.name);
358+
this._dependencies = Array.from(packages).map(p => this.createPackage(p)).filter(d => d.name !== undefined && d.name !== this.manifest.name);
359359
return this._dependencies;
360360
}
361361

0 commit comments

Comments
 (0)