Is the “default” property of inputs supposed to be available in the operation of a plugin?
While developing a plugin… unless I explicitly define an “input” value in the netlify.toml, the “input” is undefined in plugin code execution. Even if the manifest.yml has a default.
So is the manifest.yml just for documentation?
If so, why do so many existing plugins list defaults for inputs, but never set a default in their plugin code?
jen
May 23, 2020, 10:10pm
2
Hey @moop-moop ,
The manifest.yml is not just for documentation. I found Tara Manicsic’s tutorial on this really helpful:
See how Netlify Build Plugins allow you to customize, automate, and have more control over your build processes. Learn how to enable and utilize Build Plugins, as well as run them locally and disable them.
And you probably already know about this repo but dropping it here for future readers of this post:
That said, it is surprising that you would get undefined if you set a default value in the manifest.yml. Can you share your repo or a deploy log?
Hi @moop-moop ,
As @jen mentioned, if you set a default
for one of your inputs
in your manifest.yml
, and a user of your plugin is not defining that input, Netlify will use the default value instead.
If this is not the behavior you are experiencing, please share a link to your plugin (if public) and a link to a deploy. Thanks!
This is great @moop-moop !
Would you like to submit this plugin to our list of plugins so it shows up in the Netlify app? We are currently adding some guidelines here .
I will eventually @ehmicky , but need to solve the multiple manifest.yml issues I am having first.
No defaults still from manifest.yml and latest netlify-cli version causing new not found problems for me.
Nathan Morris
Which new problems are you experiencing? We can help fix this.
I never solved the manifest.yml defaults not being available, but now the new issue is a bigger problem.
New issue:
Started after your last update of netlify-cli and @netlify /build
opened 06:17AM - 27 May 20 UTC
closed 09:15PM - 27 May 20 UTC
<!--
If you are reporting a new issue, make sure that we do not have any duplic… ates
already open. You can ensure this by searching the issue list for this
repository (https://github.com/netlify/cli/issues). If there is a duplicate,
please close your issue and add a comment to the existing issue instead.
If you suspect your issue is a bug, please edit your issue description to
include the BUG REPORT INFORMATION shown below. If you fail to provide this
information within 7 days, we cannot debug your issue and will close it. We
will, however, reopen it if you later provide the information.
---------------------------------------------------
BUG REPORT INFORMATION
---------------------------------------------------
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
-->
**- Do you want to request a _feature_ or report a _bug_?**
bug
**- What is the current behavior?**
```bash
┌─────────────────────────────┐
│ Netlify Build │
└─────────────────────────────┘
> Version
@netlify/build 1.0.5
> Flags
mode: cli
> Current directory
C:\Users\***\GitHub\next-netlify-jest-testing
> Config file
C:\Users\***\GitHub\next-netlify-jest-testing\netlify.toml
> Context
production
┌─────────────────────────────────────────────────────────────────┐
│ Plugin "..\netlify-plugins\netlify-plugin-jest\" internal error │
└─────────────────────────────────────────────────────────────────┘
Error message
Error: This plugin is missing a "manifest.yml".
Please see the documentation at https://github.com/netlify/build#anatomy-of-a-plugin
Error location
While loading "..\netlify-plugins\netlify-plugin-jest\" from netlify.toml
at async Promise.all (index 2)
at async BuildCommand.run (/node_modules/netlify-cli/src/commands/build/index.js:16:21)
at async BuildCommand._run (/node_modules/@oclif/command/lib/command.js:43:20)
at async Config.runCommand (/node_modules/@oclif/config/lib/config.js:172:9)
at async Main.run (/node_modules/@oclif/command/lib/main.js:22:9)
```
**- If the current behavior is a bug, please provide the steps to reproduce.**
Trying to continue using a local path to develop a netlify build plugin that **does have a manifest.yml file.**
**manifest.yml**
```yaml
name: netlify-plugin-jest
inputs:
- name: skipTests
description: skip unit tests but leave the plugin present
default: false
required: true
- name: skipStatusUpdate
description: skip Github status update
default: false
required: true
- name: testFailureErrorMessage
description: string that exists inside of the error message that indicates tests failed
default: Command failed with exit code 1
required: true
```
**netlify.toml of referencing build**
```toml
[[plugins]]
package = "..\\netlify-plugins\\netlify-plugin-jest\\"
[plugins.inputs]
skipTests = true
[[plugins]]
package = "@netlify/plugin-local-install-core"
```
**- What is the expected behavior?**
It's expected the local netlify-build-plugin would load and function as it did in versions:
netlify-cli 2.51.0 and @netlify/build 0.4.47
**- Local Environment Information**
**worked**
```bash
────────────────────┐
Environment Info │
────────────────────┘
System:
OS: Windows 10 10.0.17763
CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
Binaries:
Node: 12.16.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - ~\GitHub\next-netlify-template\node_modules\.bin\yarn.CMD
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.17763.831.0
netlify-cli/2.51.0 win32-x64 node-v12.16.2
```
**now bugged**
```bash
────────────────────┐
Environment Info │
────────────────────┘
System:
OS: Windows 10 10.0.17763
CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
Binaries:
Node: 12.16.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - ~\GitHub\next-netlify-jest-testing\node_modules\.bin\yarn.CMD
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.17763.831.0
netlify-cli/2.52.0 win32-x64 node-v12.16.2
```
Oh, I am actually looking into that problem. It got reported here as well: Deploys are failing with local plugin · Issue #1373 · netlify/build · GitHub
Thanks for raising this up.
This should be fixed now.
Please let us know if you’re still experiencing any problems. Thanks!
Seems to be good, thanks.
My manifest.yml defaults are available.
2 Likes