@@ -16,45 +16,41 @@ let typedocCmd = [
16
16
] . join ( " " ) ;
17
17
18
18
let PROJECTDIR = path . join ( __dirname , '..' ) ;
19
- // let DOCGENDIR = '_docsgen';
20
19
let PROJ2 = 'ui-router-core' ;
21
20
22
21
shelljs . pushd ( PROJECTDIR ) ;
23
22
24
- // shelljs.rm('-rf', DOCGENDIR);
25
- // shelljs.mkdir(DOCGENDIR);
26
-
27
- // shelljs.cp('-R', 'src', DOCGENDIR);
28
- // shelljs.mkdir(path.join(DOCGENDIR, PROJ2));
29
- // shelljs.cp('-R', path.join('..', PROJ2, '.git'), path.join(DOCGENDIR, PROJ2, '.git'));
30
- // shelljs.cp('-R', path.join('..', PROJ2, 'src'), path.join(DOCGENDIR, PROJ2, 'src'));
31
-
32
- // shelljs.ln('-s', path.join('..', '..', PROJ2), path.join(DOCGENDIR, PROJ2));
33
-
23
+ // Make a backup of the source directory
34
24
shelljs . mv ( 'src' , 'src.bak' ) ;
35
25
shelljs . cp ( '-r' , 'src.bak' , 'src' ) ;
36
26
37
27
let arr = [ ] ;
28
+ // This replaces "ui-router-core" with "../../../ui-router-core"
29
+ // while accounting for how many "../../" should be prepended
38
30
for ( var i = 0 ; i < 5 ; i ++ ) {
39
31
arr . push ( arr . length ) ;
40
32
41
33
let dots = arr . map ( ( val ) => '..' ) . join ( '/' ) ;
42
34
let stars = arr . map ( ( val ) => '*' ) . join ( '/' ) ;
43
35
36
+ // Replace references to "ui-router-core/lib" with "../ui-router-core/lib" for typedoc
44
37
replaceInFiles . sync ( {
45
38
replace : / ( [ ' " ] ) u i - r o u t e r - c o r e \/ l i b / ,
46
- with : ' $1' + dots + '/ui-router-core/src' ,
39
+ with : ' $1' + dots + '/../ ui-router-core/src' ,
47
40
files : 'src/' + stars + '.ts'
48
41
} ) ;
49
42
43
+ // Replace references to "ui-router-core" with "../ui-router-core" for typedoc
50
44
replaceInFiles . sync ( {
51
45
replace : / ( [ ' " ] ) u i - r o u t e r - c o r e / ,
52
- with : ' $1' + dots + '/ui-router-core/src' ,
46
+ with : ' $1' + dots + '/../ ui-router-core/src' ,
53
47
files : 'src/' + stars + '.ts'
54
48
} ) ;
55
49
}
56
50
51
+ // Run typedoc
57
52
shelljs . exec ( typedocCmd ) ;
58
53
54
+ // Restore original sources
59
55
shelljs . rm ( '-rf' , 'src' ) ;
60
56
shelljs . mv ( 'src.bak' , 'src' ) ;
0 commit comments