Skip to content

Commit a51f1de

Browse files
chore(docs): Improve scripts/docs.js script: Expect ui-router-core to be installed as a peer to angular-ui-router. This enables docs building off master/master and preserves GitHub source lookup.
1 parent 4676732 commit a51f1de

8 files changed

+185
-206
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "State-based routing for AngularJS 1.x",
44
"version": "1.0.0-beta.4",
55
"scripts": {
6-
"clean": "shx rm -rf lib lib-esm _doc release",
6+
"clean": "shx rm -rf lib lib-esm _doc build release *.log",
77
"build": "tsc && tsc -m es6 --outDir lib-esm && npm run fixdts",
88
"fixdts": "dts-downlevel 'lib/**/*.d.ts' 'lib-esm/**/*.d.ts'",
99
"package": "npm run clean && npm run build && webpack --hide-modules",
@@ -15,7 +15,7 @@
1515
"test:integrate": "tsc && npm run test:ng12 && npm run test:ng13 && npm run test:ng14 && npm run test:ng15",
1616
"watch": "karma start --singleRun=false --autoWatch=true --autoWatchInterval=1",
1717
"debug": "karma start --singleRun=false --autoWatch=true --autoWatchInterval=1 --browsers=Chrome",
18-
"docs": "typedoc --tsconfig tsconfig.typedoc.json --readme README.md --name 'angular-ui-router' --theme node_modules/ui-router-typedoc-themes/bin/default --out _doc --internal-aliases internal,coreapi,ng1api --external-aliases internalapi,external --navigation-label-globals angular-ui-router"
18+
"docs": "./scripts/docs.js"
1919
},
2020
"homepage": "https://ui-router.github.io",
2121
"contributors": [
@@ -98,7 +98,7 @@
9898
"typedoc-plugin-internal-external": "^1.0.0",
9999
"typedoc-plugin-ui-router": "^1.0.0",
100100
"typescript": "^2.1.4",
101-
"ui-router-typedoc-themes": "^1.0.0",
101+
"ui-router-typedoc-themes": "^1.0.1",
102102
"watch": "^0.18.0",
103103
"webpack": "1.x",
104104
"webpack-dev-server": "1.x",

scripts/docs.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,41 @@ let typedocCmd = [
1616
].join(" ");
1717

1818
let PROJECTDIR = path.join(__dirname, '..');
19-
// let DOCGENDIR = '_docsgen';
2019
let PROJ2 = 'ui-router-core';
2120

2221
shelljs.pushd(PROJECTDIR);
2322

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
3424
shelljs.mv('src', 'src.bak');
3525
shelljs.cp('-r', 'src.bak', 'src');
3626

3727
let arr = [];
28+
// This replaces "ui-router-core" with "../../../ui-router-core"
29+
// while accounting for how many "../../" should be prepended
3830
for (var i = 0; i < 5; i++) {
3931
arr.push(arr.length);
4032

4133
let dots = arr.map((val) => '..').join('/');
4234
let stars = arr.map((val) => '*').join('/');
4335

36+
// Replace references to "ui-router-core/lib" with "../ui-router-core/lib" for typedoc
4437
replaceInFiles.sync({
4538
replace: / (['"])ui-router-core\/lib/,
46-
with: ' $1' + dots + '/ui-router-core/src',
39+
with: ' $1' + dots + '/../ui-router-core/src',
4740
files: 'src/' + stars + '.ts'
4841
});
4942

43+
// Replace references to "ui-router-core" with "../ui-router-core" for typedoc
5044
replaceInFiles.sync({
5145
replace: / (['"])ui-router-core/,
52-
with: ' $1' + dots + '/ui-router-core/src',
46+
with: ' $1' + dots + '/../ui-router-core/src',
5347
files: 'src/' + stars + '.ts'
5448
});
5549
}
5650

51+
// Run typedoc
5752
shelljs.exec(typedocCmd);
5853

54+
// Restore original sources
5955
shelljs.rm('-rf', 'src');
6056
shelljs.mv('src.bak', 'src');

src/directives/stateDirectives.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
*
44
* These directives are used in templates to create viewports and navigate to states
55
*
6-
* @ng1api @preferred @module directives
6+
* @ng1api
7+
* @preferred
8+
* @module directives
79
*/ /** for typedoc */
810
import { ng as angular } from "../angular";
911
import { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from "angular";

src/directives/viewDirective.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
/** @ng1api @module directives */ /** for typedoc */
1+
/**
2+
* @ng1api
3+
* @module directives
4+
*/ /** for typedoc */
25
import { ng as angular } from "../angular";
36
import {
47
IInterpolateService, IScope, ITranscludeFunction, IAugmentedJQuery,

src/injectables.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
* - [[$stateParams]]: State param values for pending Transition (deprecated)
4343
* - Any resolve data defined using [[Ng1StateDeclaration.resolve]]
4444
*
45-
* @ng1api @preferred @module injectables
45+
* @ng1api
46+
* @preferred
47+
* @module injectables
4648
*/ /** */
4749

4850
import { StateProvider } from "./stateProvider";

src/interface.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
/** @ng1api @module ng1 */ /** */
1+
/**
2+
* @ng1api
3+
* @module ng1
4+
*/ /** */
25
import { StateDeclaration, _ViewDeclaration, IInjectable, Transition, HookResult } from "ui-router-core";
36

47

tsconfig.typedoc.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"files": [
1313
"src/index.ts",
14+
"../ui-router-core/src/index.ts",
1415
"node_modules/typedoc/node_modules/typescript/lib/lib.es6.d.ts"
1516
]
1617
}

0 commit comments

Comments
 (0)