-
Notifications
You must be signed in to change notification settings - Fork 12k
fix(@angular/cli): fix issue of folder getting generated on dry run #6026
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
I think the underlying issue is that the dynamic path parser is doing more than just parsing. The directory creation probably shouldn't be there. |
@clydin Could be but then we would have to replicate it for all. Currently its centralized at one place and any change we need to make in regards of the paths we can do it here I believe. |
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.
Thanks for that @sumitarora.
I'm not sure if these strings: sda
and asda
should be here. So I pointed that out.
@@ -506,10 +506,10 @@ Blueprint.prototype.install = function(options) { | |||
ui.writeLine('installing ' + this.name); | |||
|
|||
if (dryRun) { | |||
ui.writeLine(chalk.yellow('You specified the dry-run flag, so no' + | |||
ui.writeLine(chalk.yellow('You specified the dry-run sda flag, so no' + |
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.
Sorry if I'm wrong, but it seems weird the sda
. Is that a typo?
'You specified the dry-run
sda
flag, so no'
@@ -541,7 +541,7 @@ Blueprint.prototype.uninstall = function(options) { | |||
ui.writeLine('uninstalling ' + this.name); | |||
|
|||
if (dryRun) { | |||
ui.writeLine(chalk.yellow('You specified the dry-run flag, so no' + | |||
ui.writeLine(chalk.yellow('You specified asda the dry-run flag, so no' + |
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.
(again) Sorry if I'm wrong, but it seems weird the asda
. Is that a typo?
'You specified
asda
the dry-run flag, so no'
f6df0f8
to
2dfeaae
Compare
@leocaseiro Thanks for review updated typos :P |
@@ -3,7 +3,8 @@ import * as process from 'process'; | |||
import * as fs from 'fs'; | |||
const stringUtils = require('ember-cli-string-utils'); | |||
|
|||
export function dynamicPathParser(project: any, entityName: string, appConfig: any) { | |||
export function dynamicPathParser |
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.
Parentheses should be on the same line. This should probably look like:
export function dynamicPathParser(project: any, entityName: string, appConfig: any,
dryRun: boolean) {
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.
@hansl updated
The new Schematics will fix those errors entirely by not allowing side effects in blueprints. So I'm fine with patching dynamicPathParser for now. |
2dfeaae
to
fb26b15
Compare
@@ -3,7 +3,8 @@ import * as process from 'process'; | |||
import * as fs from 'fs'; | |||
const stringUtils = require('ember-cli-string-utils'); | |||
|
|||
export function dynamicPathParser(project: any, entityName: string, appConfig: any) { | |||
export function dynamicPathParser(project: any, entityName: string, appConfig: any, | |||
dryRun: boolean) { |
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.
This should be defaulted to false
instead of having to pass it in every call.
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.
@Brocco what do you think of passing in options instead?
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 the options change would be a nice one, for when additional things are added. It will also simplify the defaulting of values assuming a class is used instead of an interface.
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
7aaa396
to
b90d56e
Compare
appConfig: any; | ||
dryRun: boolean; | ||
} | ||
|
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.
To allow defaults and improve encapsulation, what about something like:
export class DynamicPathOptions {
projectRoot: string;
sourceDirectory: string;
entityName: string;
dryRun?: boolean = true;
}
And then something like this in the function:
options = { ...new DynamicPathOptions, ...options };
b90d56e
to
2294dd5
Compare
@hansl are you happy with the changes? |
2294dd5
to
672b5f5
Compare
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. |
Fixes: #6017