DEV Community

loading...

Is it a good idea to use CLIs to generate projects in JavaScript?

leoat12 profile image Leonardo Teteo ・1 min read

When I generate a project using Angular CLI, React Native CLI or even once with VueJs it is always somewhat troublesome because sometimes they ask questions before generating the project that as a beginner, you don't understand half of what they are asking and when it is generated, there are many files you don't know what they do.

I am not a total beginner in Javascript, used jQuery for years and even Angular 2+ in some personal projects. I certainly know more about Angular fundamentals like components, modules, services, dependency injection, two-way binding and so on than what all that configuration files even mean.

Is it everything thing there necessary at the beginning of a project? For a true beginner who want to start quickly, it is not one more wall they need to overcome?

Discussion (3)

pic
Editor guide
Collapse
georgecoldham profile image
George

Im currently working with people who are learning React for a new job. I am the only one with a dedicated background with React.

They are all using create-react-app, which is fine. But it is leading to so many small issues as they have no knowledge of how it is working under the hook. It feels like a case of knowing just enough to cause damage, but not enough to fix it.

I feel that spending half a day learning how to set it up yourself, learning why you are adding Webpack and how it is configured etc, making a template for reuse; it all saves headaches down the line and less "beginner" mistakes.

The largest issue I face is trying to get very experienced developers to think in a different way than they are perhaps used to. For beginners I worry that they will become reliant on create-react-app or equivalent and get into bad habits because of it.

Collapse
leoat12 profile image
Leonardo Teteo Author • Edited

I agree that creating everything from zero to see how it works is a good thing to do, but the problem with Javascript is that there is so many files, which means so many steps, that you will do once and forget the next day what comes first or second. I have more experience with Java and although I receive an earful when I compare the two, I will do that. hahaha
Spring is a real big framework for Java web development, with a lot of modules, but when you use Spring Initializr you choose only the modules you want and the default files are basically two? Three, counting with pom.xml? You feel at ease with that. I can easily create from zero, the Initializr only facilitates in adding the dependencies you need without looking for it.

Collapse
georgecoldham profile image
George

I created a simple React boilerplate that is ready for production with its webpack config. I use that for every new React project and its as quick as create-react-app to get going. Difference is I know how it all fits together, and if theres an issue I can understand why.

create-react-app I feel is good to get going, but doesn't provide a way to deliver refined production ready code without making larger changes to the underlying structure. Something that I feel is more dangerous after working on a project for months. Its like trying to add plugs to a house thats already built, its possible, but really irritating and messy. It would have been easier to do it from the start.

I have very limited experience with Java, my understanding is that it is much more static than JavaScript. And if JS were to sit still and create-react-app would stop changing etc, then I would feel more comfortable about recommending it. It sounds like Spring has much more solid foundations than anything in JS really does at the moment, so it seems fine to me.

Ultimately, while I would recommend learning how React and its surrounding architecture works by building your own at least once. Once you understand it better then who am I to say dont/do use something? As for other frameworks, no idea... If its for a hobby project then go for it especially, no point wasting time on something you will never need to know.