-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Application decoupling #913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi all! I really like the proposal, it does make a lot of sense to relocate this client specific to this more appropiate place. I agree, the advanced seed of @NathanWalker would benefit from this refactor. One point still sticks out for me: shouldn't the |
May be |
Great proposal @mgechev. Then you could have something like following for all sorts of scalability:
|
IMO "web" would be the most explicit without getting into something platform specific or non-descript like "public". Call it web / browser but it's probably best to keep it's naming related to the platform being used for delivery like the rest. |
I like |
What's nice about this direction is the platform specific naming conventions can be left for the user to decide:
|
|
Ok, let's call it |
Great idea @mgechev. This decoupling makes perfect sense. I also like |
Not that I want to debate it endlessly but if we are naming things based on the medium used as a content delivery method, |
I vote for |
... but the proposal rocks. |
It's a good debate and naming is always hard.
Platform examples: web, mobile, desktop, server, tv, xbox
Then there are the crossover vehicles like Just my 2 cents. |
It really comes down to how what and how you think about delivery mediums. To me In the end naming this is funky now because the lines between delivery mediums has been blurred significantly, which is only going to get worse. We could ask 100 people and it would probably be split down the middle for web / browser. In the end I think either choice conveys the intent well enough to get the purpose across. Either way, imo this refactoring idea is probably the most beneficial out of any that have landed. You can call it |
Just to bring extra water to the mill 😄(I want to see web
browser
That's pretty straight forward, isn't it ? |
I'll create the issue to inform the planet and just go ahead and assign that one to you @ludohenin . If you could get on that right after the whole offline compile feature, that would be great...thanks. |
Why not |
Just as @d3viant0ne said:
To add onto that, i'd like to quote Phil Karlton:
The corresponding PR isn't finished, so there could still be changes, and though i personally tend towards |
- Implements the application decoupling as discussed in #913. - Excludes karma.conf.js, protractor.conf.js and test-main.js from the copy build task, so that those files will not be copied over to /dist/** directory. Furthermore also excludes the tsconfig.json from this copy process, as it was copied over before too. - Updates the protractor configuration and associated gulp task. - Adds a e2e.singleRun gulp task to the gulpfile to leave the script in the package.json more compact. Also updates the README to include the new folder and file structure.
How about a |
@spicemix I really like the thought of that 👍 There will certainly be some universal/isomorphic code with this kind of setup. |
@TheDonDope I'll be using |
@TheDonDope - Are you still stuck on the what package goes where step to all of this? If so, i'll PR the changes into your current working branch on your fork so we can bring this one home. |
Since this topic is still under discussion, i want to propose to think about a workspace like structure to allow multiple projects to share one installation. With the current proposal, the decoupling of a custom project and the default seed project looks like:
To use it: Now looking to the advanced seed project, with the change proposed / agreed to by NathanWalker, the purpose of that client directory is somehow different. It is no longer a project container on its own but a target within the same project. Think of src/ as the project base dir, where in the previous example client/ was the project base dir.
An integration of myproject would be difficult, it would be on the same level as the project targets for desktop, mobile etc. So why not allowing both, an individuall project with its specific targets within one common workspace:
Maybe this can be even extended to allow more than one custom project. (Granted, this would need more thoughts on how to setup the individuall project settings and the build process.) |
that's a shame. |
@DmitryEfimenko , in progress :)) |
how do we get this issue going? I saw @TheDonDope 's branch. It does not look like it's too much work and I do believe that proper project structure is one of the most important things. @TheDonDope, were you close to being done with it? If so I could quickly repeat changes made by you and submit a PR against latest code |
@DmitryEfimenko The initial work that was done was only the tip of the iceberg, if you read through the comments you will see that there is a lot to be done ahead, and there already was a lot of time invested into this. So there will be no "quick finish" for this. Basically, one should take a look at the current status and come up with a detailed concept of things to be done still. Because the complexity is high enough, that one cannot simply start working on without beforehand analysis. Sorry, i don't want to be a downer here, just trying to manage expectations! Alas, if you still are on fire and want to work on this, after reading all the beforehand stuff, i wholeheartedly welcome you to open a new issue to get things started again, maybe starting to work on the analysis part. Cheerio Dope |
Move this code to reusable library and forget about multiple apps inside one repo, it's insanity. |
Not sure why 'client' folder exist, if it's the only folder in src. Just extra naming. |
Yeah, at this point I agree that it might be a better idea to drop the |
Disagree completely. |
It's weird to think all projects use nodejs as a server. |
And server is a completely different app with completely different dependencies. It's really weird way to reuse code by pushing everything into one huge mess - usually for code reuse people do exactly opposite - split code to reusable parts and move them out as libraries/modules/etc. |
@e-oz , okay, in the production build client-side app will be built to |
@vyakymenko , maybe because 'dist' should be cleaned before build. Or maybe because you can configure target (output) dir for build in gulpfile, without adding any additional folders to source. |
@e-oz , it's always cleaned:
// --------------
// Build prod.
gulp.task('build.prod', (done: any) =>
runSequence('clean.prod', // <----- @e-oz, clean folder
'tslint',
'css-lint',
'build.assets.prod',
'build.html_css',
'copy.client.js.prod',
'copy.server.js.prod',
'build.js.prod',
'build.bundles',
'build.bundles.app',
'build.index.prod',
'build.server.prod',
'copy.server.assets',
done));
/**
* The directory where the client files are located.
* The default directory is `client`.
* @type {string}
*/
APP_CLIENT = argv['client'] || 'whiskas';
// @e-oz, or add you own |
@vyakymenko that's what I'm talking about. If |
@e-oz , if you will configure your own task with another folder structure in And keep in mind, that all new/newbie developers will search that |
@vyakymenko in
Not sure what you are talking about. New developers are writing client-side app, so everything in src is client by default. Making them think "there should be something else besides client" will not make their life easier. |
@e-oz , If you try to learn
And injections, shims etc ? P.S. Don't want to start a holy war. |
Not sure want you want to prove. You want to add knowledge of nodejs (and ability to write dual-app code) as a requirement to use this seed? It's against that KISS principle. If not say more. I think I not only argumented my opinion but also found simple workaround for you, so I don't think I can add something to this talk. |
@DmitryEfimenko you really want to add server side? If yes seed should have every server side options to satisfy everyone (C#, Python, Java, PHP, node, etc.). I don't really see point to take that path. |
@e-oz , I want to say, that we have |
@vyakymenko yes, but different apps have different dependencies, and you have one package.json. Every version change will be nightmare. Having different apps in one repo is a very bad idea. |
And what if |
@tarlepp , |
@e-oz , I agree with you. But for sometimes, it's a must. P.S. I never use dual-apps, but I think that it can be. |
@vyakymenko "extra" work is eg. when seed updates to newer angular which will broke something. And this goes when there is |
@tarlepp , your But, I agree with your point ! For sometimes, |
@tarlepp , I was thinking about your point that you told in latest comment and have some real-world example of this
So, we will have 2 folders So we build one |
Idea 1: Idea 2: Idea 3: 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
The text was updated successfully, but these errors were encountered: