command line Flashcards

1
Q

What does “npm run build” do?

A

“npm run build” is a command that triggers a script specified in the “scripts” section of the package.json file in a Node.js project. Typically, for a front-end project like a React application, this script creates a production-ready, optimized build of your application. The built files are typically output to a directory named “build” or “dist”.

“npm run build” is like telling your computer, “Hey, gather up all the code files for my website or app, tidy them up, and put them into a neat package that’s ready to go online for people to use.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does “sudo npm i -g serve” do?

A

This command tells your computer, “Please install a tool named ‘serve’ that helps me show my website on the internet. Use ‘sudo’ to get the necessary permissions, ‘npm i’ means install, ‘-g’ means make it available everywhere on my computer, and ‘serve’ is the tool we’re installing.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does “serve -s build -p 8000” do?

A

This command is like saying, “Use the ‘serve’ tool to show my website. Take the ‘build’ folder where my tidy, ready-to-go website package lives, and make it available on my computer at address ‘localhost’ and at port number ‘8000’ so I can check it out in my web browser.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does create-react-app my-app do?

A

This command creates a new React application with the name “my-app”. It sets up a new project with sensible defaults and best practices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does npm start do in a React application?

A

The npm start command launches the application in development mode and starts a server that will automatically refresh the page whenever you make changes to your code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does npm test do in a React application?

A

“npm test” starts the test runner which automatically runs any tests associated with your React application and watches for changes to rerun the tests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does npm install –save <library> do in a React application?</library>

A

npm install –save <library> adds a new library or package to your project and updates your package.json file. Replace <library> with the name of the library or package you want to add.</library></library>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does npm run eject do in a React application?

A

npm run eject is specific to projects created with create-react-app. It removes the single build dependency and gives you full control over the project configuration and dependencies, allowing you to customize as per your requirements. Be careful though, this action is irreversible!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

npm I -g create-react-app

A

Install global package create react app.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly