File tree Expand file tree Collapse file tree 3 files changed +18
-27
lines changed Expand file tree Collapse file tree 3 files changed +18
-27
lines changed Original file line number Diff line number Diff line change @@ -6,22 +6,9 @@ import {
6
6
Tree
7
7
} from '@angular-devkit/schematics' ;
8
8
import { getNpmScope } from '@nrwl/workspace' ;
9
+ import { validateInputs } from '../utils/lib-options' ;
9
10
import { UiOptions } from './schema' ;
10
11
11
- function validateInputs ( options : UiOptions ) : void {
12
- if ( options . shared && options . domain ) {
13
- throw new Error ( `A UI library should either belong to a specific domain or be shared globally.
14
- If you want to share a UI library across multiple specific domains,
15
- consider using an API library. Hence, you should not provide the shared option in combination
16
- with the domain option.` ) ;
17
- }
18
-
19
- if ( ! options . shared && ! options . domain ) {
20
- throw new Error ( `A UI library should either belong to a domain or be shared globally.
21
- Please provide either of these two options: --domain / --shared` ) ;
22
- }
23
- }
24
-
25
12
export default function ( options : UiOptions ) : Rule {
26
13
return ( host : Tree ) => {
27
14
validateInputs ( options ) ;
Original file line number Diff line number Diff line change @@ -6,21 +6,9 @@ import {
6
6
Tree
7
7
} from '@angular-devkit/schematics' ;
8
8
import { getNpmScope } from '@nrwl/workspace' ;
9
+ import { validateInputs } from '../utils/lib-options' ;
9
10
import { UtilOptions } from './schema' ;
10
11
11
- function validateInputs ( options : UtilOptions ) : void {
12
- if ( options . shared && options . domain ) {
13
- throw new Error ( `A utility library should either belong to a specific domain or be shared globally.
14
- If you want to share a utility library across multiple specific domains,
15
- consider using an API library. Hence, you should not provide the shared option in combination
16
- with the domain option.` ) ;
17
- }
18
-
19
- if ( ! options . shared && ! options . domain ) {
20
- throw new Error ( `A utilti library should either belong to a domain or be shared globally.
21
- Please provide either of these two options: --domain / --shared` ) ;
22
- }
23
- }
24
12
25
13
export default function ( options : UtilOptions ) : Rule {
26
14
return ( host : Tree ) => {
Original file line number Diff line number Diff line change
1
+ export function validateInputs ( options : {
2
+ domain ?: string ;
3
+ shared ?: boolean ;
4
+ } ) : void {
5
+ if ( options . shared && options . domain ) {
6
+ throw new Error ( `This library type should either belong to a specific domain or be shared globally.
7
+ If you want to share this library across multiple specific domains,
8
+ consider using an API library. Hence, you should not provide the shared option in combination
9
+ with the domain option.` ) ;
10
+ }
11
+
12
+ if ( ! options . shared && ! options . domain ) {
13
+ throw new Error ( `This library type should either belong to a domain or be shared globally.
14
+ Please provide either of these two options: --domain / --shared` ) ;
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments