Skip to content

refactor: Consolidate adding dependencies#11131

Merged
filipesilva merged 1 commit intoangular:masterfrom
Brocco:add-pkg-json-deps
Jun 8, 2018
Merged

refactor: Consolidate adding dependencies#11131
filipesilva merged 1 commit intoangular:masterfrom
Brocco:add-pkg-json-deps

Conversation

@Brocco
Copy link
Copy Markdown
Contributor

@Brocco Brocco commented Jun 6, 2018

No description provided.

@Brocco Brocco requested a review from hansl as a code owner June 6, 2018 18:04
@Brocco Brocco mentioned this pull request Jun 6, 2018
@Brocco Brocco force-pushed the add-pkg-json-deps branch from f7c4c37 to 5ce058c Compare June 7, 2018 17:06
]), MergeStrategy.Overwrite),
schematic('e2e', e2eOptions),
]);
])(host, context);
Copy link
Copy Markdown
Contributor

@hansl hansl Jun 8, 2018

Choose a reason for hiding this comment

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

Please undo.

}
},
]);
])(host, context);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please undo.

node: JsonAstObject,
propertyName: string,
value: JsonValue,
indent = 4,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Default for most JSON is 2.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indent is defaulted to 4, because the typical use case is to add a value to an existing object (i.e. dependencies, devDependencies) It could be removed as a default to make it more explicit.

import { UnitTestTree } from '@angular-devkit/schematics/testing';
import { insertPropertyInAstObjectInOrder } from './json-utils';

type Pojo = {
Copy link
Copy Markdown
Contributor

@hansl hansl Jun 8, 2018

Choose a reason for hiding this comment

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

Not Pojso? ;)

@Brocco Brocco force-pushed the add-pkg-json-deps branch from 5ce058c to 9cecfb1 Compare June 8, 2018 17:41
return JSON.parse(tree.readContent(filePath));
}

it('should insert a first prop', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should have a test where you call insertProperty... multiple times in a row.

@Brocco Brocco force-pushed the add-pkg-json-deps branch from 9cecfb1 to 04695d2 Compare June 8, 2018 18:01
@filipesilva filipesilva merged commit d3b49a5 into angular:master Jun 8, 2018
@gkalpak gkalpak mentioned this pull request Jun 11, 2018
@angular-automatic-lock-bot
Copy link
Copy Markdown

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
@Brocco Brocco deleted the add-pkg-json-deps branch November 28, 2022 02:49
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.

4 participants