forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmigration.ts
More file actions
47 lines (42 loc) · 1.34 KB
/
migration.ts
File metadata and controls
47 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { isJsonObject } from '@angular-devkit/core';
import { Rule } from '@angular-devkit/schematics';
import { allTargetOptions, updateWorkspace } from '../../utility/workspace';
import { Builders, ProjectType } from '../../utility/workspace-models';
/**
* Migration to update the angular workspace configuration.
*/
export default function (): Rule {
return updateWorkspace((workspace) => {
for (const project of workspace.projects.values()) {
if (project.extensions['projectType'] !== ProjectType.Application) {
continue;
}
for (const target of project.targets.values()) {
if (
target.builder !== Builders.Application &&
target.builder !== Builders.BuildApplication
) {
continue;
}
for (const [, options] of allTargetOptions(target)) {
const ssr = options['ssr'];
if (!ssr || !isJsonObject(ssr)) {
continue;
}
const platform = ssr['experimentalPlatform'];
if (platform) {
ssr['platform'] = platform;
delete ssr['experimentalPlatform'];
}
}
}
}
});
}