Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit 2249416

Browse files
committed
merge angular.io master
2 parents 1042a7c + 5fd6ae3 commit 2249416

File tree

334 files changed

+3243
-2508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+3243
-2508
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ _.*
2121
**/resources/zips
2222
public/docs/xref-*.*
2323
_zip-output
24-
www
24+
www*
2525
npm-debug*.log*
2626
*.plnkr.html
2727
plnkr.html
28+
*.eplnkr.html
29+
eplnkr.html
2830
*plnkr.no-link.html
2931
public/docs/*/latest/guide/cheatsheet.json
3032
protractor-results.txt

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ env:
1010
- DBUS_SESSION_BUS_ADDRESS=/dev/null
1111
- DISPLAY=:99.0
1212
- CHROME_BIN=chromium-browser
13-
- LATEST_RELEASE=2.0.0-rc.4
13+
- LATEST_RELEASE=2.0.0-rc.5
1414
- TASK_FLAGS="--dgeni-log=warn"
15-
# - TASK_FLAGS=""
1615
matrix:
1716
- TASK=lint
1817
- TASK="run-e2e-tests --fast" SCRIPT=examples-install.sh
1918
- TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh
20-
- TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50"
21-
- TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50"
19+
- TASK=build-compile SCRIPT=deploy-install.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
20+
- TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
2221
matrix:
2322
fast_finish: true
2423
allow_failures:
2524
- env: TASK="run-e2e-tests --fast" SCRIPT=examples-install-preview.sh
26-
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50"
25+
- env: TASK=build-compile SCRIPT=deploy-install-preview.sh WAIT="travis_wait 50" POST_SCRIPT="check-docs.sh -v"
2726
before_install:
2827
- source ./scripts/env-set.sh
2928
- ./scripts/before-install.sh
@@ -34,3 +33,4 @@ before_script:
3433
- sh -e /etc/init.d/xvfb start
3534
script:
3635
- $WAIT gulp $TASK $TASK_FLAGS
36+
- if [[ -n "$POST_SCRIPT" ]]; then ./scripts/$POST_SCRIPT; fi

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ si no, instala [nvm](https://github.com/creationix/nvm) para conseguir node en t
3232

3333
2. Instale *globalmente* estos paquetes npm: `npm install -g harp gulp`
3434

35-
3. Clone este repositorio y el [repositorio de código fuente de angular](https://github.com/angular/angular) en el mismo directorio.
35+
3. Clone este repositorio y el [repositorio de código fuente de angular](https://github.com/angular/angular), y el [repositorio de código fuente de dart-lang/angular 2](https://github.com/dart-lang/angular2) en el mismo directorio.
36+
El repositorio de angular tiene que llamarse **angular** y el de dart **angular-dart**.
3637

3738
4. cd dentro del directorio raiz `angular.io/`
3839

gulpfile.js

+99-38
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ var STYLES_SOURCE_PATH = path.join(TOOLS_PATH, 'styles-builder/less');
4545

4646
var docShredder = require(path.resolve(TOOLS_PATH, 'doc-shredder/doc-shredder'));
4747
var exampleZipper = require(path.resolve(TOOLS_PATH, '_example-zipper/exampleZipper'));
48-
var plunkerBuilder = require(path.resolve(TOOLS_PATH, 'plunker-builder/plunkerBuilder'));
48+
var regularPlunker = require(path.resolve(TOOLS_PATH, 'plunker-builder/regularPlunker'));
49+
var embeddedPlunker = require(path.resolve(TOOLS_PATH, 'plunker-builder/embeddedPlunker'));
4950
var fsUtils = require(path.resolve(TOOLS_PATH, 'fs-utils/fsUtils'));
5051

5152
const isSilent = !!argv.silent;
@@ -72,9 +73,10 @@ var _apiShredOptions = {
7273
logLevel: _dgeniLogLevel
7374
};
7475

76+
const relDartDocApiDir = path.join('doc', 'api');
7577
var _apiShredOptionsForDart = {
7678
lang: 'dart',
77-
examplesDir: path.resolve(ngPathFor('dart'), 'examples'),
79+
examplesDir: path.resolve(ngPathFor('dart'), 'example'),
7880
fragmentsDir: path.join(DOCS_PATH, '_fragments/_api'),
7981
zipDir: path.join(RESOURCES_PATH, 'zips/api'),
8082
logLevel: _dgeniLogLevel
@@ -118,22 +120,35 @@ var _styleLessName = 'a2docs.less';
118120
// or a regex pattern to match any one of 'ts', 'js', or 'dart'.
119121
// Default: 'ts|js' except for the "full site build" tasks (see below),
120122
// for which it is 'all'.
121-
//
122-
var lang, langs, buildDartApiDocs = false;
123+
124+
// langs and skipLangs partition ['ts', 'js', 'dart'].
125+
var lang, langs, skipLangs, buildDartApiDocs = false;
123126
function configLangs(langOption) {
124-
const fullSiteBuildTasks = ['build-compile', 'check-serve', 'check-deploy'];
127+
const fullSiteBuildTasks = ['build-compile', 'check-deploy', 'harp-compile'];
125128
const buildAllDocs = argv['_'] &&
126129
fullSiteBuildTasks.some((task) => argv['_'].indexOf(task) >= 0);
127130
const langDefault = buildAllDocs ? 'all' : 'ts|js';
128-
lang = (langOption || langDefault).toLowerCase();
129-
if (lang === 'all') lang = 'ts|js|dart';
130-
langs = lang.match(/\w+/g); // the languages in `lang` as an array
131-
gutil.log('Building docs for: ' + lang);
131+
if (langOption === '') {
132+
lang = '';
133+
langs = [];
134+
} else {
135+
lang = (langOption || langDefault).toLowerCase();
136+
if (lang === 'all') lang = 'ts|js|dart';
137+
langs = lang.match(/\w+/g); // the languages in `lang` as an array
138+
}
139+
gutil.log(`Building docs for: [${langs}]`);
132140
if (langs.indexOf('dart') >= 0) {
133141
buildDartApiDocs = true;
134142
// For Dart, be proactive about checking for the repo
135143
checkAngularProjectPath(ngPathFor('dart'));
144+
} else {
145+
argv.pub = false;
136146
}
147+
skipLangs = [];
148+
['ts', 'js', 'dart'].forEach(lang => {
149+
if (langs.indexOf(lang) < 0) skipLangs.push(lang);
150+
});
151+
gutil.log(`Skipped languages: [${skipLangs}]`);
137152
}
138153
configLangs(argv.lang);
139154

@@ -344,10 +359,15 @@ function runE2eDartTests(appDir, outputFile) {
344359
gutil.log('http-server failed to launch over ' + deployDir);
345360
return false;
346361
}
347-
var pubUpgradeSpawnInfo = spawnExt('pub', ['upgrade'], { cwd: appDir });
348-
var prepPromise = pubUpgradeSpawnInfo.promise.then(function (data) {
349-
return spawnExt('pub', ['build'], { cwd: appDir }).promise;
350-
});
362+
if (argv.pub === false) {
363+
var prepPromise = Promise.resolve(true);
364+
gutil.log('Skipping pub upgrade and pub build (--no-pub flag present)');
365+
} else {
366+
var pubUpgradeSpawnInfo = spawnExt('pub', ['upgrade'], { cwd: appDir });
367+
var prepPromise = pubUpgradeSpawnInfo.promise.then(function (data) {
368+
return spawnExt('pub', ['build'], { cwd: appDir }).promise;
369+
});
370+
}
351371
return runProtractor(prepPromise, appDir, appRunSpawnInfo, outputFile);
352372
}
353373

@@ -511,13 +531,15 @@ function installExampleAngular() {
511531
var sources;
512532
var template;
513533
var libs = [
514-
'core', 'common', 'compiler',
534+
'core', 'common', 'compiler', 'compiler-cli',
515535
'platform-browser', 'platform-browser-dynamic',
516536
'forms', 'http', 'router', 'upgrade'];
517537

518538
// Like: "angular/core-builds" or "@angular/core"
519539
sources = libs.map( lib => argv.build ? `angular/${lib}-builds` : `@angular/${lib}`);
520540

541+
if (argv.build) { sources.push('@angular/tsc-wrapped');} // tsc-wrapped needed for builds
542+
521543
sources.push('@angular/router-deprecated');
522544

523545
gutil.log(`Installing Angular npm packages from ${argv.build ? 'BUILD' : 'RELEASE'}`);
@@ -595,7 +617,8 @@ gulp.task('build-dart-api-docs', ['_shred-api-examples', 'dartdoc'], function()
595617
});
596618

597619
gulp.task('build-plunkers', ['_copy-example-boilerplate'], function() {
598-
return plunkerBuilder.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build });
620+
regularPlunker.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build });
621+
return embeddedPlunker.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build });
599622
});
600623

601624
gulp.task('build-dart-cheatsheet', [], function() {
@@ -604,16 +627,17 @@ gulp.task('build-dart-cheatsheet', [], function() {
604627

605628
gulp.task('dartdoc', ['pub upgrade'], function() {
606629
const ngRepoPath = ngPathFor('dart');
607-
if (argv.fast && fs.existsSync(path.resolve(ngRepoPath, 'docs', 'api'))) {
608-
gutil.log('Skipping dartdoc: --fast flag enabled and "docs/api" dir exists');
630+
if (argv.fast && fs.existsSync(path.resolve(ngRepoPath, relDartDocApiDir))) {
631+
gutil.log(`Skipping dartdoc: --fast flag enabled and api dir exists (${relDartDocApiDir})`);
609632
return true;
610633
}
611634
checkAngularProjectPath(ngRepoPath);
612635
const topLevelLibFilePath = path.resolve(ngRepoPath, 'lib', 'angular2.dart');
613636
const tmpPath = topLevelLibFilePath + '.disabled';
614637
renameIfExistsSync(topLevelLibFilePath, tmpPath);
615638
gutil.log(`Hiding top-level angular2 library: ${topLevelLibFilePath}`);
616-
const dartdoc = spawnExt('dartdoc', ['--output', 'docs/api', '--add-crossdart'], { cwd: ngRepoPath});
639+
// Remove dartdoc '--add-crossdart' flag while we are fixing links to API pages.
640+
const dartdoc = spawnExt('dartdoc', ['--output', relDartDocApiDir], { cwd: ngRepoPath});
617641
return dartdoc.promise.finally(() => {
618642
gutil.log(`Restoring top-level angular2 library: ${topLevelLibFilePath}`);
619643
renameIfExistsSync(tmpPath, topLevelLibFilePath);
@@ -677,20 +701,20 @@ gulp.task('git-changed-examples', ['_shred-devguide-examples'], function(){
677701
});
678702
});
679703

680-
gulp.task('harp-compile', [], function() {
704+
gulp.task('harp-compile', () => {
681705
return harpCompile()
682706
});
683707

684-
gulp.task('serve', [], function() {
685-
// Harp will serve files from workspace.
708+
gulp.task('harp-serve', () => {
709+
// Harp will watch and serve workspace files.
686710
const cmd = 'npm run harp -- server .';
687711
gutil.log('Launching harp server (over project files)');
688712
gutil.log(` > ${cmd}`);
689713
gutil.log('Note: issuing this command directly from the command line will show harp comiple warnings.');
690714
return execPromise(cmd);
691715
});
692716

693-
gulp.task('serve-www', [], function() {
717+
gulp.task('serve-www', () => {
694718
// Serve generated site.
695719
return execPromise('npm run live-server ./www');
696720
});
@@ -699,13 +723,6 @@ gulp.task('build-compile', ['build-docs'], function() {
699723
return harpCompile();
700724
});
701725

702-
gulp.task('check-serve', ['build-docs'], function() {
703-
return harpCompile().then(function() {
704-
gutil.log('Launching live-server over ./www');
705-
return execPromise('npm run live-server ./www');
706-
});
707-
});
708-
709726
gulp.task('check-deploy', ['build-docs'], function() {
710727
return harpCompile().then(function() {
711728
gutil.log('compile ok');
@@ -801,7 +818,7 @@ gulp.task('_shred-clean-devguide', function(cb) {
801818
gulp.task('_shred-api-examples', ['_shred-clean-api'], function() {
802819
const promises = [];
803820
gutil.log('Shredding API examples for languages: ' + langs.join(', '));
804-
langs.forEach((lang) => {
821+
langs.forEach(lang => {
805822
if (lang === 'js') return; // JS is handled via TS.
806823
checkAngularProjectPath(ngPathFor(lang));
807824
const options = lang == 'dart' ? _apiShredOptionsForDart : _apiShredOptions;
@@ -851,26 +868,39 @@ gulp.task('lint', function() {
851868
function harpCompile() {
852869
// Supposedly running in production makes harp faster
853870
// and less likely to drown in node_modules.
854-
env({
855-
vars: { NODE_ENV: "production" }
856-
});
871+
env({ vars: { NODE_ENV: "production" } });
857872
gutil.log("NODE_ENV: " + process.env.NODE_ENV);
858873

874+
if(skipLangs && fs.existsSync('www')) {
875+
gutil.log(`Harp site recompile: skipping recompilation of API docs for [${skipLangs}]`);
876+
gutil.log(`API docs will be copied from existing www folder.`)
877+
del.sync('www-backup'); // remove existing backup if it exists
878+
renameIfExistsSync('www', 'www-backup');
879+
} else {
880+
gutil.log(`Harp full site compile, including API docs for all languages.`);
881+
if (skipLangs)
882+
gutil.log(`Ignoring API docs skip set (${skipLangs}) because full site has not been built yet.`);
883+
}
884+
859885
var deferred = Q.defer();
860886
gutil.log('running harp compile...');
861887
showHideExampleNodeModules('hide');
888+
showHideApiDir('hide');
862889
var spawnInfo = spawnExt('npm',['run','harp', '--', 'compile', '.', './www' ]);
863890
spawnInfo.promise.then(function(x) {
864891
gutil.log("NODE_ENV: " + process.env.NODE_ENV);
865892
showHideExampleNodeModules('show');
893+
showHideApiDir('show');
866894
if (x !== 0) {
867895
deferred.reject(x)
868896
} else {
897+
restoreApiHtml();
869898
deferred.resolve(x);
870899
}
871900
}).catch(function(e) {
872901
gutil.log("NODE_ENV: " + process.env.NODE_ENV);
873902
showHideExampleNodeModules('show');
903+
showHideApiDir('show');
874904
deferred.reject(e);
875905
});
876906
return deferred.promise;
@@ -969,6 +999,37 @@ function showHideExampleNodeModules(showOrHide) {
969999
}
9701000
}
9711001

1002+
// Show/hide the API docs harp source folder for every lang in skipLangs.
1003+
function showHideApiDir(showOrHide) {
1004+
skipLangs.forEach(lang => {
1005+
_showHideApiDir(lang, showOrHide);
1006+
});
1007+
}
1008+
1009+
// Rename the API docs harp source folder for lang to/from 'api' to '_api-tmp-foo'.
1010+
function _showHideApiDir(lang, showOrHide) {
1011+
const vers = 'latest';
1012+
const basePath = path.join(DOCS_PATH, lang, vers);
1013+
const apiDirPath = path.join(basePath, 'api');
1014+
const disabledApiDirPath = path.join(basePath, '_api-tmp-hide-from-jade');
1015+
const args = showOrHide == 'hide'
1016+
? [apiDirPath, disabledApiDirPath]
1017+
: [disabledApiDirPath, apiDirPath];
1018+
renameIfExistsSync(...args);
1019+
}
1020+
1021+
// For each lang in skipLangs, copy the API dir from www-backup to www.
1022+
function restoreApiHtml() {
1023+
const vers = 'latest';
1024+
skipLangs.forEach(lang => {
1025+
const relApiDir = path.join('docs', lang, vers, 'api');
1026+
const wwwApiSubdir = path.join('www', relApiDir);
1027+
const backupApiSubdir = path.join('www-backup', relApiDir);
1028+
gutil.log(`cp ${backupApiSubdir} ${wwwApiSubdir}`)
1029+
fs.copySync(backupApiSubdir, wwwApiSubdir);
1030+
});
1031+
}
1032+
9721033
// Copies fileNames into destPaths, setting the mode of the
9731034
// files at the destination as optional_destFileMode if given.
9741035
// returns a promise
@@ -1087,11 +1148,10 @@ function watchAndSync(options, cb) {
10871148

10881149
// returns a promise;
10891150
function askDeploy() {
1090-
10911151
prompt.start();
10921152
var schema = {
10931153
name: 'shouldDeploy',
1094-
description: 'Deploy to Firebase? (y/n): ',
1154+
description: 'Deploy to Firebase? (y/n)',
10951155
type: 'string',
10961156
pattern: /Y|N|y|n/,
10971157
message: "Respond with either a 'y' or 'n'",
@@ -1241,7 +1301,7 @@ function buildApiDocsForDart() {
12411301
log.level = _dgeniLogLevel;
12421302
const dabInfo = dab.dartPkgConfigInfo;
12431303
dabInfo.ngIoDartApiDocPath = path.join(DOCS_PATH, 'dart', vers, 'api');
1244-
dabInfo.ngDartDocPath = path.join(ngPathFor('dart'), 'docs', 'api');
1304+
dabInfo.ngDartDocPath = path.join(ngPathFor('dart'), relDartDocApiDir);
12451305
// Exclude API entries for developer/internal libraries. Also exclude entries for
12461306
// the top-level catch all "angular2" library (otherwise every entry appears twice).
12471307
dabInfo.excludeLibRegExp = new RegExp(/^(?!angular2)|\.testing|_|codegen|^angular2$/);
@@ -1456,8 +1516,9 @@ function checkAngularProjectPath(_ngPath) {
14561516

14571517
function renameIfExistsSync(oldPath, newPath) {
14581518
if (fs.existsSync(oldPath)) {
1459-
fs.renameSync(oldPath, newPath);
1519+
gutil.log(`Rename: mv ${oldPath} ${newPath}`);
1520+
fs.renameSync(oldPath, newPath);
14601521
} else {
1461-
gutil.log(`renameIfExistsSync cannot find file to rename: ${oldPath}`);
1522+
gutil.log(`renameIfExistsSync cannot rename, path not found: ${oldPath}`);
14621523
}
14631524
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"protractor": "^3.0.0",
7272
"q": "^1.4.1",
7373
"tree-kill": "^1.0.0",
74-
"tslint": "^3.2.2",
74+
"tslint": "^3.15.1",
7575
"yargs": "^4.7.1"
7676
},
7777
"dependencies": {

public/_includes/_hero.jade

+3
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,8 @@ header(class="hero background-sky", style=fixHeroCss ? "height:auto" : "")
3535

3636
else if current.path[3] == 'api' && current.path[1] == 'dart'
3737
block breadcrumbs
38+
//- Show cross-language menu for top-level API page (but not entry pages)
39+
if ! public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]]
40+
!= partial("_version-dropdown")
3841
else if current.path[0] == "docs"
3942
!= partial("_version-dropdown")

0 commit comments

Comments
 (0)