Skip to content

Commit

Permalink
fix: don't overwrite plugin origin if it exists (#5793)
Browse files Browse the repository at this point in the history
* fix: don't overwrite plugin origin if it exists

* test: update snapshots (order of fields)
  • Loading branch information
pieh authored Aug 19, 2024
1 parent 2e48b21 commit d5ef407
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/build/tests/plugins/snapshots/tests.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,7 @@ Generated by [AVA](https://avajs.dev).
-> inputs: { some_input: 'some string' }␊
-> netlifyConfig: {␊
functions: { '*': {} },␊
plugins: [ { package: './plugin', origin: 'config', inputs: [Object] } ],␊
plugins: [ { origin: 'config', package: './plugin', inputs: [Object] } ],␊
build: {␊
environment: {},␊
publish: 'packages/build/tests/plugins/fixtures/dynamic_plugin',␊
Expand Down
Binary file modified packages/build/tests/plugins/snapshots/tests.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/config/src/origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const addBuildPublishOrigin = function ({ config, config: { build = {} }, origin
}

const addConfigPluginOrigin = function ({ config, config: { plugins }, origin }) {
return Array.isArray(plugins) ? { ...config, plugins: plugins.map((plugin) => ({ ...plugin, origin })) } : config
return Array.isArray(plugins) ? { ...config, plugins: plugins.map((plugin) => ({ origin, ...plugin })) } : config
}

const addHeadersOrigin = function ({ config, config: { headers }, origin }) {
Expand Down
6 changes: 3 additions & 3 deletions packages/config/tests/validate/snapshots/tests.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ Generated by [AVA](https://avajs.dev).
Invalid syntax␊
[[plugins]]␊
test = true␊
origin = "config"␊
test = true␊
[plugins.inputs]␊
Expand All @@ -97,8 +97,8 @@ Generated by [AVA](https://avajs.dev).
Invalid syntax␊
[[plugins]]␊
id = "test"␊
origin = "config"␊
id = "test"␊
[plugins.inputs]␊
Expand All @@ -123,9 +123,9 @@ Generated by [AVA](https://avajs.dev).
Invalid syntax␊
[[plugins]]␊
origin = "config"␊
package = "./plugin.js"␊
enabled = true␊
origin = "config"␊
[plugins.inputs]␊
Expand Down
Binary file modified packages/config/tests/validate/snapshots/tests.js.snap
Binary file not shown.

0 comments on commit d5ef407

Please sign in to comment.