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

Commit 150a519

Browse files
Narretzgkalpak
authored andcommitted
chore(docs-gen): create plnkr examples with the correct version
- docs for the snapshot will include the snapshot files from code.angularjs.org - docs for tagged versions will include the files from the (Google) CDN - docs for local / untagged versions will try to include the files from the (Google) CDN, which will fail. This gives immediate feedback that something is broken. Closes #15267 Closes #15358
1 parent e31175e commit 150a519

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

docs/config/services/deployments/production.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
'use strict';
22

33
var versionInfo = require('../../../../lib/versions/version-info');
4-
var cdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/' + versionInfo.cdnVersion;
4+
5+
var googleCdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/';
6+
var angularCodeUrl = '//code.angularjs.org/';
7+
8+
var cdnUrl = googleCdnUrl + versionInfo.cdnVersion;
9+
10+
// The plnkr examples must use the code.angularjs.org repo for the snapshot,
11+
// and the cdn for the tagged version and, if the build is not tagged, the currentVersion.
12+
//
13+
// The currentVersion may not be available on the cdn (e.g. if built locally, or hasn't been pushed
14+
// yet). This will lead to a 404, but this is preferable to loading a version with which the example
15+
// might not work (possibly in subtle ways).
16+
var examplesCdnUrl = versionInfo.isSnapshot ?
17+
(angularCodeUrl + 'snapshot') :
18+
(googleCdnUrl + (versionInfo.version || versionInfo.currentVersion));
519

620
module.exports = function productionDeployment(getVersion) {
721
return {
822
name: 'production',
923
examples: {
1024
commonFiles: {
11-
scripts: [cdnUrl + '/angular.min.js']
25+
scripts: [examplesCdnUrl + '/angular.min.js']
1226
},
13-
dependencyPath: cdnUrl + '/'
27+
dependencyPath: examplesCdnUrl + '/'
1428
},
1529
scripts: [
1630
cdnUrl + '/angular.min.js',

0 commit comments

Comments
 (0)