diff --git a/.travis.yml b/.travis.yml index b0b909f33c9d..4f4841e9bc03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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 diff --git a/Gruntfile.js b/Gruntfile.js index 8de52bca501f..0808eb468fe7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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 + } ] } }, @@ -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 + '/' } }, @@ -427,7 +449,7 @@ module.exports = function(grunt) { 'collect-errors', 'write', 'docs', - 'copy', + 'copy:i18n', 'compress:build' ]); grunt.registerTask('ci-checks', [ @@ -435,6 +457,11 @@ module.exports = function(grunt) { 'merge-conflict', 'eslint' ]); + grunt.registerTask('prepareFirebaseDeploy', [ + 'package', + 'compress:deployFirebaseCode', + 'copy:deployFirebaseDocs' + ]); grunt.registerTask('default', ['package']); }; diff --git a/docs/app/e2e/app.scenario.js b/docs/app/e2e/app.scenario.js index 823f1408c2e4..1333870eff4d 100644 --- a/docs/app/e2e/app.scenario.js +++ b/docs/app/e2e/app.scenario.js @@ -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/'); diff --git a/docs/app/src/app.js b/docs/app/src/app.js index 20e351ae97e1..df6272b0bf0b 100644 --- a/docs/app/src/app.js +++ b/docs/app/src/app.js @@ -14,7 +14,6 @@ angular.module('docsApp', [ 'search', 'tutorials', 'versions', - 'deployment', 'ui.bootstrap.dropdown' ]) diff --git a/docs/app/src/examples.js b/docs/app/src/examples.js index c9ffb20f016a..b5b21c5393fa 100644 --- a/docs/app/src/examples.js +++ b/docs/app/src/examples.js @@ -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; diff --git a/docs/config/index.js b/docs/config/index.js index e228fc34b72e..ab5e45a3f8dc 100644 --- a/docs/config/index.js +++ b/docs/config/index.js @@ -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({ @@ -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]; } }); diff --git a/docs/config/processors/index-page.js b/docs/config/processors/index-page.js index 3a7c8d210e47..102e3f53db50 100644 --- a/docs/config/processors/index-page.js +++ b/docs/config/processors/index-page.js @@ -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); }); } }; diff --git a/docs/config/services/deployments/debug.js b/docs/config/services/deployments/debug.js index b2b9da22b842..39cd327496e8 100644 --- a/docs/config/services/deployments/debug.js +++ b/docs/config/services/deployments/debug.js @@ -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: [ diff --git a/docs/config/services/deployments/default.js b/docs/config/services/deployments/default.js index eb1778a91903..181994f1e740 100644 --- a/docs/config/services/deployments/default.js +++ b/docs/config/services/deployments/default.js @@ -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: [ diff --git a/docs/config/services/deployments/jquery.js b/docs/config/services/deployments/jquery.js index 592de9dffabb..67263832e4f2 100644 --- a/docs/config/services/deployments/jquery.js +++ b/docs/config/services/deployments/jquery.js @@ -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: [ diff --git a/docs/config/services/deployments/production.js b/docs/config/services/deployments/production.js index 859c490388ba..7d92001e2e1d 100644 --- a/docs/config/services/deployments/production.js +++ b/docs/config/services/deployments/production.js @@ -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', @@ -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: [ diff --git a/docs/config/templates/examples/runnableExample.template.html b/docs/config/templates/examples/runnableExample.template.html index 41a7a3502671..26d689c10ad5 100644 --- a/docs/config/templates/examples/runnableExample.template.html +++ b/docs/config/templates/examples/runnableExample.template.html @@ -18,7 +18,7 @@ {% endfor %} - + diff --git a/docs/content/guide/production.ngdoc b/docs/content/guide/production.ngdoc index 10621884bf39..8fd465361b6b 100644 --- a/docs/content/guide/production.ngdoc +++ b/docs/content/guide/production.ngdoc @@ -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. ``. + 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: diff --git a/firebase.json b/firebase.json index 3427962f39bd..bbf70bed2a9f 100644 --- a/firebase.json +++ b/firebase.json @@ -1,6 +1,6 @@ { "hosting": { - "public": "build/docs", + "public": "uploadDocs", "ignore": [ "/index.html", "/index-debug.html", @@ -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" } ] diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index f7b33c3129da..b0ca7489e919 100755 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -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 diff --git a/src/ng/compile.js b/src/ng/compile.js index 615e42516fc1..143023f2aa63 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -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. ``. * * 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.