Skip to content

Commit

Permalink
Deprecate root level template.json keys (facebook#11188)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb authored Jul 14, 2021
1 parent 4798ba6 commit 31978f8
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,24 +126,17 @@ module.exports = function (

const templatePackage = templateJson.package || {};

// TODO: Deprecate support for root-level `dependencies` and `scripts` in v5.
// These should now be set under the `package` key.
// This was deprecated in CRA v5.
if (templateJson.dependencies || templateJson.scripts) {
console.log();
console.log(
chalk.yellow(
'Root-level `dependencies` and `scripts` keys in `template.json` are deprecated.\n' +
'This template should be updated to use the new `package` key.'
chalk.red(
'Root-level `dependencies` and `scripts` keys in `template.json` were deprecated for Create React App 5.\n' +
'This template needs to be updated to use the new `package` key.'
)
);
console.log('For more information, visit https://cra.link/templates');
}
if (templateJson.dependencies) {
templatePackage.dependencies = templateJson.dependencies;
}
if (templateJson.scripts) {
templatePackage.scripts = templateJson.scripts;
}

// Keys to ignore in templatePackage
const templatePackageBlacklist = [
Expand Down

0 comments on commit 31978f8

Please sign in to comment.