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

chore(docs-gen): create plnkr examples with the correct version #15358

Merged
merged 1 commit into from
Nov 5, 2016
Merged
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
20 changes: 17 additions & 3 deletions docs/config/services/deployments/production.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
'use strict';

var versionInfo = require('../../../../lib/versions/version-info');
var cdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/' + versionInfo.cdnVersion;

var googleCdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/';
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.isSnapshot ?
(angularCodeUrl + 'snapshot') :
(googleCdnUrl + (versionInfo.version || versionInfo.currentVersion));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if the versionInfo.version is not available then we are doing a local non-snapshot build. In which case the plunkers are going to be useless. Perhaps we should default to the snapshot though in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about setting the cdnVersion. Snapshot is also possible, but my idea was that in the rare case of no .version + testing in plnkr (basically only local), it's better to have the immediate feedback of a 404 script instead of a (probably) working app, that might not be 100% compatible with the angular version it runs on.


module.exports = function productionDeployment(getVersion) {
return {
name: 'production',
examples: {
commonFiles: {
scripts: [cdnUrl + '/angular.min.js']
scripts: [examplesCdnUrl + '/angular.min.js']
},
dependencyPath: cdnUrl + '/'
dependencyPath: examplesCdnUrl + '/'
},
scripts: [
cdnUrl + '/angular.min.js',
Expand Down