Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 83fbe75

Browse files
refact(api-builder): move into tools folder
1 parent ce29800 commit 83fbe75

File tree

88 files changed

+63
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+63
-2
lines changed

public/api-builder/angular.io-package/index.js renamed to tools/api-builder/angular.io-package/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ var path = require('canonical-path');
22
var Package = require('dgeni').Package;
33
var basePackage = require('../docs-package');
44

5+
var PROJECT_PATH = path.resolve(__dirname, "../../..");
6+
var PUBLIC_PATH = path.resolve(PROJECT_PATH, 'public');
7+
var DOCS_PATH = path.resolve(PUBLIC_PATH, 'docs');
8+
59
module.exports = new Package('angular.io', [basePackage])
610

711
.factory(require('./services/renderMarkdown'))
@@ -35,7 +39,7 @@ module.exports = new Package('angular.io', [basePackage])
3539
];
3640
readTypeScriptModules.hidePrivateMembers = true;
3741

38-
readFilesProcessor.basePath = path.resolve(__dirname, "../../docs");
42+
readFilesProcessor.basePath = DOCS_PATH;
3943
writeFilesProcessor.outputFolder = 'js/latest/api';
4044
})
4145

@@ -76,7 +80,7 @@ module.exports = new Package('angular.io', [basePackage])
7680

7781
computePathsProcessor.pathTemplates.push({
7882
docTypes: ['app-data'],
79-
pathTemplate: '../../../../resources/js/app-data',
83+
pathTemplate: path.resolve(PUBLIC_PATH, 'resources/js/app-data'),
8084
outputPathTemplate: '${path}.json'
8185
});
8286
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var Package = require('dgeni').Package;
2+
3+
module.exports = new Package('target', [])
4+
5+
.factory(require('./inline-tag-defs/target'))
6+
7+
.config(function(inlineTagProcessor, targetInlineTagDef) {
8+
inlineTagProcessor.inlineTagDefinitions.push(targetInlineTagDef);
9+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var _ = require('lodash');
2+
3+
/**
4+
* @dgService
5+
* @description
6+
* Process inline `target` block tags
7+
* (of the form `{@target environment1 environment2}...{@endtarget}`),
8+
* filtering out the blocks that do not match the containing document's
9+
* `targetEnvironments`.
10+
*/
11+
module.exports = function targetInlineTagDef() {
12+
return {
13+
name: 'target',
14+
end: 'endtarget',
15+
handler: function(doc, tagName, tagDescription) {
16+
var targets = tagDescription && tagDescription.tag.split(' ');
17+
if (!targets || !doc.targetEnvironments ||
18+
_.intersection(targets, doc.targetEnvironments).length) {
19+
return tagDescription.content;
20+
}
21+
return '';
22+
}
23+
};
24+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var targetFactory = require('./target');
2+
3+
describe('target inline-tag-def', function() {
4+
it('should filter out content that does not match the doc.targetEnvironments', function() {
5+
var doc, target, result;
6+
7+
doc = {
8+
targetEnvironments: ['js', 'es6']
9+
};
10+
11+
target = targetFactory();
12+
result = target.handler(doc, 'target', {
13+
tag: 'es6 ts',
14+
content: 'abc'
15+
});
16+
expect(result).toEqual('abc');
17+
18+
result = target.handler(doc, 'target', {
19+
tag: 'ts',
20+
content: 'xyz'
21+
});
22+
expect(result).toEqual('');
23+
});
24+
});

0 commit comments

Comments
 (0)