Is there a way I can use angular-generator without yeoman? - angularjs

Basically what I want is a scaffolding tool (without bower and other stuff that it comes with) and controller, service/factory generators.
Yeoman is great but I was wondering if there's anything minimalist cli out there for angular.

Well, if all you want is a base angular app structure, that is called a boilerplate. There are a few available:
https://github.com/angular/angular-seed
https://github.com/ngbp/ngbp
https://github.com/angular-app/angular-app
However, you seem to also want a controller, service/factory generator. This will always require:
some kind of task runner (like Grunt)
or an IDE that supports templates.
Since you don't seem to like grunt (grunt IS AWESOME), these IDEs might help you...
Eclipse supports template, you can find some here
IntelliJ's PHPStorm or WebStorm have a feature called Live Templates which, IMHO, are far better than eclipse. You can find some premade templates here, but is easy to roll your own, as explained in this tutorial.

If you want a command line interface but not Yeoman's, you might want to have a look at the "Generation" section of this collection. As of today, it has one option that uses Lineman and two that made their own CLI, but they use bower. Anyway, if what you're looking for exists, it should be in there somewhere.

Related

Why we need to use angular cli?

Hello everyone I want to learn angular, but I am bit confused like what is the use of angular cli??
Why I need to write 3 different files like app.html, app.component.ts and app.module.ts instead of writing code in those three files can't we use angular cdn directly? How better that component based architecture will work?
Please do not laugh at me I am new to this topic so previous are random questions that came to my mind while surfing the internet.
Angular CLI stands for Angular Command Line Interface (see this link). As the name implies, it is a command line tool for creating angular apps. It is recommended to use angular cli for creating angular apps as you don't need to spend time installing and configuring all the required dependencies and wiring everything together.
The Angular CLI is used for much more than just creating an Angular project. It can be used to create components, services, pipes, directives and more. Also it helps in building, serving, testing etc. CLI itself is quite something to learn about, it makes Angular development workflow much easier and faster.
I will try to provide little more thorough answer on this and give a few examples too.
First of all, Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications directly from a command shell. It saves you from the hassle of complex configurations and build tools like TypeScript, Webpack, and so on.
After installing Angular CLI, you’ll need to run one command to generate a project and another to serve it using a local development server to play with your application.
Here are a few basic and useful commands that show the benefit of using it:
ng help
ng generate --help
ng new my-first-project
cd my-first-project
ng serve
For more commands info and their full explanation refer to the official documentation here: Angular CLI Official Page.
You do not have to use Angular CLI in order to create and run and develop Angular apps, but isn't it best to use "GG" electric socket covers with "GG" frames for those covers?
Angular cli can ease you work setting up maintain and customize your angular projects. Here are some of the main reasons you should use it:
https://scotch.io/tutorials/use-the-angular-cli-for-faster-angular-2-projects

What do Yeoman Generator's add "really" to Ionic Projects

I don't understand why the generator-ionic (along with other ionic + Yeoman project)s are so popular.
I don't see what the advantages are in using a yeomen generator in this case, this is.
I understand why the Ionic framework is useful in a Cordova project (as we all know, the UI, ngCordova plugins, it uses AngularJS, ect) but what specifically does the Yeoman component add that a basic Ionic project doesn't already have or that cannot be easily added with a bower install.
It seems to me that the Yeoman ionic projects just seem to be unnecessary bloat and can lead to more errors and library issues. I just do not see how components like karma and grunt (as opposed to ionic using gulp) fit into help with development.
True, you can set all this up by yourself. However, imagine setting this up on each and every project that you start. Kind of cumbersome, don't you think?
That's why some people tend to create these generators - to save you (if you like) the time of having to scaffold your application every time from beginning. Usually they provide some features (about which you can read on the Github pages) or they may even enforce some kind of project directory layout (which may help with big projects).
All in all, you don't have to use them, or stress about them. For instance, I personally don't use them on every project, but I appreciate the community effort and when I want to try something quick I tend to test them from time to time to see how they've evolved.
Don't hate, donate ;) (Sure sure, I know you're not hating, the statement just seemed appropriate).

Is there any angular test skeleton generators?

I'm searching some similar to PHPUnit Skeleton Generator just for Angular, maybe you could help me to find one ?
I'd recommend looking into the ng-boilerplate project. It sets you up with a sane structure, including where to put tests and running them.
You should familiarize yourself with yeoman which is a very nice scaffolding tool for JS projects.
It works around the concept of generators, different generators can generate different files for you. For example the angular-generator will help you with setting up an angular project and also add controllers, services and such.

Angular.js beginner: Is Yeoman scaffolding the wrong way to go?

I am trying to add Angular to my arsenal and just started playing around with it this weekend. Looks cool!
In one of the videos done by Google, the guy recommended Yeoman. I'm watching another tutorial video on it now as well: https://www.youtube.com/watch?v=rqdRXqeqgZs
However, it looks like it generates everything (even writes tests for you??). In the video above, to generate a route he ran yo angular:route myroute which generated the controller, route, view, and test. I mean it's great that I get to see the structure, but I wrote like 0 lines of code.
Perhaps I should just start off with something like this where the file structure is way simpler but at least I have to write more lines of code? https://github.com/davidb583/white-angularjs-app
For a beginner, which do you recommend for a first project?
For a beginner to AngularJS, don't check out Yeoman. It's a very useful tool remember, but before you use it, understand why it was built.
Start off with AngularJS's tutorial - it is one of the best tutorials out there. It tells you all that you need to know to explore off on your own. I started out with that and at the end of it, I just loved the entire framework.
I did not start off with Yeoman until building 2-3 applications using AngularJS. Once you do this, you figure out some common tasks that you carry out for every AngularJS application.
That's where Yeoman comes in. Rather than doing the same thing again and again for each application you use Yeoman to automate a lot of stuff. Once you know the why of using Yeoman, you will understand the how of using it.
Without having worked in AngularJS sufficiently, do not try to use Yeoman. You will enjoy the tool but then you will be left wondering how to work with AngularJS without it.
My 2 cents.
To smalls app, Yeoman is awesome. But you will know his limits when you will want to split your app into modules.
with yeoman, you will have a structure like that:
scripts/
controllers
controller1.js
controller2.js
...
directive/
...
But In large app you probably want to have:
scripts/
controllers
userModule
controller.js
myOtherModule
controller.js
...
directive/
...
And for that, you need to create manually all the files.
My advice is to always start with yeoman but use their route/directive/etc generator only at the begining of your project.
For the tests, it only generate a file and a very simple test, ofcourse you need to modify it, to cover your whole app.
In addition Yeoman provide you a lot of tools with grunt like minifications of your assets, a jshint to use the best coding practices, etc.

Coffeescript and CakePHP

Is there an easy way to use Coffeescript with CakePHP? Rails has Barista, but I haven't been able to find anything similar for CakePHP. Ideally, something transparent that would compile the coffeescript to javascript on-demand, and only when it has changed.
Google results for CakePHP & Coffeescript turn up a lot of talk over a clash between the cake command, but not much in the way of using them together. Has anyone found anything? Or maybe ideas on how I might implement such a plugin myself?
I know this isn't the answer you're looking for, but I usually handle this with a build script, either in Bash or Rake (yes, Rake, its great for building PHP projects too), which compiles, concats and compresses my .coffee files for production. While in development I use coffee -w to compile the .coffee files on the fly.
You could automate this further by adding a post-commit hook to Git or Subversion if you like.
You should be able to extend Mark Story's Asset Compress plugin to do the compiling on the fly as well.
You may want to look at kohana-coffeescript, which to my knowledge is the only project that does what you want in PHP. Although the project is nominally for the Kohana framework, it should be fairly easy to fork it and adapt it to CakePHP.

Resources