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

Commit 4d7e1ce

Browse files
juliemrpetebacondarwin
authored andcommitted
chore(doc-gen): generate examples for each deployment, e.g. jquery
Update to the latest dgeni-packages, which supports multiple deployment environments for the examples. Add a jQuery deployment environment for the examples. Currently, the target of the runnable example iframe always points to the default deployment environment, not to the environment under which the main app is running. Closes #6361
1 parent 58b01fa commit 4d7e1ce

File tree

4 files changed

+64
-12
lines changed

4 files changed

+64
-12
lines changed

docs/config/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ var _ = require('lodash');
22
var path = require('canonical-path');
33
var packagePath = __dirname;
44

5-
var angularjsPackage = require('dgeni-packages/ngdoc');
5+
var basePackage = require('dgeni-packages/ngdoc');
6+
var examplesPackage = require('dgeni-packages/examples');
67

78
module.exports = function(config) {
89

9-
config = angularjsPackage(config);
10+
config = basePackage(config);
11+
config = examplesPackage(config);
1012

1113
config.append('processing.processors', [
1214
require('./processors/git-data'),

docs/config/processors/index-page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
init: function(config) {
1212
deployment = config.deployment;
1313
if ( !deployment || !deployment.environments ) {
14-
throw new Errro('No deployment environments found in the config.');
14+
throw new Error('No deployment environments found in the config.');
1515
}
1616
},
1717
process: function(docs) {
@@ -39,4 +39,4 @@ module.exports = {
3939
docs.push(indexDoc);
4040
});
4141
}
42-
};
42+
};

docs/docs.config.js

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ module.exports = function(config) {
2525
{ pattern: '**/*.ngdoc', basePath: path.resolve(basePath, 'content') }
2626
]);
2727

28-
config.set('processing.examples.commonFiles', {
29-
scripts: [ '../../../angular.js' ],
30-
stylesheets: []
31-
});
32-
config.set('processing.examples.dependencyPath', '../../..');
33-
34-
3528
config.set('processing.errors.minerrInfoPath', path.resolve(basePath, '../build/errors.json'));
3629

3730
config.set('rendering.outputFolder', '../build/docs');
@@ -41,6 +34,12 @@ module.exports = function(config) {
4134
config.merge('deployment', {
4235
environments: [{
4336
name: 'debug',
37+
examples: {
38+
commonFiles: {
39+
scripts: [ '../../../angular.js' ]
40+
},
41+
dependencyPath: '../../..'
42+
},
4443
scripts: [
4544
'../angular.js',
4645
'../angular-resource.js',
@@ -70,7 +69,52 @@ module.exports = function(config) {
7069
},
7170
{
7271
name: 'default',
72+
examples: {
73+
commonFiles: {
74+
scripts: [ '../../../angular.min.js' ]
75+
},
76+
dependencyPath: '../../..'
77+
},
78+
scripts: [
79+
'../angular.min.js',
80+
'../angular-resource.min.js',
81+
'../angular-route.min.js',
82+
'../angular-cookies.min.js',
83+
'../angular-sanitize.min.js',
84+
'../angular-touch.min.js',
85+
'../angular-animate.min.js',
86+
'components/marked-' + getVersion('marked', '../node_modules', 'package.json') + '/lib/marked.js',
87+
'js/angular-bootstrap/bootstrap.js',
88+
'js/angular-bootstrap/bootstrap-prettify.js',
89+
'js/angular-bootstrap/dropdown-toggle.js',
90+
'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js',
91+
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js',
92+
'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js',
93+
'js/versions-data.js',
94+
'js/pages-data.js',
95+
'js/docs.js'
96+
],
97+
stylesheets: [
98+
'components/bootstrap-' + getVersion('bootstrap') + '/dist/css/bootstrap.min.css',
99+
'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css',
100+
'css/prettify-theme.css',
101+
'css/docs.css',
102+
'css/animations.css'
103+
]
104+
},
105+
{
106+
name: 'jquery',
107+
examples: {
108+
commonFiles: {
109+
scripts: [
110+
'../../components/jquery-' + getVersion('jquery') + '/jquery.js',
111+
'../../../angular.js'
112+
]
113+
},
114+
dependencyPath: '../../..'
115+
},
73116
scripts: [
117+
'components/jquery-' + getVersion('jquery') + '/jquery.js',
74118
'../angular.min.js',
75119
'../angular-resource.min.js',
76120
'../angular-route.min.js',
@@ -99,6 +143,12 @@ module.exports = function(config) {
99143
},
100144
{
101145
name: 'production',
146+
examples: {
147+
commonFiles: {
148+
scripts: [ cdnUrl + '/angular.min.js' ]
149+
},
150+
dependencyPath: cdnUrl
151+
},
102152
scripts: [
103153
cdnUrl + '/angular.min.js',
104154
cdnUrl + '/angular-resource.min.js',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"canonical-path": "0.0.2",
5252
"winston": "~0.7.2",
5353
"dgeni": "~0.1.0",
54-
"dgeni-packages": "~0.1.0",
54+
"dgeni-packages": "^0.2.2",
5555
"gulp-jshint": "~1.4.2",
5656
"jshint-stylish": "~0.1.5"
5757
},

0 commit comments

Comments
 (0)