Skip to content

Commit

Permalink
feat: improve deprecation notices during development
Browse files Browse the repository at this point in the history
This update tells developers the new name of the deprecated props to make it easier to upgrade.

re gatsbyjs#3986
  • Loading branch information
jlengstorf committed Apr 29, 2018
1 parent 1e85a8a commit f11af1c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/gatsby/src/commands/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ module.exports = async (program: any) => {

function printDeprecationWarnings() {
const deprecatedApis = [`boundActionCreators`, `pathContext`]
const fixMap = {
boundActionCreators: `actions`,
pathContext: `pageContext`,
}
const deprecatedLocations = {}
deprecatedApis.forEach(api => (deprecatedLocations[api] = []))

Expand All @@ -385,9 +389,11 @@ module.exports = async (program: any) => {
deprecatedApis.forEach(api => {
if (deprecatedLocations[api].length) {
console.log(
`${chalk.cyan(api)} ${chalk.yellow(
`is deprecated but was found in the following files:`
)}`
`%s %s %s %s`,
chalk.cyan(api),
chalk.yellow(`is deprecated. Use`),
chalk.cyan(fixMap[api]),
chalk.yellow(`instead. Check the following files:`)
)
console.log()
deprecatedLocations[api].forEach(file => console.log(file))
Expand Down

0 comments on commit f11af1c

Please sign in to comment.