How does scaffolding functionality works in some of the Node Packages? - node.js

For some Node packages, (Eg - create-react-app) when we run npx create-react-app app-name or npm create-react-app app-name (if we have npm installed globally) in cli, then the command line automatically creates a physical folder with basic files to run a React app. What technology, or modules does Node packages as such use to allow this kind of scaffolding of project?
I saw that there is something called Yeoman which helps users to do such thing, or a module called fs which I am assuming could be used to help to generate the scaffolding. Does create-react-app or any other Node Packages that does scaffolding uses similar technology?

Related

Vue3 app breaks when you install anything from npm

I'm starting a new Vue3 project using vue create delete-me. This seems to work fine, and I can run npm run serve and the app starts up as intended.
As soon as I install any library with NPM, it seems to delete all node_modules and the project no longer works.
Now install anything and this is the result:
I've tried running npm install afterwords but the project does not seem to have all the dependencies. The project is just useless at this point.
It seems like vue create does not create a valid package.json but not sure. I'm new to Node and Vue.

What are all commands for npx create-*?

I know npx create-react-app and npx-next-app what are all others app npx support?
npx is a program that downloads any package on npm. create-react-app isn't a command for npx, rather, you're telling npx:
Download react-create-app
Cache it (but not in the current directory, so it will stay 'clean')
Try to run it as a program (the package.json file says how to do that, in this case: "run node ./index.js")
npx knows nothing of React or Next.js and it doesn't have these things built in. All it knows is about is npm and how to run any (executable) package it downloads from there, like npx gulp or npx serve.
If you're working with a new framework and you're wondering if there's a utility to quickly set up a project, just search NPM and see what pops up.
There is no set list because npx is a package runner for Node.js. Running npx create-react-app will try to find the package create-react-app and run it. The package will be downloaded if not locally installed.
Therefore, the list of supported commands for npx is "everything included in the repositories used by NPM". You can even create your own package, not visible to anybody else, and run it with npx.

Why does each angular app have its own copy of node_modules

I'm a noob to Angular development. I installed node.js and did a global install of the Angular cli (npm install -g #angular/cli). Nevertheless, I also have to npm install angular (without the -g option) in every Angular project. This creates a node_modules directory in the project and installs a LOT of files in that directory. Files that take up a lot of disk space.
Is there a way to do a global install of #angular/cli #angular/common, etc., then use that one set of global files in my projects?
I haven't found any documentation for doing so.
Thanks.

Create-react-app not working - packages looking for funding

I installed node, then I ran npm install create-react-app, then ran npx create-react-app hello-world.
The last command did not go through because of some package funding, whatever that means.
How do I fix this?
I am using windows. Here is how my command prompt looks like:
When you do "npm install create-react-app" you're installing in the current folder a CLI to ease up creating a React template for your projects. Doing "npx create-react-app hello-world" is redundant as you've already downloaded the create-react-app module, if you do not wish to save the CLI software and only create the template then it's a better approach.
Using the "-g" flag will allow you to use the CLI globally to create React projects on your computer ("npm install -g create-react-app" this might require certain permissions) instead of only the specific folder you're on.
Once you're done you must use the command "create-react-app 'your_project_name'" to use create-react-app to create your project. More information here https://reactjs.org/docs/create-a-new-react-app.html#create-react-app, to start the project just head inside the created folder and do "npm start".
Packages looking for funding is exactly what it says, the developers of these modules are looking for funding.
Uninstalling x64 version of node and install x34 version solved my same issue.

Does it have an issue if you install angular, reactjs, ionic, apache-cordova and karma in node js?

Does it have an issue or conflicts if you install ionic and angular and then you install reactjs, apache-cordova and karma in npm ?
If you install these packages on the same project you may have issues. All these frameworks are meant to work independent and you shouldn't use Angular if already using React or vice versa for instance.
If the packages are installed on different projects, then you are good to go. The package is only used by the project you installed it on (you can find all the packages installed for a project on the node_modules folder inside your project).
I think there would be no issues as long as you install them globally. just add -g every time you npm install something.

Resources