Skip to content

Computed values : seed.config #1429

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

Closed
lifaon74 opened this issue Oct 5, 2016 · 6 comments
Closed

Computed values : seed.config #1429

lifaon74 opened this issue Oct 5, 2016 · 6 comments

Comments

@lifaon74
Copy link

lifaon74 commented Oct 5, 2016

I re-open #968 because it's for me (and propably many users) still an important problem.

I work on windows 10, and computed values bother me a lot. Why :

  • build.prod is not working with external libraries like ng2-translate, moment, etc... WE need to add them into SYSTEM_BUILDER_CONFIG.packages.
  • some attributes like APP_CLIENT, APP_SRC are used to compute other attributes into seed.config.ts, so we can't edit it properly into project.config !

The consequences: everytime I pull ng2-seed (I do it frequently because I love your work), I have to merge the seed.config file and take care of any changes :(

A solution, as discussed into previous posts, could and should be to wrap all attributes into an init method called from the constructor of project.config.

Something like :

init() {
  // The purpose of init is to look if this.APP_SRC is already set (ex: from project.config). If not, set default value
  this.APP_SRC = (typeof this.APP_SRC === 'undefined') ? `src/${this.APP_CLIENT}` :  this.APP_SRC;

  // repeat for all attributes of seed.config
}

I sincerely hope, it will not be closed until resolved. Thanks.

@mgechev
Copy link
Owner

mgechev commented Oct 11, 2016

Yes, this is an important issue. What do you think about the decorator proposed by #968? Maybe init is a better solution since we don't introduce new syntax but only a convention.

@mgechev
Copy link
Owner

mgechev commented Oct 14, 2016

@lifaon74 let's use init method - seems cleaner, minimalistic with no extra syntax. Do you want to do the change, or I can take it next week?

@lifaon74
Copy link
Author

I dont realy have time, if you don't have too, maybe I'lll take a full evening and do it. As you want.

@mgechev
Copy link
Owner

mgechev commented Oct 25, 2016

I played with this task today. The init approach is not very clean:

  • We cannot provide default values (or if we want to, we need to introduce computations with different logic in seed.config.ts).
  • We need to introduce the convention to always invoke the init method in project.config.ts.
  • We will introduce breaking changes with the current way of adding packages (addPackageBundles).

Here is seed.config.ts for reference.

@mgechev mgechev closed this as completed Oct 25, 2016
@lifaon74
Copy link
Author

Hum,

  1. I don't see why you could'nt provide default values ?
  2. Why not ?

Another solution: what about a json config file ? Read by seed.config.ts which will extends its own attributes ? And then no more argv['base'], but something like argv['config-file']

@TheDonDope
Copy link
Contributor

@lifaon74 yikes! i actually dig that idea of the .json config file! Reminds me of angular-cli.json they use with angular-cli. Are you interested in sketching out a more detailed proposal? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants