Skip to content

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

Merged
merged 2 commits into from
May 24, 2017

Conversation

sumitarora
Copy link
Contributor

Fixes: #6017

@sumitarora sumitarora requested review from hansl and Brocco April 20, 2017 15:08
@clydin
Copy link
Member

clydin commented Apr 20, 2017

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.

@sumitarora
Copy link
Contributor Author

@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.

Copy link

@leocaseiro leocaseiro left a 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' +

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' +

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'

@sumitarora
Copy link
Contributor Author

@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
Copy link
Contributor

@hansl hansl Apr 25, 2017

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) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hansl updated

@hansl
Copy link
Contributor

hansl commented Apr 25, 2017

The new Schematics will fix those errors entirely by not allowing side effects in blueprints. So I'm fine with patching dynamicPathParser for now.

@@ -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) {
Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sumitarora sumitarora force-pushed the fix-dry-run-folder branch from 7aaa396 to b90d56e Compare May 3, 2017 21:58
appConfig: any;
dryRun: boolean;
}

Copy link
Member

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 };

@filipesilva
Copy link
Contributor

@hansl are you happy with the changes?

Brocco
Brocco previously approved these changes May 17, 2017
hansl
hansl previously approved these changes May 17, 2017
@sumitarora sumitarora dismissed stale reviews from hansl and Brocco via 672b5f5 May 23, 2017 16:52
@sumitarora sumitarora force-pushed the fix-dry-run-folder branch from 2294dd5 to 672b5f5 Compare May 23, 2017 16:53
@Brocco Brocco merged commit a13e780 into angular:master May 24, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--dry-run generate creates empty folder when used with subfolder Eq: subfolder/component-name
7 participants