Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit bf3e107

Browse files
chalinkwalrath
authored andcommitted
docs(api/dart): avoid duplicate entries and fix breadcrumbs (#1945)
1 parent 36091d5 commit bf3e107

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

gulpfile.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,21 @@ var _exampleConfigFilename = 'example-config.json';
108108

109109
// Gulp flags:
110110
//
111-
// --lang=[all | ts | js | dart | (ts|js) | (ts|js|dart) | ...]
111+
// --lang=[all | ts | js | dart | 'ts|js' | 'ts|js|dart' | ...]
112112
//
113113
// This affects which language API docs and E2E tests are run. Can be 'all',
114114
// or a regex pattern to match any one of 'ts', 'js', or 'dart'.
115-
// Default: '(ts|js)' except for check-deploy for which it is 'all'.
115+
// Default: 'ts|js' except for the "full site build" tasks (see below),
116+
// for which it is 'all'.
116117
//
117118
var lang, langs, buildDartApiDocs = false;
118119
function configLangs(langOption) {
119120
const fullSiteBuildTasks = ['build-compile', 'check-serve', 'check-deploy'];
120121
const buildAllDocs = argv['_'] &&
121122
fullSiteBuildTasks.some((task) => argv['_'].indexOf(task) >= 0);
122-
const langDefault = buildAllDocs ? 'all' : '(ts|js)';
123+
const langDefault = buildAllDocs ? 'all' : 'ts|js';
123124
lang = (langOption || langDefault).toLowerCase();
124-
if (lang === 'all') lang = '(ts|js|dart)';
125+
if (lang === 'all') lang = 'ts|js|dart';
125126
langs = lang.match(/\w+/g); // the languages in `lang` as an array
126127
gutil.log('Building docs for: ' + lang);
127128
if (langs.indexOf('dart') >= 0) {
@@ -161,10 +162,8 @@ gulp.task('run-e2e-tests', runE2e);
161162
* Use it for repeated test runs (but not the FIRST run)
162163
* e.g. gulp e2e --fast
163164
*
164-
* --lang to filter by code language
165+
* --lang to filter by code language (see above for details)
165166
* e.g. gulp e2e --lang=ts // only TypeScript apps
166-
* default is (ts|js)
167-
* all means (ts|js|dart)
168167
*/
169168
function runE2e() {
170169
var promise;
@@ -596,8 +595,16 @@ gulp.task('dartdoc', ['pub upgrade'], function() {
596595
return true;
597596
}
598597
checkAngularProjectPath(ngRepoPath);
598+
const topLevelLibFilePath = path.resolve(ngRepoPath, 'lib', 'angular2.dart');
599+
const tmpPath = topLevelLibFilePath + '.disabled';
600+
if (!fs.existsSync(topLevelLibFilePath)) throw new Error(`Missing file: ${topLevelLibFilePath}`);
601+
fs.renameSync(topLevelLibFilePath, tmpPath);
602+
gutil.log(`Hiding top-level angular2 library: ${topLevelLibFilePath}`);
599603
const dartdoc = spawnExt('dartdoc', ['--output', 'doc/api', '--add-crossdart'], { cwd: ngRepoPath});
600-
return dartdoc.promise;
604+
return dartdoc.promise.finally(() => {
605+
gutil.log(`Restoring top-level angular2 library: ${topLevelLibFilePath}`);
606+
fs.renameSync(tmpPath, topLevelLibFilePath);
607+
})
601608
});
602609

603610
gulp.task('pub upgrade', [], function() {

0 commit comments

Comments
 (0)