@schematics/angular 19.0.0-next.8 → 19.0.0-rc.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.
- package/LICENSE +5 -5
- package/app-shell/index.js +71 -74
- package/app-shell/schema.d.ts +4 -0
- package/app-shell/schema.json +5 -0
- package/application/files/module-files/src/app/app.component.spec.ts.template +4 -2
- package/application/files/module-files/src/app/app.component.ts.template +2 -1
- package/application/files/module-files/src/app/app.module.ts.template +2 -2
- package/application/files/module-files/src/main.ts.template +1 -2
- package/application/files/standalone-files/src/app/app.component.spec.ts.template +4 -2
- package/application/files/standalone-files/src/app/app.component.ts.template +0 -1
- package/application/files/standalone-files/src/app/app.config.ts.template +2 -2
- package/application/index.js +3 -2
- package/application/schema.d.ts +9 -0
- package/application/schema.json +9 -0
- package/collection.json +2 -2
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +3 -2
- package/component/index.js +1 -0
- package/config/files/.browserslistrc.template +1 -0
- package/directive/files/__name@dasherize@if-flat__/__name@dasherize__.directive.ts.template +2 -2
- package/directive/index.js +1 -0
- package/library/files/README.md.template +49 -10
- package/ng-new/index.js +2 -0
- package/ng-new/schema.d.ts +9 -0
- package/ng-new/schema.json +9 -0
- package/package.json +3 -3
- package/pipe/files/__name@dasherize@if-flat__/__name@dasherize__.pipe.ts.template +2 -2
- package/server/files/application-builder/ngmodule-src/app/app.module.server.ts.template +13 -0
- package/server/files/application-builder/ngmodule-src/app/app.routes.server.ts.template +8 -0
- package/server/files/application-builder/standalone-src/app/app.config.server.ts.template +14 -0
- package/server/files/application-builder/standalone-src/app/app.routes.server.ts.template +8 -0
- package/server/files/server-builder/ngmodule-src/main.server.ts.template +1 -0
- package/server/files/server-builder/standalone-src/main.server.ts.template +7 -0
- package/server/index.js +16 -6
- package/server/schema.d.ts +5 -0
- package/server/schema.json +4 -0
- package/service-worker/files/ngsw-config.json.template +1 -0
- package/ssr/files/application-builder/server.ts.template +57 -42
- package/ssr/files/application-builder-common-engine/server.ts.template +65 -0
- package/ssr/files/server-builder/server.ts.template +1 -1
- package/ssr/index.js +20 -18
- package/ssr/schema.d.ts +5 -0
- package/ssr/schema.json +6 -0
- package/utility/latest-versions/package.json +1 -1
- package/utility/latest-versions.js +2 -2
- package/utility/workspace-models.d.ts +1 -1
- package/utility/workspace-models.js +1 -1
- package/workspace/files/README.md.template +41 -9
- /package/server/files/{src → application-builder/ngmodule-src}/main.server.ts.template +0 -0
- /package/server/files/{standalone-src → application-builder/standalone-src}/main.server.ts.template +0 -0
- /package/server/files/{src → server-builder/ngmodule-src}/app/app.module.server.ts.template +0 -0
- /package/server/files/{root → server-builder/root}/tsconfig.server.json.template +0 -0
- /package/server/files/{standalone-src → server-builder/standalone-src}/app/app.config.server.ts.template +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
|
2
|
+
import { provideServerRendering } from '@angular/platform-server';<% if(serverRouting) { %>
|
|
3
|
+
import { provideServerRoutesConfig } from '@angular/ssr';<% } %>
|
|
4
|
+
import { appConfig } from './app.config';<% if(serverRouting) { %>
|
|
5
|
+
import { serverRoutes } from './app.routes.server';<% } %>
|
|
6
|
+
|
|
7
|
+
const serverConfig: ApplicationConfig = {
|
|
8
|
+
providers: [
|
|
9
|
+
provideServerRendering(),<% if(serverRouting) { %>
|
|
10
|
+
provideServerRoutesConfig(serverRoutes)<% } %>
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const config = mergeApplicationConfig(appConfig, serverConfig);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AppServerModule as default } from './app/app.module.server';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
2
|
+
import { AppComponent } from './app/app.component';
|
|
3
|
+
import { config } from './app/app.config.server';
|
|
4
|
+
|
|
5
|
+
const bootstrap = () => bootstrapApplication(AppComponent, config);
|
|
6
|
+
|
|
7
|
+
export default bootstrap;
|
package/server/index.js
CHANGED
|
@@ -83,11 +83,14 @@ function updateConfigFileApplicationBuilder(options) {
|
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
const buildTarget = project.targets.get('build');
|
|
86
|
-
if (buildTarget
|
|
87
|
-
|
|
86
|
+
if (!buildTarget) {
|
|
87
|
+
return;
|
|
88
88
|
}
|
|
89
89
|
buildTarget.options ??= {};
|
|
90
90
|
buildTarget.options['server'] = node_path_1.posix.join(project.sourceRoot ?? node_path_1.posix.join(project.root, 'src'), serverMainEntryName);
|
|
91
|
+
if (options.serverRouting) {
|
|
92
|
+
buildTarget.options['outputMode'] = 'static';
|
|
93
|
+
}
|
|
91
94
|
});
|
|
92
95
|
}
|
|
93
96
|
function updateTsConfigFile(tsConfigPath) {
|
|
@@ -137,7 +140,8 @@ function default_1(options) {
|
|
|
137
140
|
if (!clientBuildTarget) {
|
|
138
141
|
throw (0, project_targets_1.targetBuildNotFoundError)();
|
|
139
142
|
}
|
|
140
|
-
const isUsingApplicationBuilder = clientBuildTarget.builder === workspace_models_1.Builders.Application
|
|
143
|
+
const isUsingApplicationBuilder = clientBuildTarget.builder === workspace_models_1.Builders.Application ||
|
|
144
|
+
clientBuildTarget.builder === workspace_models_1.Builders.BuildApplication;
|
|
141
145
|
if (clientProject.targets.has('server') ||
|
|
142
146
|
(isUsingApplicationBuilder && clientBuildTarget.options?.server !== undefined)) {
|
|
143
147
|
// Server has already been added.
|
|
@@ -146,12 +150,18 @@ function default_1(options) {
|
|
|
146
150
|
const clientBuildOptions = clientBuildTarget.options;
|
|
147
151
|
const browserEntryPoint = await (0, util_1.getMainFilePath)(host, options.project);
|
|
148
152
|
const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, browserEntryPoint);
|
|
149
|
-
const
|
|
153
|
+
const sourceRoot = clientProject.sourceRoot ?? (0, core_1.join)((0, core_1.normalize)(clientProject.root), 'src');
|
|
154
|
+
let filesUrl = `./files/${isUsingApplicationBuilder ? 'application-builder/' : 'server-builder/'}`;
|
|
155
|
+
filesUrl += isStandalone ? 'standalone-src' : 'ngmodule-src';
|
|
156
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)(filesUrl), [
|
|
157
|
+
options.serverRouting
|
|
158
|
+
? (0, schematics_1.noop)()
|
|
159
|
+
: (0, schematics_1.filter)((path) => !path.endsWith('app.routes.server.ts.template')),
|
|
150
160
|
(0, schematics_1.applyTemplates)({
|
|
151
161
|
...schematics_1.strings,
|
|
152
162
|
...options,
|
|
153
163
|
}),
|
|
154
|
-
(0, schematics_1.move)(
|
|
164
|
+
(0, schematics_1.move)(sourceRoot),
|
|
155
165
|
]);
|
|
156
166
|
const clientTsConfig = (0, core_1.normalize)(clientBuildOptions.tsConfig);
|
|
157
167
|
const tsConfigExtends = (0, core_1.basename)(clientTsConfig);
|
|
@@ -164,7 +174,7 @@ function default_1(options) {
|
|
|
164
174
|
updateTsConfigFile(clientBuildOptions.tsConfig),
|
|
165
175
|
]
|
|
166
176
|
: [
|
|
167
|
-
(0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/root'), [
|
|
177
|
+
(0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/server-builder/root'), [
|
|
168
178
|
(0, schematics_1.applyTemplates)({
|
|
169
179
|
...schematics_1.strings,
|
|
170
180
|
...options,
|
package/server/schema.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export interface Schema {
|
|
|
6
6
|
* The name of the project.
|
|
7
7
|
*/
|
|
8
8
|
project: string;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a server application using the Server Routing and App Engine APIs (Developer
|
|
11
|
+
* Preview).
|
|
12
|
+
*/
|
|
13
|
+
serverRouting?: boolean;
|
|
9
14
|
/**
|
|
10
15
|
* Do not install packages for dependencies.
|
|
11
16
|
*/
|
package/server/schema.json
CHANGED
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"description": "Do not install packages for dependencies.",
|
|
18
18
|
"type": "boolean",
|
|
19
19
|
"default": false
|
|
20
|
+
},
|
|
21
|
+
"serverRouting": {
|
|
22
|
+
"description": "Creates a server application using the Server Routing and App Engine APIs (Developer Preview).",
|
|
23
|
+
"type": "boolean"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"required": ["project"]
|
|
@@ -1,57 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
AngularNodeAppEngine,
|
|
3
|
+
createNodeRequestHandler,
|
|
4
|
+
isMainModule,
|
|
5
|
+
writeResponseToNodeResponse,
|
|
6
|
+
} from '@angular/ssr/node';
|
|
3
7
|
import express from 'express';
|
|
8
|
+
import { dirname, resolve } from 'node:path';
|
|
4
9
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { dirname, join, resolve } from 'node:path';
|
|
6
|
-
import <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %> from './src/main.server';
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const server = express();
|
|
11
|
-
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
const browserDistFolder = resolve(serverDistFolder, '../<%= browserDistDirectory %>');
|
|
13
|
-
const indexHtml = join(serverDistFolder, 'index.server.html');
|
|
11
|
+
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const browserDistFolder = resolve(serverDistFolder, '../<%= browserDistDirectory %>');
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
const app = express();
|
|
15
|
+
const angularApp = new AngularNodeAppEngine();
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Example Express Rest API endpoints can be defined here.
|
|
19
|
+
* Uncomment and define endpoints as necessary.
|
|
20
|
+
*
|
|
21
|
+
* Example:
|
|
22
|
+
* ```ts
|
|
23
|
+
* app.get('/api/**', (req, res) => {
|
|
24
|
+
* // Handle API request
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Serve static files from /<%= browserDistDirectory %>
|
|
31
|
+
*/
|
|
32
|
+
app.get(
|
|
33
|
+
'**',
|
|
34
|
+
express.static(browserDistFolder, {
|
|
24
35
|
maxAge: '1y',
|
|
25
36
|
index: 'index.html',
|
|
26
|
-
|
|
37
|
+
setHeaders: (res) => {
|
|
38
|
+
const headers = angularApp.getPrerenderHeaders(res.req);
|
|
39
|
+
for (const [key, value] of headers) {
|
|
40
|
+
res.setHeader(key, value);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
27
45
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Handle all other requests by rendering the Angular application.
|
|
48
|
+
*/
|
|
49
|
+
app.get('**', (req, res, next) => {
|
|
50
|
+
angularApp
|
|
51
|
+
.render(req)
|
|
52
|
+
.then((response) =>
|
|
53
|
+
response ? writeResponseToNodeResponse(response, res) : next(),
|
|
54
|
+
)
|
|
55
|
+
.catch(next);
|
|
56
|
+
});
|
|
31
57
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
publicPath: browserDistFolder,
|
|
38
|
-
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
|
|
39
|
-
})
|
|
40
|
-
.then((html) => res.send(html))
|
|
41
|
-
.catch((err) => next(err));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return server;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function run(): void {
|
|
58
|
+
/**
|
|
59
|
+
* Start the server if this module is the main entry point.
|
|
60
|
+
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
|
|
61
|
+
*/
|
|
62
|
+
if (isMainModule(import.meta.url)) {
|
|
48
63
|
const port = process.env['PORT'] || 4000;
|
|
49
|
-
|
|
50
|
-
// Start up the Node server
|
|
51
|
-
const server = app();
|
|
52
|
-
server.listen(port, () => {
|
|
64
|
+
app.listen(port, () => {
|
|
53
65
|
console.log(`Node Express server listening on http://localhost:${port}`);
|
|
54
66
|
});
|
|
55
67
|
}
|
|
56
68
|
|
|
57
|
-
|
|
69
|
+
/**
|
|
70
|
+
* The request handler used by the Angular CLI (dev-server and during build).
|
|
71
|
+
*/
|
|
72
|
+
export const reqHandler = createNodeRequestHandler(app);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { APP_BASE_HREF } from '@angular/common';
|
|
2
|
+
import { CommonEngine, isMainModule } from '@angular/ssr/node';
|
|
3
|
+
import express from 'express';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %> from './main.server';
|
|
7
|
+
|
|
8
|
+
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const browserDistFolder = resolve(serverDistFolder, '../<%= browserDistDirectory %>');
|
|
10
|
+
const indexHtml = join(serverDistFolder, 'index.server.html');
|
|
11
|
+
|
|
12
|
+
const app = express();
|
|
13
|
+
const commonEngine = new CommonEngine();
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Example Express Rest API endpoints can be defined here.
|
|
17
|
+
* Uncomment and define endpoints as necessary.
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
* ```ts
|
|
21
|
+
* app.get('/api/**', (req, res) => {
|
|
22
|
+
* // Handle API request
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Serve static files from /<%= browserDistDirectory %>
|
|
29
|
+
*/
|
|
30
|
+
app.get(
|
|
31
|
+
'**',
|
|
32
|
+
express.static(browserDistFolder, {
|
|
33
|
+
maxAge: '1y',
|
|
34
|
+
index: 'index.html'
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Handle all other requests by rendering the Angular application.
|
|
40
|
+
*/
|
|
41
|
+
app.get('**', (req, res, next) => {
|
|
42
|
+
const { protocol, originalUrl, baseUrl, headers } = req;
|
|
43
|
+
|
|
44
|
+
commonEngine
|
|
45
|
+
.render({
|
|
46
|
+
<% if (isStandalone) { %>bootstrap<% } else { %>bootstrap: AppServerModule<% } %>,
|
|
47
|
+
documentFilePath: indexHtml,
|
|
48
|
+
url: `${protocol}://${headers.host}${originalUrl}`,
|
|
49
|
+
publicPath: browserDistFolder,
|
|
50
|
+
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
|
|
51
|
+
})
|
|
52
|
+
.then((html) => res.send(html))
|
|
53
|
+
.catch((err) => next(err));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Start the server if this module is the main entry point.
|
|
58
|
+
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
|
|
59
|
+
*/
|
|
60
|
+
if (isMainModule(import.meta.url)) {
|
|
61
|
+
const port = process.env['PORT'] || 4000;
|
|
62
|
+
app.listen(port, () => {
|
|
63
|
+
console.log(`Node Express server listening on http://localhost:${port}`);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -5,7 +5,7 @@ import { CommonEngine } from '@angular/ssr/node';
|
|
|
5
5
|
import * as express from 'express';
|
|
6
6
|
import { existsSync } from 'node:fs';
|
|
7
7
|
import { join } from 'node:path';
|
|
8
|
-
import <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %> from './
|
|
8
|
+
import <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %> from './main.server';
|
|
9
9
|
|
|
10
10
|
// The Express app is exported so that it can be used by serverless Functions.
|
|
11
11
|
export function app(): express.Express {
|
package/ssr/index.js
CHANGED
|
@@ -108,15 +108,14 @@ function updateApplicationBuilderTsConfigRule(options) {
|
|
|
108
108
|
// No tsconfig path
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
111
|
+
const json = new json_file_1.JSONFile(host, tsConfigPath);
|
|
112
|
+
const filesPath = ['files'];
|
|
113
|
+
const files = new Set(json.get(filesPath) ?? []);
|
|
114
|
+
files.add('src/server.ts');
|
|
115
|
+
json.modify(filesPath, [...files]);
|
|
117
116
|
};
|
|
118
117
|
}
|
|
119
|
-
function updateApplicationBuilderWorkspaceConfigRule(
|
|
118
|
+
function updateApplicationBuilderWorkspaceConfigRule(projectSourceRoot, options, { logger }) {
|
|
120
119
|
return (0, utility_1.updateWorkspace)((workspace) => {
|
|
121
120
|
const buildTarget = workspace.projects.get(options.project)?.targets.get('build');
|
|
122
121
|
if (!buildTarget) {
|
|
@@ -140,14 +139,15 @@ function updateApplicationBuilderWorkspaceConfigRule(projectRoot, options, { log
|
|
|
140
139
|
buildTarget.options = {
|
|
141
140
|
...buildTarget.options,
|
|
142
141
|
outputPath,
|
|
143
|
-
|
|
142
|
+
outputMode: options.serverRouting ? 'server' : undefined,
|
|
143
|
+
prerender: options.serverRouting ? undefined : true,
|
|
144
144
|
ssr: {
|
|
145
|
-
entry: (0, core_1.join)((0, core_1.normalize)(
|
|
145
|
+
entry: (0, core_1.join)((0, core_1.normalize)(projectSourceRoot), 'server.ts'),
|
|
146
146
|
},
|
|
147
147
|
};
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
function updateWebpackBuilderWorkspaceConfigRule(options) {
|
|
150
|
+
function updateWebpackBuilderWorkspaceConfigRule(projectSourceRoot, options) {
|
|
151
151
|
return (0, utility_1.updateWorkspace)((workspace) => {
|
|
152
152
|
const projectName = options.project;
|
|
153
153
|
const project = workspace.projects.get(projectName);
|
|
@@ -156,7 +156,7 @@ function updateWebpackBuilderWorkspaceConfigRule(options) {
|
|
|
156
156
|
}
|
|
157
157
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
158
158
|
const serverTarget = project.targets.get('server');
|
|
159
|
-
(serverTarget.options ??= {}).main =
|
|
159
|
+
(serverTarget.options ??= {}).main = node_path_1.posix.join(projectSourceRoot, 'server.ts');
|
|
160
160
|
const serveSSRTarget = project.targets.get(SERVE_SSR_TARGET_NAME);
|
|
161
161
|
if (serveSSRTarget) {
|
|
162
162
|
return;
|
|
@@ -216,7 +216,7 @@ function updateWebpackBuilderServerTsConfigRule(options) {
|
|
|
216
216
|
}
|
|
217
217
|
const tsConfig = new json_file_1.JSONFile(host, tsConfigPath);
|
|
218
218
|
const filesAstNode = tsConfig.get(['files']);
|
|
219
|
-
const serverFilePath = 'server.ts';
|
|
219
|
+
const serverFilePath = 'src/server.ts';
|
|
220
220
|
if (Array.isArray(filesAstNode) && !filesAstNode.some(({ text }) => text === serverFilePath)) {
|
|
221
221
|
tsConfig.modify(['files'], [...filesAstNode, serverFilePath]);
|
|
222
222
|
}
|
|
@@ -242,7 +242,7 @@ function addDependencies({ skipInstall }, isUsingApplicationBuilder) {
|
|
|
242
242
|
}
|
|
243
243
|
return (0, schematics_1.chain)(rules);
|
|
244
244
|
}
|
|
245
|
-
function addServerFile(options, isStandalone) {
|
|
245
|
+
function addServerFile(projectSourceRoot, options, isStandalone) {
|
|
246
246
|
return async (host) => {
|
|
247
247
|
const projectName = options.project;
|
|
248
248
|
const workspace = await (0, utility_1.readWorkspace)(host);
|
|
@@ -254,14 +254,15 @@ function addServerFile(options, isStandalone) {
|
|
|
254
254
|
const browserDistDirectory = isUsingApplicationBuilder
|
|
255
255
|
? (await getApplicationBuilderOutputPaths(host, projectName)).browser
|
|
256
256
|
: await getLegacyOutputPaths(host, projectName, 'build');
|
|
257
|
-
|
|
257
|
+
const applicationBuilderFiles = 'application-builder' + (options.serverRouting ? '' : '-common-engine');
|
|
258
|
+
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./files/${isUsingApplicationBuilder ? applicationBuilderFiles : 'server-builder'}`), [
|
|
258
259
|
(0, schematics_1.applyTemplates)({
|
|
259
260
|
...core_1.strings,
|
|
260
261
|
...options,
|
|
261
262
|
browserDistDirectory,
|
|
262
263
|
isStandalone,
|
|
263
264
|
}),
|
|
264
|
-
(0, schematics_1.move)(
|
|
265
|
+
(0, schematics_1.move)(projectSourceRoot),
|
|
265
266
|
]));
|
|
266
267
|
};
|
|
267
268
|
}
|
|
@@ -275,6 +276,7 @@ function default_1(options) {
|
|
|
275
276
|
throw (0, project_targets_1.targetBuildNotFoundError)();
|
|
276
277
|
}
|
|
277
278
|
const isUsingApplicationBuilder = usingApplicationBuilder(clientProject);
|
|
279
|
+
const sourceRoot = clientProject.sourceRoot ?? node_path_1.posix.join(clientProject.root, 'src');
|
|
278
280
|
return (0, schematics_1.chain)([
|
|
279
281
|
(0, schematics_1.schematic)('server', {
|
|
280
282
|
...options,
|
|
@@ -282,14 +284,14 @@ function default_1(options) {
|
|
|
282
284
|
}),
|
|
283
285
|
...(isUsingApplicationBuilder
|
|
284
286
|
? [
|
|
285
|
-
updateApplicationBuilderWorkspaceConfigRule(
|
|
287
|
+
updateApplicationBuilderWorkspaceConfigRule(sourceRoot, options, context),
|
|
286
288
|
updateApplicationBuilderTsConfigRule(options),
|
|
287
289
|
]
|
|
288
290
|
: [
|
|
289
291
|
updateWebpackBuilderServerTsConfigRule(options),
|
|
290
|
-
updateWebpackBuilderWorkspaceConfigRule(options),
|
|
292
|
+
updateWebpackBuilderWorkspaceConfigRule(sourceRoot, options),
|
|
291
293
|
]),
|
|
292
|
-
addServerFile(options, isStandalone),
|
|
294
|
+
addServerFile(sourceRoot, options, isStandalone),
|
|
293
295
|
addScriptsRule(options, isUsingApplicationBuilder),
|
|
294
296
|
addDependencies(options, isUsingApplicationBuilder),
|
|
295
297
|
]);
|
package/ssr/schema.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ export interface Schema {
|
|
|
3
3
|
* The name of the project.
|
|
4
4
|
*/
|
|
5
5
|
project: string;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a server application using the Server Routing and App Engine APIs (Developer
|
|
8
|
+
* Preview).
|
|
9
|
+
*/
|
|
10
|
+
serverRouting?: boolean;
|
|
6
11
|
/**
|
|
7
12
|
* Skip installing dependency packages.
|
|
8
13
|
*/
|
package/ssr/schema.json
CHANGED
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"description": "Skip installing dependency packages.",
|
|
16
16
|
"type": "boolean",
|
|
17
17
|
"default": false
|
|
18
|
+
},
|
|
19
|
+
"serverRouting": {
|
|
20
|
+
"description": "Creates a server application using the Server Routing and App Engine APIs (Developer Preview).",
|
|
21
|
+
"x-prompt": "Would you like to use the Server Routing and App Engine APIs (Developer Preview) for this server application?",
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"default": false
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
26
|
"required": ["project"],
|
|
@@ -15,6 +15,6 @@ exports.latestVersions = {
|
|
|
15
15
|
...dependencies,
|
|
16
16
|
// As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
|
|
17
17
|
Angular: dependencies['@angular/core'],
|
|
18
|
-
DevkitBuildAngular: '^19.0.0-
|
|
19
|
-
AngularSSR: '^19.0.0-
|
|
18
|
+
DevkitBuildAngular: '^19.0.0-rc.0',
|
|
19
|
+
AngularSSR: '^19.0.0-rc.0',
|
|
20
20
|
};
|
|
@@ -28,7 +28,7 @@ export declare enum Builders {
|
|
|
28
28
|
NgPackagr = "@angular-devkit/build-angular:ng-packagr",
|
|
29
29
|
DevServer = "@angular-devkit/build-angular:dev-server",
|
|
30
30
|
ExtractI18n = "@angular-devkit/build-angular:extract-i18n",
|
|
31
|
-
Protractor = "@angular-devkit/build-angular:protractor",
|
|
31
|
+
Protractor = "@angular-devkit/build-angular:private-protractor",
|
|
32
32
|
BuildApplication = "@angular/build:application"
|
|
33
33
|
}
|
|
34
34
|
export interface FileReplacements {
|
|
@@ -33,6 +33,6 @@ var Builders;
|
|
|
33
33
|
Builders["NgPackagr"] = "@angular-devkit/build-angular:ng-packagr";
|
|
34
34
|
Builders["DevServer"] = "@angular-devkit/build-angular:dev-server";
|
|
35
35
|
Builders["ExtractI18n"] = "@angular-devkit/build-angular:extract-i18n";
|
|
36
|
-
Builders["Protractor"] = "@angular-devkit/build-angular:protractor";
|
|
36
|
+
Builders["Protractor"] = "@angular-devkit/build-angular:private-protractor";
|
|
37
37
|
Builders["BuildApplication"] = "@angular/build:application";
|
|
38
38
|
})(Builders || (exports.Builders = Builders = {}));
|
|
@@ -1,27 +1,59 @@
|
|
|
1
1
|
# <%= utils.classify(name) %>
|
|
2
2
|
|
|
3
|
-
This project was generated
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version <%= version %>.
|
|
4
4
|
|
|
5
5
|
## Development server
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
To start a local development server, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng serve
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
|
|
8
14
|
|
|
9
15
|
## Code scaffolding
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
ng generate component component-name
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
ng generate --help
|
|
27
|
+
```
|
|
12
28
|
|
|
13
|
-
##
|
|
29
|
+
## Building
|
|
14
30
|
|
|
15
|
-
|
|
31
|
+
To build the project run:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
ng build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
|
|
16
38
|
|
|
17
39
|
## Running unit tests
|
|
18
40
|
|
|
19
|
-
|
|
41
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
ng test
|
|
45
|
+
```
|
|
20
46
|
|
|
21
47
|
## Running end-to-end tests
|
|
22
48
|
|
|
23
|
-
|
|
49
|
+
For end-to-end (e2e) testing, run:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
ng e2e
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
24
56
|
|
|
25
|
-
##
|
|
57
|
+
## Additional Resources
|
|
26
58
|
|
|
27
|
-
|
|
59
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
File without changes
|
/package/server/files/{standalone-src → application-builder/standalone-src}/main.server.ts.template
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|