Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
9
my-app/node_modules/@schematics/angular/migrations/update-17/add-browser-sync-dependency.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@schematics/angular/migrations/update-17/add-browser-sync-dependency.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
import { Rule } from '@angular-devkit/schematics';
|
||||
export default function (): Rule;
|
36
my-app/node_modules/@schematics/angular/migrations/update-17/add-browser-sync-dependency.js
generated
vendored
Executable file
36
my-app/node_modules/@schematics/angular/migrations/update-17/add-browser-sync-dependency.js
generated
vendored
Executable file
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utility_1 = require("../../utility");
|
||||
const dependencies_1 = require("../../utility/dependencies");
|
||||
const latest_versions_1 = require("../../utility/latest-versions");
|
||||
const workspace_1 = require("../../utility/workspace");
|
||||
const workspace_models_1 = require("../../utility/workspace-models");
|
||||
const BROWSER_SYNC_VERSION = latest_versions_1.latestVersions['browser-sync'];
|
||||
function default_1() {
|
||||
return async (tree) => {
|
||||
if ((0, dependencies_1.getPackageJsonDependency)(tree, 'browser-sync')?.version === BROWSER_SYNC_VERSION) {
|
||||
return;
|
||||
}
|
||||
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
||||
for (const project of workspace.projects.values()) {
|
||||
if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
|
||||
continue;
|
||||
}
|
||||
for (const target of project.targets.values()) {
|
||||
if (target.builder === workspace_models_1.Builders.SsrDevServer) {
|
||||
return (0, utility_1.addDependency)('browser-sync', BROWSER_SYNC_VERSION, {
|
||||
type: utility_1.DependencyType.Dev,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.default = default_1;
|
9
my-app/node_modules/@schematics/angular/migrations/update-17/replace-nguniversal-builders.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@schematics/angular/migrations/update-17/replace-nguniversal-builders.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
import { Rule } from '@angular-devkit/schematics';
|
||||
export default function (): Rule;
|
47
my-app/node_modules/@schematics/angular/migrations/update-17/replace-nguniversal-builders.js
generated
vendored
Executable file
47
my-app/node_modules/@schematics/angular/migrations/update-17/replace-nguniversal-builders.js
generated
vendored
Executable file
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const dependencies_1 = require("../../utility/dependencies");
|
||||
const workspace_1 = require("../../utility/workspace");
|
||||
const workspace_models_1 = require("../../utility/workspace-models");
|
||||
function default_1() {
|
||||
return (0, schematics_1.chain)([
|
||||
(0, workspace_1.updateWorkspace)((workspace) => {
|
||||
for (const [, project] of workspace.projects) {
|
||||
if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
|
||||
// Only interested in application projects since these changes only effects application builders
|
||||
continue;
|
||||
}
|
||||
for (const [, target] of project.targets) {
|
||||
if (target.builder === '@nguniversal/builders:ssr-dev-server') {
|
||||
target.builder = '@angular-devkit/build-angular:ssr-dev-server';
|
||||
}
|
||||
else if (target.builder === '@nguniversal/builders:prerender') {
|
||||
target.builder = '@angular-devkit/build-angular:prerender';
|
||||
for (const [, options] of (0, workspace_1.allTargetOptions)(target, false)) {
|
||||
// Remove and replace builder options
|
||||
if (options['guessRoutes'] !== undefined) {
|
||||
options['discoverRoutes'] = options['guessRoutes'];
|
||||
delete options['guessRoutes'];
|
||||
}
|
||||
if (options['numProcesses'] !== undefined) {
|
||||
delete options['numProcesses'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
(host) => {
|
||||
(0, dependencies_1.removePackageJsonDependency)(host, '@nguniversal/builders');
|
||||
},
|
||||
]);
|
||||
}
|
||||
exports.default = default_1;
|
9
my-app/node_modules/@schematics/angular/migrations/update-17/replace-nguniversal-engines.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@schematics/angular/migrations/update-17/replace-nguniversal-engines.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
import { Rule } from '@angular-devkit/schematics';
|
||||
export default function (): Rule;
|
197
my-app/node_modules/@schematics/angular/migrations/update-17/replace-nguniversal-engines.js
generated
vendored
Executable file
197
my-app/node_modules/@schematics/angular/migrations/update-17/replace-nguniversal-engines.js
generated
vendored
Executable file
|
@ -0,0 +1,197 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const utility_1 = require("../../utility");
|
||||
const dependencies_1 = require("../../utility/dependencies");
|
||||
const latest_versions_1 = require("../../utility/latest-versions");
|
||||
const workspace_1 = require("../../utility/workspace");
|
||||
const workspace_models_1 = require("../../utility/workspace-models");
|
||||
function* visit(directory) {
|
||||
for (const path of directory.subfiles) {
|
||||
if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
|
||||
const entry = directory.file(path);
|
||||
if (entry) {
|
||||
const content = entry.content;
|
||||
if (content.includes('@nguniversal/')) {
|
||||
// Only need to rename the import so we can just string replacements.
|
||||
yield [entry.path, content.toString()];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const path of directory.subdirs) {
|
||||
if (path === 'node_modules' || path.startsWith('.')) {
|
||||
continue;
|
||||
}
|
||||
yield* visit(directory.dir(path));
|
||||
}
|
||||
}
|
||||
const UNIVERSAL_PACKAGES = ['@nguniversal/common', '@nguniversal/express-engine'];
|
||||
/**
|
||||
* Regexp to match Universal packages.
|
||||
* @nguniversal/common/engine
|
||||
* @nguniversal/common
|
||||
* @nguniversal/express-engine
|
||||
**/
|
||||
const NGUNIVERSAL_PACKAGE_REGEXP = /@nguniversal\/(common(\/engine)?|express-engine)/g;
|
||||
function default_1() {
|
||||
return async (tree) => {
|
||||
const hasUniversalDeps = UNIVERSAL_PACKAGES.some((d) => (0, dependencies_1.getPackageJsonDependency)(tree, d));
|
||||
if (!hasUniversalDeps) {
|
||||
return;
|
||||
}
|
||||
return (0, schematics_1.chain)([
|
||||
async (tree) => {
|
||||
// Replace server file.
|
||||
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
||||
for (const [, project] of workspace.projects) {
|
||||
if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
|
||||
continue;
|
||||
}
|
||||
const serverMainFiles = new Map();
|
||||
for (const [, target] of project.targets) {
|
||||
if (target.builder !== workspace_models_1.Builders.Server) {
|
||||
continue;
|
||||
}
|
||||
const outputPath = project.targets.get('build')?.options?.outputPath;
|
||||
for (const [, { main }] of (0, workspace_1.allTargetOptions)(target, false)) {
|
||||
if (typeof main === 'string' &&
|
||||
typeof outputPath === 'string' &&
|
||||
tree.readText(main).includes('ngExpressEngine')) {
|
||||
serverMainFiles.set(main, outputPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Replace all import specifiers in all files.
|
||||
let hasExpressTokens = false;
|
||||
const root = project.sourceRoot ?? `${project.root}/src`;
|
||||
const tokensFilePath = `/${root}/express.tokens.ts`;
|
||||
for (const file of visit(tree.getDir(root))) {
|
||||
const [path, content] = file;
|
||||
let updatedContent = content;
|
||||
// Check if file is importing tokens
|
||||
if (content.includes('@nguniversal/express-engine/tokens')) {
|
||||
hasExpressTokens ||= true;
|
||||
let tokensFileRelativePath = (0, core_1.relative)((0, core_1.dirname)((0, core_1.normalize)(path)), (0, core_1.normalize)(tokensFilePath));
|
||||
if (tokensFileRelativePath.charAt(0) !== '.') {
|
||||
tokensFileRelativePath = './' + tokensFileRelativePath;
|
||||
}
|
||||
updatedContent = updatedContent.replaceAll('@nguniversal/express-engine/tokens', tokensFileRelativePath.slice(0, -3));
|
||||
}
|
||||
updatedContent = updatedContent.replaceAll(NGUNIVERSAL_PACKAGE_REGEXP, '@angular/ssr');
|
||||
tree.overwrite(path, updatedContent);
|
||||
}
|
||||
// Replace server file and add tokens file if needed
|
||||
for (const [path, outputPath] of serverMainFiles.entries()) {
|
||||
tree.rename(path, path + '.bak');
|
||||
tree.create(path, getServerFileContents(outputPath, hasExpressTokens));
|
||||
if (hasExpressTokens) {
|
||||
tree.create(tokensFilePath, TOKENS_FILE_CONTENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove universal packages from deps.
|
||||
for (const name of UNIVERSAL_PACKAGES) {
|
||||
(0, dependencies_1.removePackageJsonDependency)(tree, name);
|
||||
}
|
||||
},
|
||||
(0, utility_1.addDependency)('@angular/ssr', latest_versions_1.latestVersions.AngularSSR),
|
||||
]);
|
||||
};
|
||||
}
|
||||
exports.default = default_1;
|
||||
const TOKENS_FILE_CONTENT = `
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { Request, Response } from 'express';
|
||||
|
||||
export const REQUEST = new InjectionToken<Request>('REQUEST');
|
||||
export const RESPONSE = new InjectionToken<Response>('RESPONSE');
|
||||
`;
|
||||
function getServerFileContents(outputPath, hasExpressTokens) {
|
||||
return (`
|
||||
import 'zone.js/node';
|
||||
|
||||
import { APP_BASE_HREF } from '@angular/common';
|
||||
import { CommonEngine } from '@angular/ssr';
|
||||
import * as express from 'express';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import bootstrap from './src/main.server';` +
|
||||
(hasExpressTokens ? `\nimport { REQUEST, RESPONSE } from './src/express.tokens';` : '') +
|
||||
`
|
||||
|
||||
// The Express app is exported so that it can be used by serverless Functions.
|
||||
export function app(): express.Express {
|
||||
const server = express();
|
||||
const distFolder = join(process.cwd(), '${outputPath}');
|
||||
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
|
||||
? join(distFolder, 'index.original.html')
|
||||
: join(distFolder, 'index.html');
|
||||
|
||||
const commonEngine = new CommonEngine();
|
||||
|
||||
server.set('view engine', 'html');
|
||||
server.set('views', distFolder);
|
||||
|
||||
// Example Express Rest API endpoints
|
||||
// server.get('/api/**', (req, res) => { });
|
||||
// Serve static files from /browser
|
||||
server.get('*.*', express.static(distFolder, {
|
||||
maxAge: '1y'
|
||||
}));
|
||||
|
||||
// All regular routes use the Angular engine
|
||||
server.get('*', (req, res, next) => {
|
||||
const { protocol, originalUrl, baseUrl, headers } = req;
|
||||
|
||||
commonEngine
|
||||
.render({
|
||||
bootstrap,
|
||||
documentFilePath: indexHtml,
|
||||
url: \`\${protocol}://\${headers.host}\${originalUrl}\`,
|
||||
publicPath: distFolder,
|
||||
providers: [
|
||||
{ provide: APP_BASE_HREF, useValue: baseUrl },` +
|
||||
(hasExpressTokens
|
||||
? '\n { provide: RESPONSE, useValue: res },\n { provide: REQUEST, useValue: req }\n'
|
||||
: '') +
|
||||
`],
|
||||
})
|
||||
.then((html) => res.send(html))
|
||||
.catch((err) => next(err));
|
||||
});
|
||||
|
||||
return server;
|
||||
}
|
||||
|
||||
function run(): void {
|
||||
const port = process.env['PORT'] || 4000;
|
||||
|
||||
// Start up the Node server
|
||||
const server = app();
|
||||
server.listen(port, () => {
|
||||
console.log(\`Node Express server listening on http://localhost:\${port}\`);
|
||||
});
|
||||
}
|
||||
|
||||
// Webpack will replace 'require' with '__webpack_require__'
|
||||
// '__non_webpack_require__' is a proxy to Node 'require'
|
||||
// The below code is to ensure that the server is run only when not requiring the bundle.
|
||||
declare const __non_webpack_require__: NodeRequire;
|
||||
const mainModule = __non_webpack_require__.main;
|
||||
const moduleFilename = mainModule && mainModule.filename || '';
|
||||
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
|
||||
run();
|
||||
}
|
||||
|
||||
export default bootstrap;
|
||||
`);
|
||||
}
|
9
my-app/node_modules/@schematics/angular/migrations/update-17/update-workspace-config.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@schematics/angular/migrations/update-17/update-workspace-config.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
import { Rule } from '@angular-devkit/schematics';
|
||||
export default function (): Rule;
|
32
my-app/node_modules/@schematics/angular/migrations/update-17/update-workspace-config.js
generated
vendored
Executable file
32
my-app/node_modules/@schematics/angular/migrations/update-17/update-workspace-config.js
generated
vendored
Executable file
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const workspace_1 = require("../../utility/workspace");
|
||||
const workspace_models_1 = require("../../utility/workspace-models");
|
||||
function default_1() {
|
||||
return (0, workspace_1.updateWorkspace)((workspace) => {
|
||||
for (const [, project] of workspace.projects) {
|
||||
if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
|
||||
// Only interested in application projects since these changes only effects application builders
|
||||
continue;
|
||||
}
|
||||
for (const [, target] of project.targets) {
|
||||
if (target.builder === workspace_models_1.Builders.ExtractI18n || target.builder === workspace_models_1.Builders.DevServer) {
|
||||
for (const [, options] of (0, workspace_1.allTargetOptions)(target, false)) {
|
||||
if (options['browserTarget'] !== undefined) {
|
||||
options['buildTarget'] = options['browserTarget'];
|
||||
delete options['browserTarget'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.default = default_1;
|
9
my-app/node_modules/@schematics/angular/migrations/update-17/use-application-builder.d.ts
generated
vendored
Executable file
9
my-app/node_modules/@schematics/angular/migrations/update-17/use-application-builder.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
import { Rule } from '@angular-devkit/schematics';
|
||||
export default function (): Rule;
|
161
my-app/node_modules/@schematics/angular/migrations/update-17/use-application-builder.js
generated
vendored
Executable file
161
my-app/node_modules/@schematics/angular/migrations/update-17/use-application-builder.js
generated
vendored
Executable file
|
@ -0,0 +1,161 @@
|
|||
"use strict";
|
||||
/**
|
||||
* @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.io/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const schematics_1 = require("@angular-devkit/schematics");
|
||||
const posix_1 = require("node:path/posix");
|
||||
const json_file_1 = require("../../utility/json-file");
|
||||
const workspace_1 = require("../../utility/workspace");
|
||||
const workspace_models_1 = require("../../utility/workspace-models");
|
||||
function default_1() {
|
||||
return async (tree, context) => {
|
||||
const rules = [];
|
||||
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
||||
for (const [name, project] of workspace.projects) {
|
||||
if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
|
||||
// Only interested in application projects since these changes only effects application builders
|
||||
continue;
|
||||
}
|
||||
const buildTarget = project.targets.get('build');
|
||||
if (!buildTarget || buildTarget.builder === workspace_models_1.Builders.Application) {
|
||||
continue;
|
||||
}
|
||||
if (buildTarget.builder !== workspace_models_1.Builders.BrowserEsbuild &&
|
||||
buildTarget.builder !== workspace_models_1.Builders.Browser) {
|
||||
context.logger.error(`Cannot update project "${name}" to use the application builder.` +
|
||||
` Only "${workspace_models_1.Builders.BrowserEsbuild}" and "${workspace_models_1.Builders.Browser}" can be automatically migrated.`);
|
||||
continue;
|
||||
}
|
||||
// Update builder target and options
|
||||
buildTarget.builder = workspace_models_1.Builders.Application;
|
||||
const hasServerTarget = project.targets.has('server');
|
||||
for (const [, options] of (0, workspace_1.allTargetOptions)(buildTarget, false)) {
|
||||
// Show warnings for using no longer supported options
|
||||
if (usesNoLongerSupportedOptions(options, context, name)) {
|
||||
continue;
|
||||
}
|
||||
if (options['index'] === '') {
|
||||
options['index'] = false;
|
||||
}
|
||||
// Rename and transform options
|
||||
options['browser'] = options['main'];
|
||||
if (hasServerTarget && typeof options['browser'] === 'string') {
|
||||
options['server'] = (0, posix_1.dirname)(options['browser']) + '/main.server.ts';
|
||||
}
|
||||
options['serviceWorker'] = options['ngswConfigPath'] ?? options['serviceWorker'];
|
||||
if (typeof options['polyfills'] === 'string') {
|
||||
options['polyfills'] = [options['polyfills']];
|
||||
}
|
||||
let outputPath = options['outputPath'];
|
||||
if (typeof outputPath === 'string') {
|
||||
if (!/\/browser\/?$/.test(outputPath)) {
|
||||
// TODO: add prompt.
|
||||
context.logger.warn(`The output location of the browser build has been updated from "${outputPath}" to ` +
|
||||
`"${(0, posix_1.join)(outputPath, 'browser')}". ` +
|
||||
'You might need to adjust your deployment pipeline or, as an alternative, ' +
|
||||
'set outputPath.browser to "" in order to maintain the previous functionality.');
|
||||
}
|
||||
else {
|
||||
outputPath = outputPath.replace(/\/browser\/?$/, '');
|
||||
}
|
||||
options['outputPath'] = {
|
||||
base: outputPath,
|
||||
};
|
||||
if (typeof options['resourcesOutputPath'] === 'string') {
|
||||
const media = options['resourcesOutputPath'].replaceAll('/', '');
|
||||
if (media && media !== 'media') {
|
||||
options['outputPath'] = {
|
||||
base: outputPath,
|
||||
media: media,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
// Delete removed options
|
||||
delete options['deployUrl'];
|
||||
delete options['vendorChunk'];
|
||||
delete options['commonChunk'];
|
||||
delete options['resourcesOutputPath'];
|
||||
delete options['buildOptimizer'];
|
||||
delete options['main'];
|
||||
delete options['ngswConfigPath'];
|
||||
}
|
||||
// Merge browser and server tsconfig
|
||||
if (hasServerTarget) {
|
||||
const browserTsConfig = buildTarget?.options?.tsConfig;
|
||||
const serverTsConfig = project.targets.get('server')?.options?.tsConfig;
|
||||
if (typeof browserTsConfig !== 'string') {
|
||||
throw new schematics_1.SchematicsException(`Cannot update project "${name}" to use the application builder` +
|
||||
` as the browser tsconfig cannot be located.`);
|
||||
}
|
||||
if (typeof serverTsConfig !== 'string') {
|
||||
throw new schematics_1.SchematicsException(`Cannot update project "${name}" to use the application builder` +
|
||||
` as the server tsconfig cannot be located.`);
|
||||
}
|
||||
const browserJson = new json_file_1.JSONFile(tree, browserTsConfig);
|
||||
const serverJson = new json_file_1.JSONFile(tree, serverTsConfig);
|
||||
const filesPath = ['files'];
|
||||
const files = new Set([
|
||||
...(browserJson.get(filesPath) ?? []),
|
||||
...(serverJson.get(filesPath) ?? []),
|
||||
]);
|
||||
// Server file will be added later by the means of the ssr schematic.
|
||||
files.delete('server.ts');
|
||||
browserJson.modify(filesPath, Array.from(files));
|
||||
const typesPath = ['compilerOptions', 'types'];
|
||||
browserJson.modify(typesPath, Array.from(new Set([
|
||||
...(browserJson.get(typesPath) ?? []),
|
||||
...(serverJson.get(typesPath) ?? []),
|
||||
])));
|
||||
// Delete server tsconfig
|
||||
tree.delete(serverTsConfig);
|
||||
}
|
||||
// Update main tsconfig
|
||||
const rootJson = new json_file_1.JSONFile(tree, 'tsconfig.json');
|
||||
rootJson.modify(['compilerOptions', 'esModuleInterop'], true);
|
||||
rootJson.modify(['compilerOptions', 'downlevelIteration'], undefined);
|
||||
rootJson.modify(['compilerOptions', 'allowSyntheticDefaultImports'], undefined);
|
||||
// Update server file
|
||||
const ssrMainFile = project.targets.get('server')?.options?.['main'];
|
||||
if (typeof ssrMainFile === 'string') {
|
||||
tree.delete(ssrMainFile);
|
||||
rules.push((0, schematics_1.externalSchematic)('@schematics/angular', 'ssr', {
|
||||
project: name,
|
||||
skipInstall: true,
|
||||
}));
|
||||
}
|
||||
// Delete package.json helper scripts
|
||||
const pkgJson = new json_file_1.JSONFile(tree, 'package.json');
|
||||
['build:ssr', 'dev:ssr', 'serve:ssr', 'prerender'].forEach((s) => pkgJson.remove(['scripts', s]));
|
||||
// Delete all redundant targets
|
||||
for (const [key, target] of project.targets) {
|
||||
switch (target.builder) {
|
||||
case workspace_models_1.Builders.Server:
|
||||
case workspace_models_1.Builders.Prerender:
|
||||
case workspace_models_1.Builders.AppShell:
|
||||
case workspace_models_1.Builders.SsrDevServer:
|
||||
project.targets.delete(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Save workspace changes
|
||||
await core_1.workspaces.writeWorkspace(workspace, new workspace_1.TreeWorkspaceHost(tree));
|
||||
return (0, schematics_1.chain)(rules);
|
||||
};
|
||||
}
|
||||
exports.default = default_1;
|
||||
function usesNoLongerSupportedOptions({ deployUrl, resourcesOutputPath }, context, projectName) {
|
||||
let hasUsage = false;
|
||||
if (typeof deployUrl === 'string') {
|
||||
hasUsage = true;
|
||||
context.logger.warn(`Skipping migration for project "${projectName}". "deployUrl" option is not available in the application builder.`);
|
||||
}
|
||||
return hasUsage;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue