Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(recipes): Fix shadow-file resource for scoped NPM packages & re-enable e2e testing for resources #23274

Merged
merged 14 commits into from
Apr 20, 2020
Merged
Prev Previous commit
Next Next commit
Use parsed value for the plan
  • Loading branch information
KyleAMathews committed Apr 20, 2020
commit 450138fe747bd2768b27be6ad7983dcf05a209a8
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ Object {
"id": "husky",
"name": "husky",
"newState": "{
\\"husky\\": \\"{\\\\n \\\\\\"hooks\\\\\\": {}\\\\n}\\"
\\"husky\\": {
\\"hooks\\": {}
}
}",
}
`;
Expand All @@ -45,7 +47,11 @@ Object {
"id": "husky",
"name": "husky",
"newState": "{
\\"husky\\": \\"{\\\\n \\\\\\"hooks\\\\\\": {\\\\n \\\\\\"pre-commit\\\\\\": \\\\\\"lint-staged\\\\\\"\\\\n }\\\\n}\\"
\\"husky\\": {
\\"hooks\\": {
\\"pre-commit\\": \\"lint-staged\\"
}
}
}",
}
`;
Expand Down
3 changes: 2 additions & 1 deletion packages/gatsby-recipes/src/providers/npm/package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ exports.schema = schema
exports.validate = validate

module.exports.plan = async ({ root }, { id, name, value }) => {
const parsedValue = typeof value === `string` ? JSON.parse(value) : value
const key = id || name
const currentState = readPackageJson(root)
const newState = { ...currentState, [key]: value }
const newState = { ...currentState, [key]: parsedValue }

return {
id: key,
Expand Down