I ve been working on a p…

1 minute read

I’ve been working on a plugin to create Google Cloud Function, I’ve used the build steps from node:lib but it does not work & I don’t understand the error code.

nx run gcp-function4102401:build schema is invalid: data should have required property ‘main’

<https://gist.github.com/JoelCode/2e809b01ba1b5ad29de0ef1f5f1cffea Code>


Your builder has a property of main without a default and you aren’t specifying anything in that command you posted.

I thought I needed to define the “options” in the schematic.ts as demonstrated in the image below. What’s the purpose of these “options” if they are not pass to the builder?

Everything starts with schema.json and there you have main defined without a default. If you don’t want to force the user into passing that property then you need to set a default for it.

The properties passed into your builder command are mapped to schema.json and then parsed to those options and passed into your builder file.

Thanks for your advises with my problem but your solution is not working & the default implementation of the plugin node:lib does not have a default for the main.

This plugin will be public & use in an upcoming open source project. Here is the <https://github.com/JoelCode/nx-dev git repo> . Thanks