This repository was archived by the owner on Apr 4, 2025. It is now read-only.
File tree 4 files changed +79
-0
lines changed
packages/schematics/angular
4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 20
20
"description" : " Create an enumeration." ,
21
21
"schema" : " ./enum/schema.json"
22
22
},
23
+ "interface" : {
24
+ "factory" : " ./interface" ,
25
+ "description" : " Create an interface." ,
26
+ "schema" : " ./interface/schema.json"
27
+ },
23
28
"module" : {
24
29
"factory" : " ./module" ,
25
30
"description" : " Create an Angular module." ,
Original file line number Diff line number Diff line change
1
+ export interface < %= prefix % > < %= classify ( name ) % > {
2
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license
3
+ * Copyright Google Inc. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ // TODO: replace `options: any` with an actual type generated from the schema.
9
+ // tslint:disable:no-any
10
+ import {
11
+ Rule ,
12
+ apply ,
13
+ branchAndMerge ,
14
+ chain ,
15
+ mergeWith ,
16
+ move ,
17
+ template ,
18
+ url ,
19
+ } from '@angular-devkit/schematics' ;
20
+ import * as stringUtils from '../strings' ;
21
+
22
+
23
+ export default function ( options : any ) : Rule {
24
+ options . prefix = options . prefix ? options . prefix : '' ;
25
+ options . type = ! ! options . type ? `.${ options . type } ` : '' ;
26
+
27
+ const templateSource = apply ( url ( './files' ) , [
28
+ template ( {
29
+ ...stringUtils ,
30
+ ...options ,
31
+ } ) ,
32
+ move ( options . sourceDir ) ,
33
+ ] ) ;
34
+
35
+ return chain ( [
36
+ branchAndMerge ( chain ( [
37
+ mergeWith ( templateSource ) ,
38
+ ] ) ) ,
39
+ ] ) ;
40
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "$schema" : " http://json-schema.org/schema" ,
3
+ "id" : " SchematicsAngularInterface" ,
4
+ "title" : " Angular Interface Options Schema" ,
5
+ "type" : " object" ,
6
+ "properties" : {
7
+ "name" : {
8
+ "type" : " string"
9
+ },
10
+ "path" : {
11
+ "type" : " string" ,
12
+ "default" : " app"
13
+ },
14
+ "sourceDir" : {
15
+ "type" : " string" ,
16
+ "default" : " src"
17
+ },
18
+ "prefix" : {
19
+ "type" : " string" ,
20
+ "default" : " " ,
21
+ "description" : " Specifies the prefix to use."
22
+ },
23
+ "type" : {
24
+ "type" : " string" ,
25
+ "description" : " Specifies the type of interface." ,
26
+ "default" : " "
27
+ }
28
+ },
29
+ "required" : [
30
+ " name"
31
+ ]
32
+ }
You can’t perform that action at this time.
0 commit comments