Skip to content

Commit 0d6d552

Browse files
committed
fix(errors): throw if package name is missing
1 parent 9ccf255 commit 0d6d552

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/handlers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ export default function (plop: NodePlopAPI) {
5757
return [
5858
async () => {
5959
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
60+
if (!pkg.name) {
61+
throw new Error('Your package.json is missing a name field, please ensure it is set');
62+
}
6063
const svcName = pkg.name.split('/').pop();
6164
const apiSpec = `api/${svcName}.yaml`;
6265
const { paths } = await OpenAPIParser.validate(apiSpec);

0 commit comments

Comments
 (0)