fix(angular): add $schema property to generated project configs (#12031)
This commit is contained in:
parent
1c0bebf194
commit
e2bfaa68f7
@ -1,16 +1,15 @@
|
||||
import type { Tree } from '@nrwl/devkit';
|
||||
import type { NormalizedSchema } from './normalized-schema';
|
||||
|
||||
import {
|
||||
updateJson,
|
||||
addProjectConfiguration,
|
||||
getProjects,
|
||||
readProjectConfiguration,
|
||||
updateProjectConfiguration,
|
||||
removeProjectConfiguration,
|
||||
offsetFromRoot,
|
||||
readProjectConfiguration,
|
||||
removeProjectConfiguration,
|
||||
updateJson,
|
||||
} from '@nrwl/devkit';
|
||||
import { replaceAppNameWithPath } from '@nrwl/workspace/src/utils/cli-config-utils';
|
||||
import { E2eTestRunner, UnitTestRunner } from '../../../utils/test-runners';
|
||||
import type { NormalizedSchema } from './normalized-schema';
|
||||
|
||||
export function updateConfigFiles(host: Tree, options: NormalizedSchema) {
|
||||
updateTsConfigOptions(host, options);
|
||||
@ -88,7 +87,23 @@ function updateAppAndE2EProjectConfigurations(
|
||||
|
||||
project.tags = options.parsedTags;
|
||||
|
||||
updateProjectConfiguration(host, options.name, project);
|
||||
/**
|
||||
* The "$schema" property on our configuration files is only added when the
|
||||
* project configuration is added and not when updating it. It's done this
|
||||
* way to avoid re-adding "$schema" when updating a project configuration
|
||||
* and that property was intentionally removed by the devs.
|
||||
*
|
||||
* Since the project gets created by the Angular application schematic,
|
||||
* the "$schema" property is not added, so we remove the project and add
|
||||
* it back to workaround that.
|
||||
*/
|
||||
removeProjectConfiguration(host, options.name);
|
||||
addProjectConfiguration(
|
||||
host,
|
||||
options.name,
|
||||
project,
|
||||
options.standaloneConfig
|
||||
);
|
||||
|
||||
if (options.unitTestRunner === UnitTestRunner.None) {
|
||||
host.delete(`${options.appProjectRoot}/src/app/app.component.spec.ts`);
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
import {
|
||||
addProjectConfiguration,
|
||||
generateFiles,
|
||||
getWorkspaceLayout,
|
||||
joinPathFragments,
|
||||
offsetFromRoot,
|
||||
readProjectConfiguration,
|
||||
removeProjectConfiguration,
|
||||
Tree,
|
||||
updateJson,
|
||||
updateProjectConfiguration,
|
||||
} from '@nrwl/devkit';
|
||||
import { replaceAppNameWithPath } from '@nrwl/workspace/src/utils/cli-config-utils';
|
||||
import { getRelativePathToRootTsConfig } from '@nrwl/workspace/src/utilities/typescript';
|
||||
import { replaceAppNameWithPath } from '@nrwl/workspace/src/utils/cli-config-utils';
|
||||
import * as path from 'path';
|
||||
import { NormalizedSchema } from './normalized-schema';
|
||||
import { updateNgPackage } from './update-ng-package';
|
||||
@ -173,7 +174,23 @@ function fixProjectWorkspaceConfig(
|
||||
|
||||
delete project.targets.test;
|
||||
|
||||
updateProjectConfiguration(host, options.name, project);
|
||||
/**
|
||||
* The "$schema" property on our configuration files is only added when the
|
||||
* project configuration is added and not when updating it. It's done this
|
||||
* way to avoid re-adding "$schema" when updating a project configuration
|
||||
* and that property was intentionally removed by the devs.
|
||||
*
|
||||
* Since the project gets created by the Angular application schematic,
|
||||
* the "$schema" property is not added, so we remove the project and add
|
||||
* it back to workaround that.
|
||||
*/
|
||||
removeProjectConfiguration(host, options.name);
|
||||
addProjectConfiguration(
|
||||
host,
|
||||
options.name,
|
||||
project,
|
||||
options.standaloneConfig
|
||||
);
|
||||
}
|
||||
|
||||
function updateProjectTsConfig(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user