Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/angular/pwa/pwa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Path, join } from '@angular-devkit/core';
import {
Rule,
SchematicContext,
SchematicsException,
Tree,
apply,
branchAndMerge,
Expand Down Expand Up @@ -36,6 +37,9 @@ export default function (options: PwaOptions): Rule {
return (host: Tree, context: SchematicContext) => {
const workspace = getWorkspace(host);
const project = workspace.projects[options.project];
if (project.projectType !== 'application') {
throw new SchematicsException(`PWA requires a project type of "application".`);
}

const assetPath = join(project.root as Path, 'src', 'assets');

Expand Down
3 changes: 3 additions & 0 deletions packages/schematics/angular/app-shell/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ function validateProject(options: AppShellOptions): Rule {
const routerOutletCheckRegex = /<router\-outlet.*?>([\s\S]*?)<\/router\-outlet>/;

const clientProject = getClientProject(host, options);
if (clientProject.projectType !== 'application') {
throw new SchematicsException(`App shell requires a project type of "application".`);
}
const componentPath = getBootstrapComponentPath(host, clientProject);
const tmpl = getComponentTemplateInfo(host, componentPath);
const template = getComponentTemplate(host, componentPath, tmpl);
Expand Down
3 changes: 3 additions & 0 deletions packages/schematics/angular/service-worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ export default function (options: ServiceWorkerOptions): Rule {
if (!project) {
throw new SchematicsException(`Invalid project name (${options.project})`);
}
if (project.projectType !== 'application') {
throw new SchematicsException(`Service worker requires a project type of "application".`);
}

const templateSource = apply(url('./files'), [
template({...options}),
Expand Down
3 changes: 3 additions & 0 deletions packages/schematics/angular/universal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ function getTsConfigOutDir(host: Tree, architect: experimental.workspace.Workspa
export default function (options: UniversalOptions): Rule {
return (host: Tree, context: SchematicContext) => {
const clientProject = getClientProject(host, options);
if (clientProject.projectType !== 'application') {
throw new SchematicsException(`Universal requires a project type of "application".`);
}
const clientArchitect = getClientArchitect(host, options);
const outDir = getTsConfigOutDir(host, clientArchitect);
const tsConfigExtends = basename(clientArchitect.build.options.tsConfig);
Expand Down