From f57916c0d9a51e6815e31be8c3ba82d7ce6c4abe Mon Sep 17 00:00:00 2001 From: Keen Yee Liau Date: Mon, 17 Dec 2018 17:56:35 -0800 Subject: [PATCH] fix(bazel): devserver entry_module should have underscore name (#27719) This commit fixes a bug whereby the path of the entry_module is not consistent with the workspace name, which does not permit dashes in the name. PR Close #27719 --- .../bazel-workspace/files/src/BUILD.bazel.template | 2 +- .../bazel/src/schematics/bazel-workspace/index_spec.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/bazel/src/schematics/bazel-workspace/files/src/BUILD.bazel.template b/packages/bazel/src/schematics/bazel-workspace/files/src/BUILD.bazel.template index 1e4fea7b5d..f3ce9dec8f 100644 --- a/packages/bazel/src/schematics/bazel-workspace/files/src/BUILD.bazel.template +++ b/packages/bazel/src/schematics/bazel-workspace/files/src/BUILD.bazel.template @@ -58,7 +58,7 @@ ts_devserver( "npm/node_modules/zone.js/dist", "npm/node_modules/tslib", ], - entry_module = "<%= name %>/src/main.dev", + entry_module = "<%= utils.underscore(name) %>/src/main.dev", serving_path = "/bundle.min.js", static_files = [ "@npm//node_modules/zone.js:dist/zone.min.js", diff --git a/packages/bazel/src/schematics/bazel-workspace/index_spec.ts b/packages/bazel/src/schematics/bazel-workspace/index_spec.ts index 211c750849..bf0efa4771 100644 --- a/packages/bazel/src/schematics/bazel-workspace/index_spec.ts +++ b/packages/bazel/src/schematics/bazel-workspace/index_spec.ts @@ -42,6 +42,15 @@ describe('Bazel-workspace Schematic', () => { expect(workspace).toMatch('ANGULAR_VERSION = "6.6.6"'); }); + it('should have the correct entry_module for devserver', () => { + const options = {...defaultOptions, name: 'demo-app'}; + const host = schematicRunner.runSchematic('bazel-workspace', options); + const {files} = host; + expect(files).toContain('/demo-app/src/BUILD.bazel'); + const content = host.readContent('/demo-app/src/BUILD.bazel'); + expect(content).toContain('entry_module = "demo_app/src/main.dev"'); + }); + describe('WORKSPACE', () => { it('should contain project name', () => { const options = {...defaultOptions};