@abp/ng.schematics 10.0.0-rc.2 → 10.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.
Files changed (36) hide show
  1. package/collection.json +11 -1
  2. package/commands/create-lib/index.d.ts +1 -1
  3. package/commands/create-lib/index.js +13 -10
  4. package/commands/create-lib/index.js.map +1 -1
  5. package/commands/ssr-add/files/application-builder/server.ts.template +192 -0
  6. package/commands/ssr-add/files/server-builder/server.ts.template +220 -0
  7. package/commands/ssr-add/index.d.ts +11 -0
  8. package/commands/ssr-add/index.js +363 -0
  9. package/commands/ssr-add/index.js.map +1 -0
  10. package/commands/ssr-add/schema.json +23 -0
  11. package/commands/ssr-add/server/files/application-builder/ngmodule-src/app/app.module.server.ts.template +23 -0
  12. package/commands/ssr-add/server/files/application-builder/ngmodule-src/app/app.routes.server.ts.template +8 -0
  13. package/commands/ssr-add/server/files/application-builder/ngmodule-src/main.server.ts.template +1 -0
  14. package/commands/ssr-add/server/files/application-builder/standalone-src/app/app.config.server.ts.template +29 -0
  15. package/commands/ssr-add/server/files/application-builder/standalone-src/app/app.routes.server.ts.template +8 -0
  16. package/commands/ssr-add/server/files/application-builder/standalone-src/main.server.ts.template +7 -0
  17. package/commands/ssr-add/server/files/server-builder/ngmodule-src/app/app.module.server.ts.template +25 -0
  18. package/commands/ssr-add/server/files/server-builder/ngmodule-src/main.server.ts.template +1 -0
  19. package/commands/ssr-add/server/files/server-builder/root/tsconfig.server.json.template +15 -0
  20. package/commands/ssr-add/server/files/server-builder/standalone-src/app/app.config.server.ts.template +29 -0
  21. package/commands/ssr-add/server/files/server-builder/standalone-src/main.server.ts.template +7 -0
  22. package/commands/ssr-add/server/index.d.ts +10 -0
  23. package/commands/ssr-add/server/index.js +206 -0
  24. package/commands/ssr-add/server/index.js.map +1 -0
  25. package/commands/ssr-add/server/index.ts +268 -0
  26. package/commands/ssr-add/server/schema.json +23 -0
  27. package/package.json +1 -1
  28. package/utils/angular/index.d.ts +1 -0
  29. package/utils/angular/index.js +1 -0
  30. package/utils/angular/index.js.map +1 -1
  31. package/utils/angular/latest-versions/index.d.ts +28 -0
  32. package/utils/angular/latest-versions/index.js +32 -0
  33. package/utils/angular/latest-versions/index.js.map +1 -0
  34. package/utils/angular/workspace.d.ts +1 -0
  35. package/utils/angular/workspace.js +3 -1
  36. package/utils/angular/workspace.js.map +1 -1
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const core_1 = require("@angular-devkit/core");
11
+ const schematics_1 = require("@angular-devkit/schematics");
12
+ const node_path_1 = require("node:path");
13
+ const angular_1 = require("../../../utils/angular");
14
+ const angular_2 = require("../../../utils/angular");
15
+ const json_file_1 = require("../../../utils/angular/json-file");
16
+ const latest_versions_1 = require("../../../utils/angular/latest-versions");
17
+ const ng_ast_utils_1 = require("../../../utils/angular/ng-ast-utils");
18
+ const paths_1 = require("../../../utils/angular/paths");
19
+ const project_targets_1 = require("../../../utils/angular/project-targets");
20
+ const app_component_1 = require("../../../utils/angular/standalone/app_component");
21
+ const util_1 = require("../../../utils/angular/standalone/util");
22
+ const workspace_1 = require("../../../utils/angular/workspace");
23
+ const workspace_models_1 = require("../../../utils/angular/workspace-models");
24
+ const serverMainEntryName = 'main.server.ts';
25
+ function updateConfigFileBrowserBuilder(options, tsConfigDirectory) {
26
+ return (0, workspace_1.updateWorkspace)(workspace => {
27
+ const clientProject = workspace.projects.get(options.project);
28
+ if (clientProject) {
29
+ // In case the browser builder hashes the assets
30
+ // we need to add this setting to the server builder
31
+ // as otherwise when assets it will be requested twice.
32
+ // One for the server which will be unhashed, and other on the client which will be hashed.
33
+ const getServerOptions = (options = {}) => {
34
+ return {
35
+ buildOptimizer: options?.buildOptimizer,
36
+ outputHashing: options?.outputHashing === 'all' ? 'media' : options?.outputHashing,
37
+ fileReplacements: options?.fileReplacements,
38
+ optimization: options?.optimization === undefined ? undefined : !!options?.optimization,
39
+ sourceMap: options?.sourceMap,
40
+ localization: options?.localization,
41
+ stylePreprocessorOptions: options?.stylePreprocessorOptions,
42
+ resourcesOutputPath: options?.resourcesOutputPath,
43
+ deployUrl: options?.deployUrl,
44
+ i18nMissingTranslation: options?.i18nMissingTranslation,
45
+ preserveSymlinks: options?.preserveSymlinks,
46
+ extractLicenses: options?.extractLicenses,
47
+ inlineStyleLanguage: options?.inlineStyleLanguage,
48
+ vendorChunk: options?.vendorChunk,
49
+ };
50
+ };
51
+ const buildTarget = clientProject.targets.get('build');
52
+ if (buildTarget?.options) {
53
+ buildTarget.options.outputPath = `dist/${options.project}/browser`;
54
+ }
55
+ const buildConfigurations = buildTarget?.configurations;
56
+ const configurations = {};
57
+ if (buildConfigurations) {
58
+ for (const [key, options] of Object.entries(buildConfigurations)) {
59
+ configurations[key] = getServerOptions(options);
60
+ }
61
+ }
62
+ const sourceRoot = clientProject.sourceRoot ?? (0, core_1.join)((0, core_1.normalize)(clientProject.root), 'src');
63
+ const serverTsConfig = (0, core_1.join)(tsConfigDirectory, 'tsconfig.server.json');
64
+ clientProject.targets.add({
65
+ name: 'server',
66
+ builder: workspace_models_1.Builders.Server,
67
+ defaultConfiguration: 'production',
68
+ options: {
69
+ outputPath: `dist/${options.project}/server`,
70
+ main: (0, core_1.join)((0, core_1.normalize)(sourceRoot), serverMainEntryName),
71
+ tsConfig: serverTsConfig,
72
+ ...(buildTarget?.options ? getServerOptions(buildTarget?.options) : {}),
73
+ },
74
+ configurations,
75
+ });
76
+ }
77
+ });
78
+ }
79
+ function updateConfigFileApplicationBuilder(options) {
80
+ return (0, workspace_1.updateWorkspace)(workspace => {
81
+ const project = workspace.projects.get(options.project);
82
+ if (!project) {
83
+ return;
84
+ }
85
+ const buildTarget = project.targets.get('build');
86
+ if (!buildTarget) {
87
+ return;
88
+ }
89
+ buildTarget.options ?? (buildTarget.options = {});
90
+ buildTarget.options['server'] = node_path_1.posix.join(project.sourceRoot ?? node_path_1.posix.join(project.root, 'src'), serverMainEntryName);
91
+ buildTarget.options['outputMode'] = 'static';
92
+ });
93
+ }
94
+ function updateTsConfigFile(tsConfigPath) {
95
+ return (host) => {
96
+ const json = new json_file_1.JSONFile(host, tsConfigPath);
97
+ // Skip adding the files entry if the server entry would already be included.
98
+ const include = json.get(['include']);
99
+ if (!Array.isArray(include) || !include.includes('src/**/*.ts')) {
100
+ const filesPath = ['files'];
101
+ const files = new Set(json.get(filesPath) ?? []);
102
+ files.add('src/' + serverMainEntryName);
103
+ json.modify(filesPath, [...files]);
104
+ }
105
+ const typePath = ['compilerOptions', 'types'];
106
+ const types = new Set(json.get(typePath) ?? []);
107
+ types.add('node');
108
+ json.modify(typePath, [...types]);
109
+ };
110
+ }
111
+ function addDependencies(skipInstall) {
112
+ return (host) => {
113
+ const coreDep = (0, angular_2.getPackageJsonDependency)(host, '@angular/core');
114
+ if (coreDep === null) {
115
+ throw new schematics_1.SchematicsException('Could not find version.');
116
+ }
117
+ const install = skipInstall ? angular_1.InstallBehavior.None : angular_1.InstallBehavior.Auto;
118
+ return (0, schematics_1.chain)([
119
+ (0, angular_1.addDependency)('@angular/ssr', '~20.0.0', {
120
+ type: angular_1.DependencyType.Default,
121
+ install,
122
+ }),
123
+ (0, angular_1.addDependency)('@angular/platform-server', coreDep.version, {
124
+ type: angular_1.DependencyType.Default,
125
+ install,
126
+ }),
127
+ (0, angular_1.addDependency)('@types/node', latest_versions_1.latestVersions.dependencies['@types/node'], {
128
+ type: angular_1.DependencyType.Dev,
129
+ install,
130
+ }),
131
+ ]);
132
+ };
133
+ }
134
+ function default_1(options) {
135
+ return async (host) => {
136
+ const workspace = await (0, workspace_1.getWorkspace)(host);
137
+ const clientProject = workspace.projects.get(options.project);
138
+ if (clientProject?.extensions.projectType !== 'application') {
139
+ throw new schematics_1.SchematicsException(`Server schematic requires a project type of "application".`);
140
+ }
141
+ const clientBuildTarget = clientProject.targets.get('build');
142
+ if (!clientBuildTarget) {
143
+ throw (0, project_targets_1.targetBuildNotFoundError)();
144
+ }
145
+ const usingApplicationBuilder = (0, project_targets_1.isUsingApplicationBuilder)(clientProject);
146
+ if (clientProject.targets.has('server') ||
147
+ (usingApplicationBuilder && clientBuildTarget.options?.server !== undefined)) {
148
+ // Server has already been added.
149
+ return;
150
+ }
151
+ const clientBuildOptions = clientBuildTarget.options;
152
+ const browserEntryPoint = await (0, util_1.getMainFilePath)(host, options.project);
153
+ const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, browserEntryPoint);
154
+ const sourceRoot = clientProject.sourceRoot ?? (0, core_1.join)((0, core_1.normalize)(clientProject.root), 'src');
155
+ let filesUrl = `./files/${usingApplicationBuilder ? 'application-builder/' : 'server-builder/'}`;
156
+ filesUrl += isStandalone ? 'standalone-src' : 'ngmodule-src';
157
+ const { componentName, componentImportPathInSameFile, moduleName, moduleImportPathInSameFile } = (0, app_component_1.resolveBootstrappedComponentData)(host, browserEntryPoint) || {
158
+ componentName: 'App',
159
+ componentImportPathInSameFile: './app/app',
160
+ moduleName: 'AppModule',
161
+ moduleImportPathInSameFile: './app/app.module',
162
+ };
163
+ const templateSource = (0, schematics_1.apply)((0, schematics_1.url)(filesUrl), [
164
+ (0, schematics_1.applyTemplates)({
165
+ ...schematics_1.strings,
166
+ ...options,
167
+ appComponentName: componentName,
168
+ appComponentPath: componentImportPathInSameFile,
169
+ appModuleName: moduleName,
170
+ appModulePath: moduleImportPathInSameFile === null
171
+ ? null
172
+ : `./${node_path_1.posix.basename(moduleImportPathInSameFile)}`,
173
+ }),
174
+ (0, schematics_1.move)(sourceRoot),
175
+ ]);
176
+ const clientTsConfig = (0, core_1.normalize)(clientBuildOptions.tsConfig);
177
+ const tsConfigExtends = (0, core_1.basename)(clientTsConfig);
178
+ const tsConfigDirectory = (0, core_1.dirname)(clientTsConfig);
179
+ return (0, schematics_1.chain)([
180
+ (0, schematics_1.mergeWith)(templateSource),
181
+ ...(usingApplicationBuilder
182
+ ? [
183
+ updateConfigFileApplicationBuilder(options),
184
+ updateTsConfigFile(clientBuildOptions.tsConfig),
185
+ ]
186
+ : [
187
+ (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/server-builder/root'), [
188
+ (0, schematics_1.applyTemplates)({
189
+ ...schematics_1.strings,
190
+ ...options,
191
+ stripTsExtension: (s) => s.replace(/\.ts$/, ''),
192
+ tsConfigExtends,
193
+ hasLocalizePackage: !!(0, angular_2.getPackageJsonDependency)(host, '@angular/localize'),
194
+ relativePathToWorkspaceRoot: (0, paths_1.relativePathToWorkspaceRoot)(tsConfigDirectory),
195
+ }),
196
+ (0, schematics_1.move)(tsConfigDirectory),
197
+ ])),
198
+ updateConfigFileBrowserBuilder(options, tsConfigDirectory),
199
+ ]),
200
+ addDependencies(options.skipInstall),
201
+ (0, angular_1.addRootProvider)(options.project, ({ code, external }) => code `${external('provideClientHydration', '@angular/platform-browser')}(${external('withEventReplay', '@angular/platform-browser')}(), ${external('withIncrementalHydration', '@angular/platform-browser')}(), ${external('withHttpTransferCacheOptions', '@angular/platform-browser')}({}))`),
202
+ ]);
203
+ };
204
+ }
205
+ exports.default = default_1;
206
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/schematics/src/commands/ssr-add/server/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,+CAA2F;AAC3F,2DAWoC;AACpC,yCAAkC;AAClC,oDAKgC;AAChC,oDAAkE;AAClE,gEAA4D;AAC5D,4EAAwE;AACxE,sEAAsE;AACtE,wDAA2E;AAC3E,4EAGgD;AAChD,mFAAmG;AACnG,iEAAyE;AACzE,gEAAiF;AACjF,8EAAmE;AAKnE,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAE7C,SAAS,8BAA8B,CAAC,OAAs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EAAE,CAAC;4BACvD,eAAe;4BACf,kBAAkB,EAAE,CAAC,CAAC,IAAA,kCAAwB,EAAC,IAAI,EAAE,mBAAmB,CAAC;4BACzE,2BAA2B,EAAE,IAAA,mCAA2B,EAAC,iBAAiB,CAAC;yBAC5E,CAAC;wBACF,IAAA,iBAAI,EAAC,iBAAiB,CAAC;qBACxB,CAAC,CACH;oBACD,8BAA8B,CAAC,OAAO,EAAE,iBAAiB,CAAC;iBAC3D,CAAC;YACN,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC;YACpC,IAAA,yBAAe,EACb,OAAO,CAAC,OAAO,EACf,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CACrB,IAAI,CAAA,GAAG,QAAQ,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,IAAI,QAAQ,CAChF,iBAAiB,EACjB,2BAA2B,CAC5B,OAAO,QAAQ,CACd,0BAA0B,EAC1B,2BAA2B,CAC5B,OAAO,QAAQ,CAAC,8BAA8B,EAAE,2BAA2B,CAAC,OAAO,CACvF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA9FD,4BA8FC"}
@@ -0,0 +1,268 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+
9
+ import { JsonValue, Path, basename, dirname, join, normalize } from '@angular-devkit/core';
10
+ import {
11
+ Rule,
12
+ SchematicsException,
13
+ Tree,
14
+ apply,
15
+ applyTemplates,
16
+ chain,
17
+ mergeWith,
18
+ move,
19
+ strings,
20
+ url,
21
+ } from '@angular-devkit/schematics';
22
+ import { posix } from 'node:path';
23
+ import {
24
+ DependencyType,
25
+ InstallBehavior,
26
+ addDependency,
27
+ addRootProvider,
28
+ } from '../../../utils/angular';
29
+ import { getPackageJsonDependency } from '../../../utils/angular';
30
+ import { JSONFile } from '../../../utils/angular/json-file';
31
+ import { latestVersions } from '../../../utils/angular/latest-versions';
32
+ import { isStandaloneApp } from '../../../utils/angular/ng-ast-utils';
33
+ import { relativePathToWorkspaceRoot } from '../../../utils/angular/paths';
34
+ import {
35
+ isUsingApplicationBuilder,
36
+ targetBuildNotFoundError,
37
+ } from '../../../utils/angular/project-targets';
38
+ import { resolveBootstrappedComponentData } from '../../../utils/angular/standalone/app_component';
39
+ import { getMainFilePath } from '../../../utils/angular/standalone/util';
40
+ import { getWorkspace, updateWorkspace } from '../../../utils/angular/workspace';
41
+ import { Builders } from '../../../utils/angular/workspace-models';
42
+
43
+ // @ts-ignore
44
+ import { Schema as ServerOptions } from './schema';
45
+
46
+ const serverMainEntryName = 'main.server.ts';
47
+
48
+ function updateConfigFileBrowserBuilder(options: ServerOptions, tsConfigDirectory: Path): Rule {
49
+ return updateWorkspace(workspace => {
50
+ const clientProject = workspace.projects.get(options.project);
51
+
52
+ if (clientProject) {
53
+ // In case the browser builder hashes the assets
54
+ // we need to add this setting to the server builder
55
+ // as otherwise when assets it will be requested twice.
56
+ // One for the server which will be unhashed, and other on the client which will be hashed.
57
+ const getServerOptions = (options: Record<string, JsonValue | undefined> = {}): {} => {
58
+ return {
59
+ buildOptimizer: options?.buildOptimizer,
60
+ outputHashing: options?.outputHashing === 'all' ? 'media' : options?.outputHashing,
61
+ fileReplacements: options?.fileReplacements,
62
+ optimization: options?.optimization === undefined ? undefined : !!options?.optimization,
63
+ sourceMap: options?.sourceMap,
64
+ localization: options?.localization,
65
+ stylePreprocessorOptions: options?.stylePreprocessorOptions,
66
+ resourcesOutputPath: options?.resourcesOutputPath,
67
+ deployUrl: options?.deployUrl,
68
+ i18nMissingTranslation: options?.i18nMissingTranslation,
69
+ preserveSymlinks: options?.preserveSymlinks,
70
+ extractLicenses: options?.extractLicenses,
71
+ inlineStyleLanguage: options?.inlineStyleLanguage,
72
+ vendorChunk: options?.vendorChunk,
73
+ };
74
+ };
75
+
76
+ const buildTarget = clientProject.targets.get('build');
77
+ if (buildTarget?.options) {
78
+ buildTarget.options.outputPath = `dist/${options.project}/browser`;
79
+ }
80
+
81
+ const buildConfigurations = buildTarget?.configurations;
82
+ const configurations: Record<string, {}> = {};
83
+ if (buildConfigurations) {
84
+ for (const [key, options] of Object.entries(buildConfigurations)) {
85
+ configurations[key] = getServerOptions(options);
86
+ }
87
+ }
88
+
89
+ const sourceRoot = clientProject.sourceRoot ?? join(normalize(clientProject.root), 'src');
90
+ const serverTsConfig = join(tsConfigDirectory, 'tsconfig.server.json');
91
+ clientProject.targets.add({
92
+ name: 'server',
93
+ builder: Builders.Server,
94
+ defaultConfiguration: 'production',
95
+ options: {
96
+ outputPath: `dist/${options.project}/server`,
97
+ main: join(normalize(sourceRoot), serverMainEntryName),
98
+ tsConfig: serverTsConfig,
99
+ ...(buildTarget?.options ? getServerOptions(buildTarget?.options) : {}),
100
+ },
101
+ configurations,
102
+ });
103
+ }
104
+ });
105
+ }
106
+
107
+ function updateConfigFileApplicationBuilder(options: ServerOptions): Rule {
108
+ return updateWorkspace(workspace => {
109
+ const project = workspace.projects.get(options.project);
110
+ if (!project) {
111
+ return;
112
+ }
113
+
114
+ const buildTarget = project.targets.get('build');
115
+ if (!buildTarget) {
116
+ return;
117
+ }
118
+
119
+ buildTarget.options ??= {};
120
+ buildTarget.options['server'] = posix.join(
121
+ project.sourceRoot ?? posix.join(project.root, 'src'),
122
+ serverMainEntryName,
123
+ );
124
+
125
+ buildTarget.options['outputMode'] = 'static';
126
+ });
127
+ }
128
+
129
+ function updateTsConfigFile(tsConfigPath: string): Rule {
130
+ return (host: Tree) => {
131
+ const json = new JSONFile(host, tsConfigPath);
132
+ // Skip adding the files entry if the server entry would already be included.
133
+ const include = json.get(['include']);
134
+ if (!Array.isArray(include) || !include.includes('src/**/*.ts')) {
135
+ const filesPath = ['files'];
136
+ const files = new Set((json.get(filesPath) as string[] | undefined) ?? []);
137
+ files.add('src/' + serverMainEntryName);
138
+ json.modify(filesPath, [...files]);
139
+ }
140
+
141
+ const typePath = ['compilerOptions', 'types'];
142
+ const types = new Set((json.get(typePath) as string[] | undefined) ?? []);
143
+ types.add('node');
144
+ json.modify(typePath, [...types]);
145
+ };
146
+ }
147
+
148
+ function addDependencies(skipInstall: boolean | undefined): Rule {
149
+ return (host: Tree) => {
150
+ const coreDep = getPackageJsonDependency(host, '@angular/core');
151
+ if (coreDep === null) {
152
+ throw new SchematicsException('Could not find version.');
153
+ }
154
+
155
+ const install = skipInstall ? InstallBehavior.None : InstallBehavior.Auto;
156
+
157
+ return chain([
158
+ addDependency('@angular/ssr', '~20.0.0', {
159
+ type: DependencyType.Default,
160
+ install,
161
+ }),
162
+ addDependency('@angular/platform-server', coreDep.version, {
163
+ type: DependencyType.Default,
164
+ install,
165
+ }),
166
+ addDependency('@types/node', latestVersions.dependencies['@types/node'], {
167
+ type: DependencyType.Dev,
168
+ install,
169
+ }),
170
+ ]);
171
+ };
172
+ }
173
+
174
+ export default function (options: ServerOptions): Rule {
175
+ return async (host: Tree) => {
176
+ const workspace = await getWorkspace(host);
177
+ const clientProject = workspace.projects.get(options.project);
178
+ if (clientProject?.extensions.projectType !== 'application') {
179
+ throw new SchematicsException(`Server schematic requires a project type of "application".`);
180
+ }
181
+
182
+ const clientBuildTarget = clientProject.targets.get('build');
183
+ if (!clientBuildTarget) {
184
+ throw targetBuildNotFoundError();
185
+ }
186
+
187
+ const usingApplicationBuilder = isUsingApplicationBuilder(clientProject);
188
+
189
+ if (
190
+ clientProject.targets.has('server') ||
191
+ (usingApplicationBuilder && clientBuildTarget.options?.server !== undefined)
192
+ ) {
193
+ // Server has already been added.
194
+ return;
195
+ }
196
+
197
+ const clientBuildOptions = clientBuildTarget.options as Record<string, string>;
198
+ const browserEntryPoint = await getMainFilePath(host, options.project);
199
+ const isStandalone = isStandaloneApp(host, browserEntryPoint);
200
+ const sourceRoot = clientProject.sourceRoot ?? join(normalize(clientProject.root), 'src');
201
+
202
+ let filesUrl = `./files/${usingApplicationBuilder ? 'application-builder/' : 'server-builder/'}`;
203
+ filesUrl += isStandalone ? 'standalone-src' : 'ngmodule-src';
204
+
205
+ const { componentName, componentImportPathInSameFile, moduleName, moduleImportPathInSameFile } =
206
+ resolveBootstrappedComponentData(host, browserEntryPoint) || {
207
+ componentName: 'App',
208
+ componentImportPathInSameFile: './app/app',
209
+ moduleName: 'AppModule',
210
+ moduleImportPathInSameFile: './app/app.module',
211
+ };
212
+ const templateSource = apply(url(filesUrl), [
213
+ applyTemplates({
214
+ ...strings,
215
+ ...options,
216
+ appComponentName: componentName,
217
+ appComponentPath: componentImportPathInSameFile,
218
+ appModuleName: moduleName,
219
+ appModulePath:
220
+ moduleImportPathInSameFile === null
221
+ ? null
222
+ : `./${posix.basename(moduleImportPathInSameFile)}`,
223
+ }),
224
+ move(sourceRoot),
225
+ ]);
226
+
227
+ const clientTsConfig = normalize(clientBuildOptions.tsConfig);
228
+ const tsConfigExtends = basename(clientTsConfig);
229
+ const tsConfigDirectory = dirname(clientTsConfig);
230
+
231
+ return chain([
232
+ mergeWith(templateSource),
233
+ ...(usingApplicationBuilder
234
+ ? [
235
+ updateConfigFileApplicationBuilder(options),
236
+ updateTsConfigFile(clientBuildOptions.tsConfig),
237
+ ]
238
+ : [
239
+ mergeWith(
240
+ apply(url('./files/server-builder/root'), [
241
+ applyTemplates({
242
+ ...strings,
243
+ ...options,
244
+ stripTsExtension: (s: string) => s.replace(/\.ts$/, ''),
245
+ tsConfigExtends,
246
+ hasLocalizePackage: !!getPackageJsonDependency(host, '@angular/localize'),
247
+ relativePathToWorkspaceRoot: relativePathToWorkspaceRoot(tsConfigDirectory),
248
+ }),
249
+ move(tsConfigDirectory),
250
+ ]),
251
+ ),
252
+ updateConfigFileBrowserBuilder(options, tsConfigDirectory),
253
+ ]),
254
+ addDependencies(options.skipInstall),
255
+ addRootProvider(
256
+ options.project,
257
+ ({ code, external }) =>
258
+ code`${external('provideClientHydration', '@angular/platform-browser')}(${external(
259
+ 'withEventReplay',
260
+ '@angular/platform-browser',
261
+ )}(), ${external(
262
+ 'withIncrementalHydration',
263
+ '@angular/platform-browser',
264
+ )}(), ${external('withHttpTransferCacheOptions', '@angular/platform-browser')}({}))`,
265
+ ),
266
+ ]);
267
+ };
268
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "SchematicsAngularServerApp",
4
+ "title": "Angular Server App Options Schema",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "description": "Sets up server-side rendering (SSR) for your Angular application. SSR allows your app to be rendered on the server, improving initial load performance and SEO. This schematic configures your project for SSR and generates the necessary files.",
8
+ "properties": {
9
+ "project": {
10
+ "type": "string",
11
+ "description": "The name of the project to enable server-side rendering for.",
12
+ "$default": {
13
+ "$source": "projectName"
14
+ }
15
+ },
16
+ "skipInstall": {
17
+ "description": "Skip the automatic installation of packages. You will need to manually install the dependencies later.",
18
+ "type": "boolean",
19
+ "default": false
20
+ }
21
+ },
22
+ "required": ["project"]
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abp/ng.schematics",
3
- "version": "10.0.0-rc.2",
3
+ "version": "10.0.0",
4
4
  "author": "",
5
5
  "schematics": "./collection.json",
6
6
  "dependencies": {
@@ -12,3 +12,4 @@ export * from './validation';
12
12
  export * from './workspace';
13
13
  export * from './workspace-models';
14
14
  export * from './standalone';
15
+ export * from './dependency';
@@ -28,4 +28,5 @@ __exportStar(require("./validation"), exports);
28
28
  __exportStar(require("./workspace"), exports);
29
29
  __exportStar(require("./workspace-models"), exports);
30
30
  __exportStar(require("./standalone"), exports);
31
+ __exportStar(require("./dependency"), exports);
31
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,gDAA8B;AAC9B,wDAAsC;AACtC,8CAA4B;AAC5B,iDAA+B;AAC/B,+CAA6B;AAC7B,0CAAwB;AACxB,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC;AACnC,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,gDAA8B;AAC9B,wDAAsC;AACtC,8CAA4B;AAC5B,iDAA+B;AAC/B,+CAA6B;AAC7B,0CAAwB;AACxB,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC;AACnC,+CAA6B;AAC7B,+CAA6B"}
@@ -0,0 +1,28 @@
1
+ export declare const latestVersions: {
2
+ description: string;
3
+ comment: string;
4
+ private: boolean;
5
+ dependencies: {
6
+ '@types/express': string;
7
+ '@types/jasmine': string;
8
+ '@types/node': string;
9
+ 'browser-sync': string;
10
+ express: string;
11
+ 'jasmine-core': string;
12
+ 'jasmine-spec-reporter': string;
13
+ 'karma-chrome-launcher': string;
14
+ 'karma-coverage': string;
15
+ 'karma-jasmine-html-reporter': string;
16
+ 'karma-jasmine': string;
17
+ karma: string;
18
+ less: string;
19
+ postcss: string;
20
+ protractor: string;
21
+ rxjs: string;
22
+ tslib: string;
23
+ 'ts-node': string;
24
+ typescript: string;
25
+ 'zone.js': string;
26
+ 'openid-client': string;
27
+ };
28
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.latestVersions = void 0;
4
+ exports.latestVersions = {
5
+ description: 'Package versions used by schematics in @schematics/angular.',
6
+ comment: 'This file is needed so that dependencies are synced by Renovate.',
7
+ private: true,
8
+ dependencies: {
9
+ '@types/express': '~5.0.0',
10
+ '@types/jasmine': '~5.1.0',
11
+ '@types/node': '~20.11.0',
12
+ 'browser-sync': '^3.0.0',
13
+ express: '~5.1.0',
14
+ 'jasmine-core': '~5.9.0',
15
+ 'jasmine-spec-reporter': '~7.0.0',
16
+ 'karma-chrome-launcher': '~3.2.0',
17
+ 'karma-coverage': '~2.2.0',
18
+ 'karma-jasmine-html-reporter': '~2.1.0',
19
+ 'karma-jasmine': '~5.1.0',
20
+ karma: '~6.4.0',
21
+ less: '^4.2.0',
22
+ postcss: '^8.5.3',
23
+ protractor: '~7.0.0',
24
+ rxjs: '~7.8.0',
25
+ tslib: '^2.3.0',
26
+ 'ts-node': '~10.9.0',
27
+ typescript: '~5.8.0',
28
+ 'zone.js': '~0.15.0',
29
+ 'openid-client': '^6.6.4',
30
+ },
31
+ };
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/schematics/src/utils/angular/latest-versions/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,WAAW,EAAE,6DAA6D;IAC1E,OAAO,EAAE,kEAAkE;IAC3E,OAAO,EAAE,IAAI;IACb,YAAY,EAAE;QACZ,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;QAC1B,aAAa,EAAE,UAAU;QACzB,cAAc,EAAE,QAAQ;QACxB,OAAO,EAAE,QAAQ;QACjB,cAAc,EAAE,QAAQ;QACxB,uBAAuB,EAAE,QAAQ;QACjC,uBAAuB,EAAE,QAAQ;QACjC,gBAAgB,EAAE,QAAQ;QAC1B,6BAA6B,EAAE,QAAQ;QACvC,eAAe,EAAE,QAAQ;QACzB,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,QAAQ;QACjB,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,SAAS,EAAE,SAAS;QACpB,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,SAAS;QACpB,eAAe,EAAE,QAAQ;KAC1B;CACF,CAAC"}
@@ -62,3 +62,4 @@ export declare function buildDefaultPath(project: workspaces.ProjectDefinition):
62
62
  export declare function createDefaultPath(tree: Tree, projectName: string): Promise<string>;
63
63
  export declare function allWorkspaceTargets(workspace: workspaces.WorkspaceDefinition): Iterable<[string, workspaces.TargetDefinition, string, workspaces.ProjectDefinition]>;
64
64
  export declare function allTargetOptions(target: workspaces.TargetDefinition, skipBaseOptions?: boolean): Iterable<[string | undefined, Record<string, json.JsonValue | undefined>]>;
65
+ export { getWorkspace as readWorkspace } from './workspace';
@@ -7,7 +7,7 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.allTargetOptions = exports.allWorkspaceTargets = exports.createDefaultPath = exports.buildDefaultPath = exports.writeWorkspace = exports.getWorkspace = exports.updateWorkspace = exports.TreeWorkspaceHost = void 0;
10
+ exports.readWorkspace = exports.allTargetOptions = exports.allWorkspaceTargets = exports.createDefaultPath = exports.buildDefaultPath = exports.writeWorkspace = exports.getWorkspace = exports.updateWorkspace = exports.TreeWorkspaceHost = void 0;
11
11
  const core_1 = require("@angular-devkit/core");
12
12
  const schematics_1 = require("@angular-devkit/schematics");
13
13
  const workspace_models_1 = require("./workspace-models");
@@ -131,4 +131,6 @@ function* allTargetOptions(target, skipBaseOptions = false) {
131
131
  }
132
132
  }
133
133
  exports.allTargetOptions = allTargetOptions;
134
+ var workspace_1 = require("./workspace"); // for backwards compatibility
135
+ Object.defineProperty(exports, "readWorkspace", { enumerable: true, get: function () { return workspace_1.getWorkspace; } });
134
136
  //# sourceMappingURL=workspace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/workspace.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAAwD;AACxD,2DAA8D;AAC9D,yDAAiD;AAEjD,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAO/C;;GAEG;AAC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BAAmB,CAAC,CAAC;KAC7D;IAED,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AARD,8CAQC;AAED,QAAe,CAAC,CAAC,mBAAmB,CAClC,SAAyC;IAEzC,KAAK,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,SAAS,CAAC,QAAQ,EAAE;QACvD,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE;YAClD,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;SAClD;KACF;AACH,CAAC;AARD,kDAQC;AAED,QAAe,CAAC,CAAC,gBAAgB,CAC/B,MAAmC,EACnC,eAAe,GAAG,KAAK;IAEvB,IAAI,CAAC,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE;QACtC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;KACnC;IAED,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;QAC1B,OAAO;KACR;IAED,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;QACnE,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACvB;KACF;AACH,CAAC;AAjBD,4CAiBC"}
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/workspace.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAAwD;AACxD,2DAA8D;AAC9D,yDAAiD;AAEjD,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAO/C;;GAEG;AACH,MAAa,iBAAiB;IAC5B,YAA6B,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAAG,CAAC;IAE3C,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,OAAO,IAAI,CA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