From d841b3771ed610efed11bc342fafeddd361941d9 Mon Sep 17 00:00:00 2001 From: WilliamKoza Date: Sun, 10 Mar 2019 12:44:01 +0100 Subject: [PATCH] fix(@schematics/angular): change entry file name of the library schematic according to the kebab-case convention --- packages/schematics/angular/library/index_spec.ts | 8 ++++---- packages/schematics/angular/library/schema.json | 2 +- .../ng-packaged/projects/lib/ng-package.json | 2 +- .../projects/lib/src/{public_api.ts => public-api.ts} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/{public_api.ts => public-api.ts} (100%) diff --git a/packages/schematics/angular/library/index_spec.ts b/packages/schematics/angular/library/index_spec.ts index 234b44f411d4..6220a07fa23c 100644 --- a/packages/schematics/angular/library/index_spec.ts +++ b/packages/schematics/angular/library/index_spec.ts @@ -25,7 +25,7 @@ describe('Library Schematic', () => { ); const defaultOptions: GenerateLibrarySchema = { name: 'foo', - entryFile: 'my_index', + entryFile: 'my-index', skipPackageJson: false, skipTsConfig: false, skipInstall: false, @@ -51,7 +51,7 @@ describe('Library Schematic', () => { '/projects/foo/README.md', '/projects/foo/tslint.json', '/projects/foo/src/test.ts', - '/projects/foo/src/my_index.ts', + '/projects/foo/src/my-index.ts', '/projects/foo/src/lib/foo.module.ts', '/projects/foo/src/lib/foo.component.spec.ts', '/projects/foo/src/lib/foo.component.ts', @@ -89,7 +89,7 @@ describe('Library Schematic', () => { const tree = schematicRunner.runSchematic('library', defaultOptions, workspaceTree); const fileContent = getJsonFileContent(tree, '/projects/foo/ng-package.json'); expect(fileContent.lib).toBeDefined(); - expect(fileContent.lib.entryFile).toEqual('src/my_index.ts'); + expect(fileContent.lib.entryFile).toEqual('src/my-index.ts'); expect(fileContent.dest).toEqual('../../dist/foo'); }); @@ -97,7 +97,7 @@ describe('Library Schematic', () => { const tree = schematicRunner.runSchematic('library', { name: 'foobar', }, workspaceTree); - expect(tree.files).toContain('/projects/foobar/src/public_api.ts'); + expect(tree.files).toContain('/projects/foobar/src/public-api.ts'); }); it(`should add library to workspace`, () => { diff --git a/packages/schematics/angular/library/schema.json b/packages/schematics/angular/library/schema.json index 2739b644b174..d199c76eb893 100644 --- a/packages/schematics/angular/library/schema.json +++ b/packages/schematics/angular/library/schema.json @@ -19,7 +19,7 @@ "type": "string", "format": "path", "description": "The path at which to create the library's public API file, relative to the workspace root.", - "default": "public_api" + "default": "public-api" }, "prefix": { "type": "string", diff --git a/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/ng-package.json b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/ng-package.json index 36fcf49d9c1b..cce46c5a8b7b 100644 --- a/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/ng-package.json +++ b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/ng-package.json @@ -2,6 +2,6 @@ "$schema": "../../../../../../node_modules/ng-packagr/ng-package.schema.json", "dest": "../../dist/lib", "lib": { - "entryFile": "src/public_api.ts" + "entryFile": "src/public-api.ts" } } \ No newline at end of file diff --git a/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/public_api.ts b/tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/public-api.ts similarity index 100% rename from tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/public_api.ts rename to tests/angular_devkit/build_ng_packagr/ng-packaged/projects/lib/src/public-api.ts