Skip to content

Commit d2bdc72

Browse files
Move the functionality of updateServeOptions to removeProductionConfiguration
1 parent 71b433c commit d2bdc72

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

src/application/index.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ function modifyWorkspace(options: ApplicationOptions) {
7575
configureBuildConfigurations(project);
7676
configureTsLint(project);
7777
addTestOptions(project);
78-
updateServeOptions(project);
7978
removeProductionConfiguration(project);
8079
});
8180
}
@@ -86,6 +85,7 @@ function modifyWorkspace(options: ApplicationOptions) {
8685
*/
8786
function removeProductionConfiguration(project: ProjectDefinition) {
8887
const buildTarget = project.targets.get('build');
88+
const serveTarget = project.targets.get('serve');
8989
if (buildTarget === undefined) {
9090
throw new SchematicsException("Build target missing (build)");
9191
}
@@ -95,7 +95,14 @@ function removeProductionConfiguration(project: ProjectDefinition) {
9595
if (buildTarget.configurations.production === undefined) {
9696
throw new SchematicsException("Expected build options to be defined");
9797
}
98+
if (serveTarget === undefined) {
99+
throw new SchematicsException("Build target missing (serve)");
100+
}
101+
if (serveTarget.configurations === undefined) {
102+
throw new SchematicsException("Build target configurations missing (serve)");
103+
}
98104

105+
delete serveTarget.configurations.production;
99106
delete buildTarget.configurations.production;
100107
}
101108

@@ -127,18 +134,6 @@ function addBuildOptions(project: ProjectDefinition) {
127134
buildTarget.options['outputPath'] = 'dist';
128135
}
129136

130-
function updateServeOptions(project: ProjectDefinition) {
131-
const targets = project.targets;
132-
const serveTarget = targets.get('serve');
133-
if (serveTarget === undefined) {
134-
throw new SchematicsException("Build target missing (serve)");
135-
}
136-
if (serveTarget.configurations === undefined) {
137-
throw new SchematicsException("Build target configurations missing (serve)");
138-
}
139-
delete serveTarget.configurations.production;
140-
}
141-
142137
function addTestOptions(project: ProjectDefinition) {
143138
const testTarget = project.targets.get('test');
144139
if (testTarget === undefined) {

0 commit comments

Comments
 (0)