@schematics/angular
Advanced tools
Comparing version 19.0.0-rc.2 to 19.0.0-rc.3
{ | ||
"name": "@schematics/angular", | ||
"version": "19.0.0-rc.2", | ||
"version": "19.0.0-rc.3", | ||
"description": "Schematics specific to Angular", | ||
@@ -25,4 +25,4 @@ "homepage": "https://github.com/angular/angular-cli", | ||
"dependencies": { | ||
"@angular-devkit/core": "19.0.0-rc.2", | ||
"@angular-devkit/schematics": "19.0.0-rc.2", | ||
"@angular-devkit/core": "19.0.0-rc.3", | ||
"@angular-devkit/schematics": "19.0.0-rc.3", | ||
"jsonc-parser": "3.3.1" | ||
@@ -29,0 +29,0 @@ }, |
@@ -10,2 +10,4 @@ /** | ||
import { Schema as SSROptions } from './schema'; | ||
export default function (options: SSROptions): Rule; | ||
export default function (inputOptions: SSROptions): Rule; | ||
export type Prompt = (message: string, defaultValue: boolean) => Promise<boolean>; | ||
export declare function setPrompterForTestOnly(prompter?: Prompt): void; |
@@ -9,4 +9,28 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = default_1; | ||
exports.setPrompterForTestOnly = setPrompterForTestOnly; | ||
const core_1 = require("@angular-devkit/core"); | ||
@@ -23,2 +47,3 @@ const schematics_1 = require("@angular-devkit/schematics"); | ||
const workspace_models_1 = require("../utility/workspace-models"); | ||
const tty_1 = require("./tty"); | ||
const SERVE_SSR_TARGET_NAME = 'serve-ssr'; | ||
@@ -54,3 +79,3 @@ const PRERENDER_TARGET_NAME = 'prerender'; | ||
if (outputPath === null || outputPath === undefined) { | ||
throw new schematics_1.SchematicsException(`outputPath for ${projectName} ${target} target is undeined or null.`); | ||
throw new schematics_1.SchematicsException(`outputPath for ${projectName} ${target} target is undefined or null.`); | ||
} | ||
@@ -272,8 +297,8 @@ const defaultDirs = { | ||
} | ||
function default_1(options) { | ||
function default_1(inputOptions) { | ||
return async (host, context) => { | ||
const browserEntryPoint = await (0, util_1.getMainFilePath)(host, options.project); | ||
const browserEntryPoint = await (0, util_1.getMainFilePath)(host, inputOptions.project); | ||
const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, browserEntryPoint); | ||
const workspace = await (0, workspace_1.getWorkspace)(host); | ||
const clientProject = workspace.projects.get(options.project); | ||
const clientProject = workspace.projects.get(inputOptions.project); | ||
if (!clientProject) { | ||
@@ -283,2 +308,4 @@ throw (0, project_targets_1.targetBuildNotFoundError)(); | ||
const isUsingApplicationBuilder = usingApplicationBuilder(clientProject); | ||
const serverRouting = await isServerRoutingEnabled(isUsingApplicationBuilder, inputOptions); | ||
const options = { ...inputOptions, serverRouting }; | ||
const sourceRoot = clientProject.sourceRoot ?? node_path_1.posix.join(clientProject.root, 'src'); | ||
@@ -310,1 +337,36 @@ return (0, schematics_1.chain)([ | ||
} | ||
const defaultPrompter = async (message, defaultValue) => { | ||
const { confirm } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts'))); | ||
return await confirm({ | ||
message, | ||
default: defaultValue, | ||
}); | ||
}; | ||
// Allow the prompt functionality to be overridden to facilitate testing. | ||
let prompt = defaultPrompter; | ||
function setPrompterForTestOnly(prompter) { | ||
prompt = prompter ?? defaultPrompter; | ||
} | ||
/** Returns whether or not server routing is enabled, potentially prompting the user if necessary. */ | ||
async function isServerRoutingEnabled(isUsingApplicationBuilder, options) { | ||
if (!isUsingApplicationBuilder) { | ||
if (options.serverRouting) { | ||
throw new schematics_1.SchematicsException('Server routing APIs can only be added to a project using `application` builder.'); | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
// Use explicit option if provided. | ||
if (options.serverRouting !== undefined) { | ||
return options.serverRouting; | ||
} | ||
const serverRoutingDefault = false; | ||
// Use the default if not in an interactive terminal. | ||
if (!(0, tty_1.isTTY)()) { | ||
return serverRoutingDefault; | ||
} | ||
// Prompt the user if in an interactive terminal and no option was provided. | ||
return await prompt('Would you like to use the Server Routing and App Engine APIs (Developer Preview) for this server application?', | ||
/* defaultValue */ serverRoutingDefault); | ||
} |
@@ -21,5 +21,3 @@ { | ||
"description": "Creates a server application using the Server Routing and App Engine APIs (Developer Preview).", | ||
"x-prompt": "Would you like to use the Server Routing and App Engine APIs (Developer Preview) for this server application?", | ||
"type": "boolean", | ||
"default": false | ||
"type": "boolean" | ||
} | ||
@@ -26,0 +24,0 @@ }, |
@@ -18,4 +18,4 @@ "use strict"; | ||
Angular: dependencies['@angular/core'], | ||
DevkitBuildAngular: '^19.0.0-rc.2', | ||
AngularSSR: '^19.0.0-rc.2', | ||
DevkitBuildAngular: '^19.0.0-rc.3', | ||
AngularSSR: '^19.0.0-rc.3', | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9956898
262
21309
+ Added@angular-devkit/core@19.0.0-rc.3(transitive)
+ Added@angular-devkit/schematics@19.0.0-rc.3(transitive)
- Removed@angular-devkit/core@19.0.0-rc.2(transitive)
- Removed@angular-devkit/schematics@19.0.0-rc.2(transitive)