Skip to content

Update upstream #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
keep_alive &
deploy:
- provider: firebase
# the upload folder for firebase is configured in /firebase.json
skip_cleanup: true
token:
secure: $FIREBASE_TOKEN
Expand All @@ -92,7 +93,7 @@ jobs:
secret_access_key:
secure: tHIFdSq55qkyZf9zT/3+VkhUrTvOTMuswxXU3KyWaBrSieZqG0UnUDyNm+n3lSfX95zEl/+rJAWbfvhVSxZi13ndOtvRF+MdI1cvow2JynP0aDSiPffEvVrZOmihD6mt2SlMfhskr5FTduQ69kZG6DfLcve1PPDaIwnbOv3phb8=
bucket: code-angularjs-org-338b8.appspot.com
local-dir: upload
local-dir: uploadCode
detect_encoding: true # detects gzip compression
on:
repo: angular/angular.js
Expand Down
35 changes: 31 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,29 @@ module.exports = function(grunt) {
copy: {
i18n: {
files: [
{ src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
{
src: 'src/ngLocale/**',
dest: 'build/i18n/',
expand: true,
flatten: true
}
]
},
deployFirebaseDocs: {
files: [
// The source files are needed by the embedded examples in the docs app.
{
src: 'build/angular*.{js.map,min.js}',
dest: 'uploadDocs/',
expand: true,
flatten: true
},
{
cwd: 'build/docs',
src: '**',
dest: 'uploadDocs/',
expand: true
}
]
}
},
Expand All @@ -326,14 +348,14 @@ module.exports = function(grunt) {
dot: true,
dest: dist + '/'
},
firebaseCodeDeploy: {
deployFirebaseCode: {
options: {
mode: 'gzip'
},
src: ['**'],
cwd: 'build',
expand: true,
dest: 'upload/' + deployVersion + '/'
dest: 'uploadCode/' + deployVersion + '/'
}
},

Expand Down Expand Up @@ -427,14 +449,19 @@ module.exports = function(grunt) {
'collect-errors',
'write',
'docs',
'copy',
'copy:i18n',
'compress:build'
]);
grunt.registerTask('ci-checks', [
'ddescribe-iit',
'merge-conflict',
'eslint'
]);
grunt.registerTask('prepareFirebaseDeploy', [
'package',
'compress:deployFirebaseCode',
'copy:deployFirebaseDocs'
]);
grunt.registerTask('default', ['package']);
};

Expand Down
19 changes: 19 additions & 0 deletions docs/app/e2e/app.scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ describe('docs.angularjs.org', function() {
});


it('should include the files for the embedded examples from the same domain', function() {
browser.get('build/docs/index-production.html#!api/ng/directive/ngClick');

var origin = browser.executeScript('return document.location.origin;');

var exampleIFrame = element(by.name('example-ng-click'));

// This is technically an implementation detail, but if this changes, then there's a good
// chance the deployment process changed
expect(exampleIFrame.getAttribute('src')).toContain('examples/example-ng-click/index.html');

browser.switchTo().frame('example-ng-click');

var scriptEl = element(by.tagName('script'));

// Ensure the included file is from the same domain
expect(scriptEl.getAttribute('src')).toContain(origin);
});


it('should be resilient to trailing slashes', function() {
browser.get('build/docs/index-production.html#!/api/ng/function/angular.noop/');
Expand Down
1 change: 0 additions & 1 deletion docs/app/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ angular.module('docsApp', [
'search',
'tutorials',
'versions',
'deployment',
'ui.bootstrap.dropdown'
])

Expand Down
8 changes: 1 addition & 7 deletions docs/app/src/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ angular.module('examples', [])
return {
restrict: 'C',
scope : true,
controller : ['$scope', 'DEPLOYMENT', function($scope, DEPLOYMENT) {
var exampleIndexFile = (DEPLOYMENT === 'default' ? 'index' : 'index-' + DEPLOYMENT) + '.html';

$scope.getExampleIndex = function(basePath) {
return basePath + '/' + exampleIndexFile;
};

controller : ['$scope', function($scope) {
$scope.setTab = function(index) {
var tab = $scope.tabs[index];
$scope.activeTabIndex = index;
Expand Down
12 changes: 1 addition & 11 deletions docs/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ module.exports = new Package('angularjs', [
docTypes: ['indexPage'],
pathTemplate: '.',
outputPathTemplate: '${id}.html'
}, {
docTypes: ['deploymentData'],
pathTemplate: '.',
outputPathTemplate: 'js/${id}.js'
});

computePathsProcessor.pathTemplates.push({
Expand All @@ -129,14 +125,8 @@ module.exports = new Package('angularjs', [
outputPathTemplate: 'partials/${area}/${moduleName}/${groupType}.html'
});

computePathsProcessor.pathTemplates.push({
docTypes: ['example'],
pathTemplate: 'examples/${example.id}',
outputPathTemplate: 'examples/${example.id}/index${deploymentQualifier}.html'
});

computeIdsProcessor.idTemplates.push({
docTypes: ['overview', 'tutorial', 'e2e-test', 'indexPage', 'deploymentData'],
docTypes: ['overview', 'tutorial', 'e2e-test', 'indexPage'],
getId: function(doc) { return doc.fileInfo.baseName; },
getAliases: function(doc) { return [doc.id]; }
});
Expand Down
10 changes: 0 additions & 10 deletions docs/config/processors/index-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,7 @@ module.exports = function generateIndexPagesProcessor() {

indexDoc.id = 'index' + (deployment.name === 'default' ? '' : '-' + deployment.name);

var deploymentDoc = {
docType: 'deploymentData',
id: 'deployment-data-' + deployment.name,
template: 'angular-service.template.js',
ngModuleName: 'deployment',
serviceName: 'DEPLOYMENT',
serviceValue: deployment.name
};

docs.push(indexDoc);
docs.push(deploymentDoc);
});
}
};
Expand Down
1 change: 0 additions & 1 deletion docs/config/services/deployments/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module.exports = function debugDeployment(getVersion) {
'js/all-versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/deployment-data-debug.js',
'js/docs.js'
],
stylesheets: [
Expand Down
1 change: 0 additions & 1 deletion docs/config/services/deployments/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module.exports = function defaultDeployment(getVersion) {
'js/all-versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/deployment-data-default.js',
'js/docs.min.js'
],
stylesheets: [
Expand Down
1 change: 0 additions & 1 deletion docs/config/services/deployments/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module.exports = function jqueryDeployment(getVersion) {
'js/all-versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/deployment-data-jquery.js',
'js/docs.min.js'
],
stylesheets: [
Expand Down
21 changes: 10 additions & 11 deletions docs/config/services/deployments/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ var angularCodeUrl = '//code.angularjs.org/';

var cdnUrl = googleCdnUrl + versionInfo.cdnVersion;

// The plnkr examples must use the code.angularjs.org repo for the snapshot,
// and the cdn for the tagged version and, if the build is not tagged, the currentVersion.
//
// The currentVersion may not be available on the cdn (e.g. if built locally, or hasn't been pushed
// yet). This will lead to a 404, but this is preferable to loading a version with which the example
// might not work (possibly in subtle ways).
var examplesCdnUrl = versionInfo.currentVersion.isSnapshot ?
// The "examplesCdnUrl" here applies to the examples when they are opened in plnkr.co.
// The embedded examples instead always include the files from the *default* deployment,
// to ensure that the source files are always available.
// The plnkr examples must always use the code.angularjs.org source files.
// We cannot rely on the CDN files here, because they are not deployed by the time
// docs.angularjs.org and code.angularjs.org need them.
var examplesDependencyPath = versionInfo.currentVersion.isSnapshot ?
(angularCodeUrl + 'snapshot') :
(googleCdnUrl + (versionInfo.currentVersion.version || versionInfo.currentVersion));
(angularCodeUrl + (versionInfo.currentVersion.version || versionInfo.currentVersion.version));

module.exports = function productionDeployment(getVersion) {
return {
name: 'production',
examples: {
commonFiles: {
scripts: [examplesCdnUrl + '/angular.min.js']
scripts: [examplesDependencyPath + '/angular.min.js']
},
dependencyPath: examplesCdnUrl + '/'
dependencyPath: examplesDependencyPath
},
scripts: [
cdnUrl + '/angular.min.js',
Expand All @@ -43,7 +43,6 @@ module.exports = function productionDeployment(getVersion) {
'https://code.angularjs.org/snapshot/docs/js/all-versions-data.js',
'js/pages-data.js',
'js/nav-data.js',
'js/deployment-data-production.js',
'js/docs.min.js'
],
stylesheets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
{% endfor %}

<iframe class="runnable-example-frame" ng-src="{{getExampleIndex('{$ doc.example.deployments.default.path $}')}}" name="{$ doc.example.id $}"></iframe>
<iframe class="runnable-example-frame" src="{$ doc.example.deployments.default.outputPath $}" name="{$ doc.example.id $}"></iframe>
</div>
</div>

Expand Down
3 changes: 3 additions & 0 deletions docs/content/guide/production.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ and adds CSS classes to data-bound elements:
CSS class are attached to the corresponding element. These scope references can then be accessed via
`element.scope()` and `element.isolateScope()`.

- Placeholder comments for structural directives will contain information about what directive
and binding caused the placeholder. E.g. `<!-- ngIf: shouldShow() -->`.

Tools like [Protractor](https://github.com/angular/protractor) and
[Batarang](https://github.com/angular/angularjs-batarang) need this information to run,
but you can disable this in production for a significant performance boost with:
Expand Down
4 changes: 2 additions & 2 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hosting": {
"public": "build/docs",
"public": "uploadDocs",
"ignore": [
"/index.html",
"/index-debug.html",
Expand All @@ -16,7 +16,7 @@
"destination": "/index-production.html"
},
{
"source": "**/*!(.jpg|.jpeg|.gif|.png|.html|.js|.json|.css|.svg|.ttf|.woff|.woff2|.eot)",
"source": "**/*!(.jpg|.jpeg|.gif|.png|.html|.js|.map|.json|.css|.svg|.ttf|.woff|.woff2|.eot)",
"destination": "/index-production.html"
}
]
Expand Down
3 changes: 1 addition & 2 deletions scripts/travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ case "$JOB" in
"deploy")
# we never deploy on Pull requests, so it's safe to skip the build here
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
grunt package
grunt compress:firebaseCodeDeploy
grunt prepareFirebaseDeploy
else
echo "Skipping build because Travis has been triggered by Pull Request"
fi
Expand Down
5 changes: 5 additions & 0 deletions src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
* binding information and a reference to the current scope on to DOM elements.
* If enabled, the compiler will add the following to DOM elements that have been bound to the scope
* * `ng-binding` CSS class
* * `ng-scope` and `ng-isolated-scope` CSS classes
* * `$binding` data property containing an array of the binding expressions
* * Data properties used by the {@link angular.element#methods `scope()`/`isolateScope()` methods} to return
* the element's scope.
* * Placeholder comments will contain information about what directive and binding caused the placeholder.
* E.g. `<!-- ngIf: shouldShow() -->`.
*
* You may want to disable this in production for a significant performance boost. See
* {@link guide/production#disabling-debug-data Disabling Debug Data} for more.
Expand Down