@schematics/angular 9.0.0-rc.6 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,10 +53,15 @@ function updateAppModule(mainPath) {
53
53
  // add import for environments
54
54
  // import { environment } from '../environments/environment';
55
55
  moduleSource = getTsSourceFile(host, modulePath);
56
- importModule = 'environment';
56
+ const environmentExportName = ast_utils_1.getEnvironmentExportName(moduleSource);
57
+ // if environemnt import already exists then use the found one
58
+ // otherwise use the default name
59
+ importModule = environmentExportName || 'environment';
57
60
  // TODO: dynamically find environments relative path
58
61
  importPath = '../environments/environment';
59
- if (!ast_utils_1.isImported(moduleSource, importModule, importPath)) {
62
+ if (!environmentExportName) {
63
+ // if environment import was not found then insert the new one
64
+ // with default path and default export name
60
65
  const change = ast_utils_1.insertImport(moduleSource, modulePath, importModule, importPath);
61
66
  if (change) {
62
67
  const recorder = host.beginUpdate(modulePath);
@@ -65,7 +70,7 @@ function updateAppModule(mainPath) {
65
70
  }
66
71
  }
67
72
  // register SW in app module
68
- const importText = `ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })`;
73
+ const importText = `ServiceWorkerModule.register('ngsw-worker.js', { enabled: ${importModule}.production })`;
69
74
  moduleSource = getTsSourceFile(host, modulePath);
70
75
  const metadataChanges = ast_utils_1.addSymbolToNgModuleMetadata(moduleSource, modulePath, 'imports', importText);
71
76
  if (metadataChanges) {
@@ -1,7 +1,7 @@
1
1
  load("@npm_bazel_typescript//:index.bzl", "ts_library")
2
2
 
3
- # files fetched on 2019-03-05 from
4
- # https://github.com/Microsoft/TypeScript/tree/v3.3.3333
3
+ # files fetched on 2020-01-09 from
4
+ # https://github.com/Microsoft/TypeScript/tree/v3.7.4
5
5
  licenses(["notice"]) # Apache 2.0
6
6
 
7
7
  ts_library(