Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(@angular-devkit/build-angular): accept boolean and string in ssr option #25858

Merged
merged 1 commit into from Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/angular/ssr/schematics/ng-add/index.ts
Expand Up @@ -109,7 +109,7 @@ function updateApplicationBuilderWorkspaceConfigRule(
}

prodConfig.prerender = true;
(prodConfig.ssr ??= {}).entry = join(normalize(projectRoot), 'server.ts');
prodConfig.ssr = join(normalize(projectRoot), 'server.ts');
});
};
}
Expand Down
Expand Up @@ -197,11 +197,9 @@ export async function normalizeOptions(
let ssrOptions;
if (options.ssr === true) {
ssrOptions = {};
} else if (typeof options.ssr === 'object') {
const { entry } = options.ssr;

} else if (typeof options.ssr === 'string') {
ssrOptions = {
entry: entry && path.join(workspaceRoot, entry),
entry: path.join(workspaceRoot, options.ssr),
};
}

Expand Down
Expand Up @@ -452,14 +452,8 @@
"description": "Enable the server bundles to be written to disk."
},
{
"type": "object",
"properties": {
"entry": {
"type": "string",
"description": "The server entry-point that when executed will spawn the web server."
}
},
"additionalProperties": false
"type": "string",
"description": "The server entry-point that when executed will spawn the web server."
}
]
},
Expand Down
Expand Up @@ -27,9 +27,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
harness.useTarget('build', {
...BASE_OPTIONS,
server: 'src/main.server.ts',
ssr: {
entry: 'src/server.ts',
},
ssr: 'src/server.ts',
});

const { result } = await harness.executeOnce();
Expand All @@ -45,9 +43,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
harness.useTarget('build', {
...BASE_OPTIONS,
server: 'src/main.server.ts',
ssr: {
entry: '/file.mjs',
},
ssr: '/file.mjs',
});

const { result } = await harness.executeOnce();
Expand Down