29
loading...
This website collects cookies to deliver better user experience
name
, author
and version
as well as starter scripts and dependencies used in the project. package.json
file in the root directory. "The root directory, or root folder, is the top-level directory of a file system." - Source: Tech Terms{
"name": "example-project",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
name
field is for the name of your project."name": "example-project",
package-lock.json
file. npm install
which will update the name of your project in the package-lock.json
file. version
field is the current version number for your software project."version": "0.1.0",
npm
registry, then this field is important. If you make major changes to the package, it is encouraged that you release a new version so other developers will understand what the new updates are. private
field has the value of a boolean (true or false) that is automatically set to true. This means that npm
will not publish your project."private": true,
npm
registry, then you will need to change that field to false. "dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
react
and react-dom
to run your application.react-scripts
allow you to run the project in your local server and will automatically restart the server every time you make changes to a file. web-vitals
provides metrics concerning the user experience for your website. Create React App comes with built in code to help you track the metrics of your site and see the user performance analytics. jest
and the react-testing-library
. This allows you to write tests to ensure that your application is running smoothly. package.json
file comes with an object filled with four different scripts."scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
start
script, allows you to run your application in the local server (http://localhost:3000/
). You would use the command npm start
in the command line of the project folder. yarn start
if you installed React using Yarn. build
script is used to create an optimized build folder when you are ready to deploy your project to production.npm build
or yarn build
to create that build folder. test
script allows you to start the test runner in the command line and perform any tests that you have written for your project. npm test
or yarn test
to launch the test runner. eject
script is for those developers that want to further customize their build and dependency configurations. This will remove the single build dependency where you are free to configure your React project to your liking.eject
, you can’t go back!npm eject
or yarn eject
.react-app
and jest
."eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
browserslist
, then please visit their GitHub repository.package.json
file. package.json
file, then please read through the documentation.package.json
file or node_modules
folder. yarn.lock
. README.md
file is also located in the root directory for your project.README.md
file. README.md
file, so people will know what your project is all about. .md
tells the computer that it is a Markdown file. Markdown is a language you can use to format your documents. node_modules
folder to GitHub. If this folder is included in production, then it can slow down your website.node_modules
folder to GitHub, because Create React App has already taken care of that for you. We will learn more about why in part 3 of this series. .gitignore
file and public
folder.