This version was mostly created to improve the separation of concerns of the generated app. Different parts were already easily decoupled, but the user had to do it by hand, so we decided to help you.
The generator is being used like never before, different people with different skills and different contexts have joined and we have to try to help everybody, here's how this version went:
Separated Static Server
Now, there's an option to use a different server for static files. Before such change, if you wanted to have Nginx serving your static files, you'd have to create the app and remove some files by hand, right now this is done automagically when you answer the question: Do you want to use a different static server? Such as nginx, apache, IIS?'
. Keep in mind the generator doesn't give you any config file for such static server, it just removes the reponsability from the server.
Initial support for Cordova
Some people asked for this one (first talked to @bernardbr), mostly because it seemed to be pretty straight forward to turn the generated files into a "Cordova friendly" type of app. So, we created an option Are you using Cordova (for mobile development)?
to help you with the boilerplate. Few things change in the application, really. Between the changes: removes <base href="/" />
, adds <meta .../>
specific for Cordova, adds cordova.js
in index.html
and uses html5Mode(false)
.
One point, though: such option only shows up when you choose a client only app and ng1; ng2 is not supported yet.
Security
Do not serve files from the root anymore.
To make things easier for Angular 2 people, we don't use many magic bundlers and suchs. The problem is that that makes us look for dependencies inside node_modules
directly, and we had to map the root in the static middleware to have access to such folder.
That doesn't happen anymore when you have a fullstack app. Now, the paths served are: client/dev
(dev), client/dist
(dist) and node_modules
(both dev and dist).
Such changes lead to changing the way Angular 2 components reach out to templateUrl
and styleUrls
. Before we'd have: client/dev/todo/templates/todo.html
and now we have todo/templates/todo.html
.
Same happened to the deps in index.html
.
- Before:
<script src="node_modules/angular2/bundles/angular2.js?rev=@@hash"></script>
; - After:
<script src="./angular2/bundles/angular2.js?rev=@@hash"></script>
.
Single option to run server and client watcher
As suggested by @georgeedwards, we're now using concurrently
, a module that let us run npm start
(to start server) and npm run watch
(to open browser and watch client).
All you have to do is run the following:
- Fullstack app:
npm run dev
(starts server and starts browser with watcher); - Server app:
npm start
(starts server); - Cliente app:
npm start
(starts browser with watcher);
Protections and bug fixes
A bunch of protections and bug fixes were taken care of, thanks everybody who reported issues and gave feedbacks.
Next steps
Some of the changes are pretty straight forward, but depend on external modules, such as:
Others are a bit more vague and I've got to study them before createing new subgenerators and suchs.