-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(angular): fix path handling and validate standalone option in pip…
…e generator (#16080)
- Loading branch information
1 parent
29f5326
commit 74633f5
Showing
8 changed files
with
102 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './normalize-options'; | ||
export * from './validate-options'; |
27 changes: 27 additions & 0 deletions
27
packages/angular/src/generators/pipe/lib/normalize-options.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Tree } from '@nrwl/devkit'; | ||
import { joinPathFragments, readProjectConfiguration } from '@nrwl/devkit'; | ||
import { parseNameWithPath } from '../../utils/names'; | ||
import type { NormalizedSchema, Schema } from '../schema'; | ||
|
||
export function normalizeOptions( | ||
tree: Tree, | ||
options: Schema | ||
): NormalizedSchema { | ||
const { projectType, root, sourceRoot } = readProjectConfiguration( | ||
tree, | ||
options.project | ||
); | ||
|
||
const projectSourceRoot = sourceRoot ?? joinPathFragments(root, 'src'); | ||
const { name, path: namePath } = parseNameWithPath(options.name); | ||
|
||
const path = | ||
options.path ?? | ||
joinPathFragments( | ||
projectSourceRoot, | ||
projectType === 'application' ? 'app' : 'lib', | ||
namePath | ||
); | ||
|
||
return { ...options, name, path }; | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/angular/src/generators/pipe/lib/validate-options.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { Tree } from '@nrwl/devkit'; | ||
import { checkPathUnderProjectRoot } from '../../utils/path'; | ||
import { | ||
validateProject, | ||
validateStandaloneOption, | ||
} from '../../utils/validations'; | ||
import type { Schema } from '../schema'; | ||
|
||
export function validateOptions(tree: Tree, options: Schema): void { | ||
validateProject(tree, options.project); | ||
checkPathUnderProjectRoot(tree, options.project, options.path); | ||
validateStandaloneOption(tree, options.standalone); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74633f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx.dev
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app