-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular/cli): add build defaults to config #6889
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
Conversation
1237102
to
7806019
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor things.
`)); | ||
} | ||
|
||
this.addAliases(cliConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer referring to static methods via the class name and not this
because this
conveys an instance member and not a static method. (same thing other places).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -61,6 +61,12 @@ export class CliConfig<JsonType> { | |||
this._config.$$set(jsonPath, value); | |||
} | |||
|
|||
public getPaths(baseJsonPath: string, keys: string[]) { | |||
const ret: { [k: string]: any } = {}; | |||
keys.forEach(key => ret[key] = this.get(`${baseJsonPath}.${key}`)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think map
makes more sense here
return keys.map(key => ({[key]: this.get(`${baseJsonPath}.${key}`)});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code and his are not equivalent :)
return keys.reduce((acc, k) => {
acc[key] = this.get(`${baseJsonPath}.${key}`);
return acc;
}, {});
might be more correct but more verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually spent a fair bit of time figure out what the best way to do this function was, I was torn between the reduce and forEach. The reduce also needs a typing for the accumulator:
return keys.reduce((acc, key) => {
acc[key] = this.get(`${baseJsonPath}.${key}`);
return acc;
}, {} as { [k: string]: any });
All the same to me though, I left the forEach for now but will change if there's a preference.
759eab6
to
67f7608
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds following defaults to `.angular-cli.json` under `defaults`: `sourcemaps`, `baseHref`, `progress`, `poll`, `deleteOutputPath`, `preserveSymlinks`, `showCircularDependencies`. They can be set via `ng set defaults.build.KEY = VALUE`. Also removes `apps.0.showCircularDependencies`. This is not a breaking chance since it was only added in 1.3.0-beta.0. Followup to angular#6884 (comment).
67f7608
to
3fb0e67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds following defaults to
.angular-cli.json
underdefaults
:sourcemaps
,baseHref
,progress
,poll
,deleteOutputPath
,preserveSymlinks
,showCircularDependencies
.They can be set via
ng set defaults.build.KEY = VALUE
.Also removes
apps.0.showCircularDependencies
. This is not a breaking chance since it was only added in 1.3.0-beta.0.Followup to #6884 (comment).