Closed mgechev closed 8 years ago
@tarlepp , your tree
it's a seed project
, and folder's like client
it's a branch
(some first app with same dependencies), then you add another branch
, folder fo example admin
, and we have one tree
with 2 branches
.
But, I agree with your point !
For sometimes, tree
can be.
@tarlepp , I was thinking about your point that you told in latest comment and have some real-world example of this seed
vision.
One project
--> One seed
, it's a must for good project support.
One project
can have multi-applications, real example:
Tetris
game.free
and pay
versions, all of them based on free
version.Pay
version have some additional features, more figures
and no advertising
.So, we will have 2 folders client
, client-pay
for example.
And by the way, the client-pay
can import, extend client
(base) functionality, and we can add another feature for pay
version.
We can update client
(free) core for 2 applications.
So we build one project
(angular2-seed) with dual-application.
Idea 1:
The SystemJS builder requires a config and the main.ts file. It recursively looks for all the imports, then using rollup and tree shaking to create the build. You can use this feature to have multiple app files -- mainTetrisFree.ts, mainTetrisPay.ts -- to create different builds. Each main file can import the proper feature set -- free or pay -- as needed and a gulp task wrapper to support each.
Idea 2:
SystemJS supports conditional loading. You can import the appropriate feature based on environment flags.
Idea 3: In conjunction with the ideas above, features can be shared via namespaced npm modules.
Any idea requires you to contend with the <%= SOME_VARIABLE %> variables.
My fork now has an example of SystemJS Conditional Substitution feature -- loading/building and app to include featureA or featureB based on configuration. This is just a PoC to see how you can handle decoupling with SystemJS.
Purpose
Allow easier development of multi-platform applications with easy code reuse across them.
Make the entire client-side application and its dependencies, decoupled from the build process and encapsulated inside
src/client
.Background
At the moment we have our client application in the
src/client
directory and the build-related tasks intools
. Although we have this separation, all the client-side related dependencies and testing configuration are global (test-main.js
,karma.config.js
,protractor.config.js
).This makes it unpractical to use the seed for development of multiple Angular applications for different platforms which are sharing common features.
For instance, in case we want to develop backend for the current application, which reuses some of the logic which is already defined by services in the client-side, we need to:
package.json
file where we have the tooling related dependencies and client side related dependencies.src/server
.This approach is not modular and has several drawbacks:
src/server
).Proposal
src/client
.package.json
in the root of the project and move all others tosrc/client/package.json
.@NathanWalker's advanced seed should benefit a lot from the proposal above.
// cc @ludohenin @d3viant0ne @TheDonDope @nareshbhatia