Skip to content

Commit

Permalink
fix(@schematics/angular): update @angular peerDependencies for new …
Browse files Browse the repository at this point in the history
…libraries
  • Loading branch information
alan-agius4 authored and alexeagle committed Oct 19, 2018
1 parent c45fd96 commit 8e963da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "<%= dasherize(packageName) %>",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^6.0.0-rc.0 || ^6.0.0",
"@angular/core": "^6.0.0-rc.0 || ^6.0.0"
"@angular/common": "^<%= angularLatestVersion %>",
"@angular/core": "^<%= angularLatestVersion %>"
}
}
1 change: 1 addition & 0 deletions packages/schematics/angular/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export default function (options: LibraryOptions): Rule {
distRoot,
relativePathToWorkspaceRoot,
prefix,
angularLatestVersion: latestVersions.Angular.replace('~', '').replace('^', ''),
}),
// TODO: Moving inside `branchAndMerge` should work but is bugged right now.
// The __projectRoot__ is being used meanwhile.
Expand Down
7 changes: 7 additions & 0 deletions packages/schematics/angular/library/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ describe('Library Schematic', () => {
expect(fileContent).toMatch(/"name": "foo"/);
});

it('should have the latest Angular major versions in package.json named "foo"', () => {
const tree = schematicRunner.runSchematic('library', defaultOptions, workspaceTree);
const fileContent = getJsonFileContent(tree, '/projects/foo/package.json');
const angularVersion = latestVersions.Angular.replace('~', '').replace('^', '');
expect(fileContent.peerDependencies['@angular/core']).toBe(`^${angularVersion}`);
});

it('should create a tsconfig for library', () => {
const tree = schematicRunner.runSchematic('library', defaultOptions, workspaceTree);
const fileContent = getJsonFileContent(tree, '/projects/foo/tsconfig.lib.json');
Expand Down

0 comments on commit 8e963da

Please sign in to comment.