Skip to content

Commit b532a58

Browse files
ortarickhanlonii
andauthored
Deprecate Create React App officially by changing the README, and adding a message on init (#17003)
It's probably time to make this project document its status as being deprecated and not recommended for production usage. To change it: - I opted to add a header to the README saying its over and you should go look at https://react.dev/learn/start-a-new-react-project - I left a note saying that if you are following, it is maybe worth carrying on. While I hear react 19 doesn't work with CRA, I wouldn't be surprised that a good chunk of tutorials would still work. Open to being a bit more hard-lined there but there was a lot of great resources for learning react in that era and it seems like a waste to be making people stop early? - I added a message inside the CLI, it shows once and says "don't use this, use the stuff in https://react.dev/learn/start-a-new-react-project" --------- Co-authored-by: Ricky <[email protected]> Co-authored-by: Rick Hanlon <[email protected]>
1 parent fde66a2 commit b532a58

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
# Create React App [![Build & Test](https://github.com/facebook/create-react-app/actions/workflows/build-and-test.yml/badge.svg?branch=main)](https://github.com/facebook/create-react-app/actions/workflows/build-and-test.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/blob/main/CONTRIBUTING.md)
1+
## Create React App [![Build & Test](https://github.com/facebook/create-react-app/actions/workflows/build-and-test.yml/badge.svg?branch=main)](https://github.com/facebook/create-react-app/actions/workflows/build-and-test.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/blob/main/CONTRIBUTING.md)
2+
3+
> [!CAUTION]
4+
>
5+
> ## Deprecated
6+
>
7+
> Create React App was one of the key tools for getting a React project up-and-running in 2017-2021, it is now in long-term stasis and we recommend that you migrate to one of React frameworks documented on [Start a New React Project](https://react.dev/learn/start-a-new-react-project).
8+
>
9+
> If you are following a tutorial to learn React, there is still value in continuing your tutorial, but we do not recommend starting production apps based on Create React App.
210
311
<img alt="Logo" align="right" src="https://create-react-app.dev/img/logo.svg" width="20%" />
412

packages/create-react-app/createReactApp.js

+32
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,41 @@ function isUsingYarn() {
5353
return (process.env.npm_config_user_agent || '').indexOf('yarn') === 0;
5454
}
5555

56+
function hasGivenWarning() {
57+
const localWarningFilePath = path.join(
58+
__dirname,
59+
'given-deprecation-warning'
60+
);
61+
return fs.existsSync(localWarningFilePath);
62+
}
63+
64+
function writeWarningFile() {
65+
const localWarningFilePath = path.join(
66+
__dirname,
67+
'given-deprecation-warning'
68+
);
69+
fs.writeFileSync(localWarningFilePath, 'true');
70+
}
71+
5672
let projectName;
5773

5874
function init() {
75+
if (!hasGivenWarning()) {
76+
console.log(chalk.yellow.bold('create-react-app is deprecated.'));
77+
console.log('');
78+
console.log(
79+
'You can find a list of up-to-date React frameworks on react.dev'
80+
);
81+
console.log(
82+
chalk.underline('https://react.dev/learn/start-a-new-react-project')
83+
);
84+
console.log('');
85+
console.log(
86+
chalk.grey('This error message will only be shown once per install.')
87+
);
88+
writeWarningFile();
89+
}
90+
5991
const program = new commander.Command(packageJson.name)
6092
.version(packageJson.version)
6193
.arguments('<project-directory>')

packages/create-react-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-react-app",
3-
"version": "5.0.1",
3+
"version": "5.0.2",
44
"keywords": [
55
"react"
66
],

0 commit comments

Comments
 (0)