test(aio): enable linting of transforms/
and add rules for jasmine
This commit is contained in:
parent
a562c64ed6
commit
62f9738a9a
@ -9,8 +9,8 @@
|
|||||||
"ng": "yarn check-env && ng",
|
"ng": "yarn check-env && ng",
|
||||||
"start": "yarn check-env && ng serve",
|
"start": "yarn check-env && ng serve",
|
||||||
"build": "yarn check-env && yarn docs && ng build -prod -sm",
|
"build": "yarn check-env && yarn docs && ng build -prod -sm",
|
||||||
|
"lint": "yarn check-env && yarn docs-lint && ng lint",
|
||||||
"test": "yarn check-env && ng test --sourcemap=false",
|
"test": "yarn check-env && ng test --sourcemap=false",
|
||||||
"lint": "yarn check-env && ng lint",
|
|
||||||
"pree2e": "yarn ~~update-webdriver",
|
"pree2e": "yarn ~~update-webdriver",
|
||||||
"e2e": "yarn check-env && ng e2e --no-webdriver-update",
|
"e2e": "yarn check-env && ng e2e --no-webdriver-update",
|
||||||
"deploy-preview": "scripts/deploy-preview.sh",
|
"deploy-preview": "scripts/deploy-preview.sh",
|
||||||
@ -18,6 +18,7 @@
|
|||||||
"check-env": "node ../tools/check-environment.js",
|
"check-env": "node ../tools/check-environment.js",
|
||||||
"predocs": "rimraf src/content",
|
"predocs": "rimraf src/content",
|
||||||
"docs": "dgeni ./transforms/angular.io-package",
|
"docs": "dgeni ./transforms/angular.io-package",
|
||||||
|
"docs-lint": "eslint --ignore-path=\"transforms/.eslintignore\" transforms",
|
||||||
"docs-test": "node ../dist/tools/cjs-jasmine/index-tools ../../transforms/**/*.spec.js",
|
"docs-test": "node ../dist/tools/cjs-jasmine/index-tools ../../transforms/**/*.spec.js",
|
||||||
"~~update-webdriver": "webdriver-manager update --standalone false --gecko false",
|
"~~update-webdriver": "webdriver-manager update --standalone false --gecko false",
|
||||||
"pre~~deploy": "yarn build",
|
"pre~~deploy": "yarn build",
|
||||||
@ -53,6 +54,8 @@
|
|||||||
"dgeni": "^0.4.7",
|
"dgeni": "^0.4.7",
|
||||||
"dgeni-packages": "0.17.0",
|
"dgeni-packages": "0.17.0",
|
||||||
"entities": "^1.1.1",
|
"entities": "^1.1.1",
|
||||||
|
"eslint": "^3.19.0",
|
||||||
|
"eslint-plugin-jasmine": "^2.2.0",
|
||||||
"firebase-tools": "^3.2.1",
|
"firebase-tools": "^3.2.1",
|
||||||
"fs-extra": "^2.1.1",
|
"fs-extra": "^2.1.1",
|
||||||
"globby": "^6.1.0",
|
"globby": "^6.1.0",
|
||||||
|
1
aio/transforms/.eslintignore
Normal file
1
aio/transforms/.eslintignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
**/*.template.js
|
20
aio/transforms/.eslintrc.js
Normal file
20
aio/transforms/.eslintrc.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
module.exports = {
|
||||||
|
'env': {
|
||||||
|
'es6': true,
|
||||||
|
'jasmine': true,
|
||||||
|
'node': true
|
||||||
|
},
|
||||||
|
'extends': [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:jasmine/recommended'
|
||||||
|
],
|
||||||
|
'plugins': [
|
||||||
|
'jasmine'
|
||||||
|
],
|
||||||
|
'rules': {
|
||||||
|
'indent': ['error', 2],
|
||||||
|
'linebreak-style': ['error', 'unix'],
|
||||||
|
'quotes': ['error', 'single'],
|
||||||
|
'semi': ['error', 'always']
|
||||||
|
}
|
||||||
|
};
|
@ -29,8 +29,7 @@ const DOCS_OUTPUT_PATH = path.resolve(OUTPUT_PATH, 'docs');
|
|||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
new Package(
|
new Package(
|
||||||
'angular.io',
|
'angular.io', [
|
||||||
[
|
|
||||||
jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, examplesPackage,
|
jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, examplesPackage,
|
||||||
gitPackage, targetPackage, contentPackage, rhoPackage
|
gitPackage, targetPackage, contentPackage, rhoPackage
|
||||||
])
|
])
|
||||||
@ -59,7 +58,7 @@ module.exports =
|
|||||||
.factory(require('./readers/json'))
|
.factory(require('./readers/json'))
|
||||||
.factory(require('./services/copyFolder'))
|
.factory(require('./services/copyFolder'))
|
||||||
|
|
||||||
.config(function(checkAnchorLinksProcessor, log) {
|
.config(function(checkAnchorLinksProcessor) {
|
||||||
// TODO: re-enable
|
// TODO: re-enable
|
||||||
checkAnchorLinksProcessor.$enabled = false;
|
checkAnchorLinksProcessor.$enabled = false;
|
||||||
})
|
})
|
||||||
@ -257,7 +256,6 @@ module.exports =
|
|||||||
generateKeywordsProcessor) {
|
generateKeywordsProcessor) {
|
||||||
|
|
||||||
const API_SEGMENT = 'api';
|
const API_SEGMENT = 'api';
|
||||||
const GUIDE_SEGMENT = 'guide';
|
|
||||||
const APP_SEGMENT = 'app';
|
const APP_SEGMENT = 'app';
|
||||||
|
|
||||||
generateApiListDoc.outputFolder = API_SEGMENT;
|
generateApiListDoc.outputFolder = API_SEGMENT;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'a',
|
name: 'a',
|
||||||
description: 'A shorthand for creating heading anchors. Usage: `{@a some-id}`',
|
description: 'A shorthand for creating heading anchors. Usage: `{@a some-id}`',
|
||||||
handler: function(doc, tagName, tagDescription, docs) {
|
handler: function(doc, tagName, tagDescription) {
|
||||||
return '<a id="' + tagDescription.trim() + '"></a>';
|
return '<a id="' + tagDescription.trim() + '"></a>';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2,13 +2,12 @@ var testPackage = require('../../helpers/test-package');
|
|||||||
var Dgeni = require('dgeni');
|
var Dgeni = require('dgeni');
|
||||||
|
|
||||||
describe('addNotYetDocumentedProperty', function() {
|
describe('addNotYetDocumentedProperty', function() {
|
||||||
var dgeni, injector, processor, log;
|
var dgeni, injector, processor;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
dgeni = new Dgeni([testPackage('angular.io-package')]);
|
dgeni = new Dgeni([testPackage('angular.io-package')]);
|
||||||
injector = dgeni.configureInjector();
|
injector = dgeni.configureInjector();
|
||||||
processor = injector.get('addNotYetDocumentedProperty');
|
processor = injector.get('addNotYetDocumentedProperty');
|
||||||
log = injector.get('log');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should mark export docs with no description as "not yet documented"', function() {
|
it('should mark export docs with no description as "not yet documented"', function() {
|
||||||
@ -145,4 +144,4 @@ describe('addNotYetDocumentedProperty', function() {
|
|||||||
expect(c1.notYetDocumented).toBeTruthy();
|
expect(c1.notYetDocumented).toBeTruthy();
|
||||||
expect(c2.notYetDocumented).toBeTruthy();
|
expect(c2.notYetDocumented).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
var testPackage = require('../../helpers/test-package');
|
var testPackage = require('../../helpers/test-package');
|
||||||
var Dgeni = require('dgeni');
|
var Dgeni = require('dgeni');
|
||||||
var path = require('canonical-path');
|
|
||||||
|
|
||||||
describe('checkUnbalancedBackTicks', function() {
|
describe('checkUnbalancedBackTicks', function() {
|
||||||
var dgeni, injector, processor, log;
|
var dgeni, injector, processor, log;
|
||||||
@ -27,4 +26,4 @@ describe('checkUnbalancedBackTicks', function() {
|
|||||||
'checkUnbalancedBackTicks processor: unbalanced backticks found in rendered content - doc');
|
'checkUnbalancedBackTicks processor: unbalanced backticks found in rendered content - doc');
|
||||||
expect(docs[0].unbalancedBackTicks).toBe(true);
|
expect(docs[0].unbalancedBackTicks).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,7 @@ module.exports = function convertToJsonProcessor() {
|
|||||||
$runBefore: ['writeFilesProcessor'],
|
$runBefore: ['writeFilesProcessor'],
|
||||||
docTypes: [],
|
docTypes: [],
|
||||||
$process: function(docs) {
|
$process: function(docs) {
|
||||||
const docTypes = this.docTypes
|
const docTypes = this.docTypes;
|
||||||
docs.forEach((doc) => {
|
docs.forEach((doc) => {
|
||||||
if (docTypes.indexOf(doc.docType) !== -1) {
|
if (docTypes.indexOf(doc.docType) !== -1) {
|
||||||
const output = {
|
const output = {
|
||||||
@ -17,4 +17,4 @@ module.exports = function convertToJsonProcessor() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ const testPackage = require('../../helpers/test-package');
|
|||||||
const Dgeni = require('dgeni');
|
const Dgeni = require('dgeni');
|
||||||
const factory = require('./copyContentAssets');
|
const factory = require('./copyContentAssets');
|
||||||
|
|
||||||
fdescribe('extractDecoratedClasses processor', function() {
|
describe('extractDecoratedClasses processor', function() {
|
||||||
let dgeni, injector, processor;
|
let dgeni, injector, processor;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@ -24,4 +24,4 @@ fdescribe('extractDecoratedClasses processor', function() {
|
|||||||
expect(mockCopyFolder).toHaveBeenCalledWith('a/b/c', 'x/y/z');
|
expect(mockCopyFolder).toHaveBeenCalledWith('a/b/c', 'x/y/z');
|
||||||
expect(mockCopyFolder).toHaveBeenCalledWith('1/2/3', '4/5/6');
|
expect(mockCopyFolder).toHaveBeenCalledWith('1/2/3', '4/5/6');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -9,5 +9,5 @@ module.exports = function filterIgnoredDocs() {
|
|||||||
$process: function(docs) {
|
$process: function(docs) {
|
||||||
return docs.filter(doc => !this.ignore.some(regexp => regexp.test(doc.id)));
|
return docs.filter(doc => !this.ignore.some(regexp => regexp.test(doc.id)));
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
@ -13,7 +13,7 @@ describe('filterIgnoredDocs processor', () => {
|
|||||||
|
|
||||||
it('should run before the correct processor', () => {
|
it('should run before the correct processor', () => {
|
||||||
const processor = processorFactory();
|
const processor = processorFactory();
|
||||||
expect(processor.$runBefore).toEqual(['computing-paths'])
|
expect(processor.$runBefore).toEqual(['computing-paths']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should run after the correct processor', () => {
|
it('should run after the correct processor', () => {
|
||||||
@ -35,5 +35,5 @@ describe('filterIgnoredDocs processor', () => {
|
|||||||
{ id: 'public1'},
|
{ id: 'public1'},
|
||||||
{ id: 'public2'}
|
{ id: 'public2'}
|
||||||
]);
|
]);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
@ -3,5 +3,5 @@ module.exports = function filterMemberDocs() {
|
|||||||
$runAfter: ['extra-docs-added'], $runBefore: ['computing-paths'], $process: function(docs) {
|
$runAfter: ['extra-docs-added'], $runBefore: ['computing-paths'], $process: function(docs) {
|
||||||
return docs.filter(function(doc) { return doc.docType !== 'member'; });
|
return docs.filter(function(doc) { return doc.docType !== 'member'; });
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@ module.exports = function filterPrivateDocs() {
|
|||||||
$runAfter: ['extra-docs-added'],
|
$runAfter: ['extra-docs-added'],
|
||||||
$runBefore: ['computing-paths'],
|
$runBefore: ['computing-paths'],
|
||||||
$process: function(docs) {
|
$process: function(docs) {
|
||||||
return docs.filter(function(doc) { return doc.privateExport !== true });
|
return docs.filter(function(doc) { return doc.privateExport !== true; });
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
@ -13,7 +13,7 @@ describe('filterPrivateDocs processor', () => {
|
|||||||
|
|
||||||
it('should run before the correct processor', () => {
|
it('should run before the correct processor', () => {
|
||||||
const processor = processorFactory();
|
const processor = processorFactory();
|
||||||
expect(processor.$runBefore).toEqual(['computing-paths'])
|
expect(processor.$runBefore).toEqual(['computing-paths']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should run after the correct processor', () => {
|
it('should run after the correct processor', () => {
|
||||||
@ -36,5 +36,5 @@ describe('filterPrivateDocs processor', () => {
|
|||||||
{ name: 'public2'},
|
{ name: 'public2'},
|
||||||
{ id: 'other'}
|
{ id: 'other'}
|
||||||
]);
|
]);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
@ -13,7 +13,7 @@ describe('fixInternalDocumentLinks processor', () => {
|
|||||||
|
|
||||||
it('should run before the correct processor', () => {
|
it('should run before the correct processor', () => {
|
||||||
const processor = processorFactory();
|
const processor = processorFactory();
|
||||||
expect(processor.$runBefore).toEqual(['writeFilesProcessor'])
|
expect(processor.$runBefore).toEqual(['writeFilesProcessor']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should run after the correct processor', () => {
|
it('should run after the correct processor', () => {
|
||||||
@ -48,5 +48,5 @@ describe('fixInternalDocumentLinks processor', () => {
|
|||||||
`
|
`
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@ describe('generateApiListDoc processor', () => {
|
|||||||
const docs = [
|
const docs = [
|
||||||
{ name: 'ɵPrivate' },
|
{ name: 'ɵPrivate' },
|
||||||
{ name: 'public' }
|
{ name: 'public' }
|
||||||
]
|
];
|
||||||
processor.$process(docs);
|
processor.$process(docs);
|
||||||
|
|
||||||
expect(docs[0].privateExport).toBeTruthy();
|
expect(docs[0].privateExport).toBeTruthy();
|
||||||
|
@ -5,7 +5,7 @@ var _ = require('lodash');
|
|||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
module.exports = function matchUpDirectiveDecoratorsProcessor(aliasMap) {
|
module.exports = function matchUpDirectiveDecoratorsProcessor() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
$runAfter: ['ids-computed', 'paths-computed'],
|
$runAfter: ['ids-computed', 'paths-computed'],
|
||||||
@ -17,7 +17,7 @@ module.exports = function matchUpDirectiveDecoratorsProcessor(aliasMap) {
|
|||||||
if (doc.docType === 'directive') {
|
if (doc.docType === 'directive') {
|
||||||
doc.selector = doc.directiveOptions.selector;
|
doc.selector = doc.directiveOptions.selector;
|
||||||
|
|
||||||
for (decoratorName in decoratorMappings) {
|
for (let decoratorName in decoratorMappings) {
|
||||||
var propertyName = decoratorMappings[decoratorName];
|
var propertyName = decoratorMappings[decoratorName];
|
||||||
doc[propertyName] =
|
doc[propertyName] =
|
||||||
getDecoratorValues(doc.directiveOptions[propertyName], decoratorName, doc.members);
|
getDecoratorValues(doc.directiveOptions[propertyName], decoratorName, doc.members);
|
||||||
@ -29,7 +29,6 @@ module.exports = function matchUpDirectiveDecoratorsProcessor(aliasMap) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function getDecoratorValues(classDecoratorValues, memberDecoratorName, members) {
|
function getDecoratorValues(classDecoratorValues, memberDecoratorName, members) {
|
||||||
var optionMap = {};
|
|
||||||
var decoratorValues = {};
|
var decoratorValues = {};
|
||||||
|
|
||||||
// Parse the class decorator
|
// Parse the class decorator
|
||||||
@ -59,4 +58,4 @@ function getDecoratorValues(classDecoratorValues, memberDecoratorName, members)
|
|||||||
if (Object.keys(decoratorValues).length) {
|
if (Object.keys(decoratorValues).length) {
|
||||||
return decoratorValues;
|
return decoratorValues;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
var _ = require('lodash');
|
|
||||||
|
|
||||||
module.exports = function mergeDecoratorDocs(log) {
|
module.exports = function mergeDecoratorDocs(log) {
|
||||||
return {
|
return {
|
||||||
$runAfter: ['processing-docs'],
|
$runAfter: ['processing-docs'],
|
||||||
@ -80,4 +78,4 @@ function getMakeDecoratorCall(doc, type) {
|
|||||||
return initializer;
|
return initializer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ module.exports = function processNavigationMap(versionInfo, log) {
|
|||||||
|
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
log.error(`Navigation doc: ${navigationDoc.fileInfo.relativePath} contains invalid urls`);
|
log.error(`Navigation doc: ${navigationDoc.fileInfo.relativePath} contains invalid urls`);
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(errors);
|
console.log(errors);
|
||||||
// TODO(petebd): fail if there are errors: throw new Error('processNavigationMap failed');
|
// TODO(petebd): fail if there are errors: throw new Error('processNavigationMap failed');
|
||||||
}
|
}
|
||||||
@ -26,7 +27,7 @@ module.exports = function processNavigationMap(versionInfo, log) {
|
|||||||
// Add in the version data in a "secret" field to be extracted in the docs app
|
// Add in the version data in a "secret" field to be extracted in the docs app
|
||||||
navigationDoc.data['__versionInfo'] = versionInfo.currentVersion;
|
navigationDoc.data['__versionInfo'] = versionInfo.currentVersion;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function walk(node, map, path) {
|
function walk(node, map, path) {
|
||||||
@ -47,4 +48,4 @@ function walk(node, map, path) {
|
|||||||
|
|
||||||
function isRelative(url) {
|
function isRelative(url) {
|
||||||
return !/^(https?:)?\/\//.test(url);
|
return !/^(https?:)?\/\//.test(url);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module.exports = function(encodeCodeBlock) {
|
module.exports = function() {
|
||||||
// var MIXIN_PATTERN = /\S*\+\S*\(.*/;
|
// var MIXIN_PATTERN = /\S*\+\S*\(.*/;
|
||||||
return {
|
return {
|
||||||
name: 'indentForMarkdown',
|
name: 'indentForMarkdown',
|
||||||
@ -57,6 +57,6 @@ module.exports = function(encodeCodeBlock) {
|
|||||||
str += ' ';
|
str += ' ';
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
};
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
module.exports = function() {
|
module.exports = function() {
|
||||||
return {
|
return {
|
||||||
name: 'internal', transforms: function() { return true; }
|
name: 'internal', transforms: function() { return true; }
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,7 @@ module.exports = new Package('content', [jsdocPackage, linksPackage])
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Configure ids and paths
|
// Configure ids and paths
|
||||||
.config(function(computeIdsProcessor, computePathsProcessor) {
|
.config(function(computeIdsProcessor) {
|
||||||
|
|
||||||
computeIdsProcessor.idTemplates.push({
|
computeIdsProcessor.idTemplates.push({
|
||||||
docTypes: ['content'],
|
docTypes: ['content'],
|
||||||
@ -44,4 +44,4 @@ function requireFolder(folderPath) {
|
|||||||
return fs.readdirSync(absolutePath)
|
return fs.readdirSync(absolutePath)
|
||||||
.filter(p => !/[._]spec\.js$/.test(p)) // ignore spec files
|
.filter(p => !/[._]spec\.js$/.test(p)) // ignore spec files
|
||||||
.map(p => require(path.resolve(absolutePath, p)));
|
.map(p => require(path.resolve(absolutePath, p)));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
var path = require('canonical-path');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dgService
|
* @dgService
|
||||||
* @description
|
* @description
|
||||||
@ -23,4 +21,4 @@ module.exports = function contentFileReader() {
|
|||||||
return [{docType: 'content', content: fileInfo.content, startingLine: 1}];
|
return [{docType: 'content', content: fileInfo.content, startingLine: 1}];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
'globals': {'describe': true, 'beforeEach': true, 'it': true, 'expect': true},
|
|
||||||
'env': {'node': true},
|
|
||||||
'extends': 'eslint:recommended',
|
|
||||||
'rules': {
|
|
||||||
'indent': ['error', 2],
|
|
||||||
'linebreak-style': ['error', 'unix'],
|
|
||||||
'quotes': ['error', 'single'],
|
|
||||||
'semi': ['error', 'always']
|
|
||||||
}
|
|
||||||
};
|
|
@ -4,7 +4,7 @@
|
|||||||
* Later on we can extract the regions, via "shredding"; and we can also construct runnable examples
|
* Later on we can extract the regions, via "shredding"; and we can also construct runnable examples
|
||||||
* for passing to plunker and the like.
|
* for passing to plunker and the like.
|
||||||
*/
|
*/
|
||||||
module.exports = function exampleFileReader(log) {
|
module.exports = function exampleFileReader() {
|
||||||
return {
|
return {
|
||||||
name: 'exampleFileReader',
|
name: 'exampleFileReader',
|
||||||
getDocs: function(fileInfo) {
|
getDocs: function(fileInfo) {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
var path = require('canonical-path');
|
|
||||||
var fs = require('fs');
|
|
||||||
var entities = require('entities');
|
var entities = require('entities');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +26,7 @@ module.exports = function exampleInlineTagDef(parseArgString, createDocMessage,
|
|||||||
if (regionName === '\'\'') regionName = '';
|
if (regionName === '\'\'') regionName = '';
|
||||||
var title = tagArgs.title || (unnamedArgs.length > 2 ? unnamedArgs.slice(2).join(' ') : null);
|
var title = tagArgs.title || (unnamedArgs.length > 2 ? unnamedArgs.slice(2).join(' ') : null);
|
||||||
var linenums = tagArgs.linenums;
|
var linenums = tagArgs.linenums;
|
||||||
var stylePattern = tagArgs.stylePattern; // TODO: not yet implemented here
|
// var stylePattern = tagArgs.stylePattern; // TODO: not yet implemented here
|
||||||
|
|
||||||
const sourceCode = getExampleRegion(doc, relativePath, regionName);
|
const sourceCode = getExampleRegion(doc, relativePath, regionName);
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@ var fs = require('fs');
|
|||||||
* -titles="Hello app1, Hello app2" }
|
* -titles="Hello app1, Hello app2" }
|
||||||
* @kind function
|
* @kind function
|
||||||
*/
|
*/
|
||||||
module.exports = function exampleTabsInlineTagDef(
|
module.exports = function exampleTabsInlineTagDef(getLinkInfo, parseArgString) {
|
||||||
getLinkInfo, parseArgString, createDocMessage, log) {
|
|
||||||
return {
|
return {
|
||||||
name: 'exampleTabs',
|
name: 'exampleTabs',
|
||||||
description:
|
description:
|
||||||
@ -32,9 +31,10 @@ module.exports = function exampleTabsInlineTagDef(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: not yet implemented here
|
// TODO: not yet implemented here
|
||||||
var stylePatterns = tagArgs.stylePattern;
|
// var stylePatterns = tagArgs.stylePattern;
|
||||||
|
|
||||||
var mixinPaths = relativePaths.map(function(relativePath, ix) {
|
var mixinPaths = relativePaths.map(function(relativePath, ix) {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
var fragFileName = getApiFragmentFileName(relativePath, regions && regions[ix]);
|
var fragFileName = getApiFragmentFileName(relativePath, regions && regions[ix]);
|
||||||
if (!fs.existsSync(fragFileName)) {
|
if (!fs.existsSync(fragFileName)) {
|
||||||
// TODO: log.warn(createDocMessage('Invalid example (unable to locate fragment file: ' +
|
// TODO: log.warn(createDocMessage('Invalid example (unable to locate fragment file: ' +
|
||||||
@ -43,7 +43,7 @@ module.exports = function exampleTabsInlineTagDef(
|
|||||||
return path.join('_api', relativePath);
|
return path.join('_api', relativePath);
|
||||||
});
|
});
|
||||||
|
|
||||||
var comma = ', '
|
var comma = ', ';
|
||||||
var pathsArg = quote(mixinPaths.join(','));
|
var pathsArg = quote(mixinPaths.join(','));
|
||||||
var regionsArg = regions ? quote(regions.join(',')) : 'null';
|
var regionsArg = regions ? quote(regions.join(',')) : 'null';
|
||||||
var titlesArg = titles ? quote(titles) : 'null';
|
var titlesArg = titles ? quote(titles) : 'null';
|
||||||
|
@ -65,7 +65,7 @@ module.exports = function collectExamples(exampleMap, regionParser, log, createD
|
|||||||
|
|
||||||
function createRegionDoc(folder, relativePath, regionName, regionContents) {
|
function createRegionDoc(folder, relativePath, regionName, regionContents) {
|
||||||
const path = folder + '/' + relativePath;
|
const path = folder + '/' + relativePath;
|
||||||
const id = path + '#' + regionName
|
const id = path + '#' + regionName;
|
||||||
return {
|
return {
|
||||||
docType: 'example-region',
|
docType: 'example-region',
|
||||||
path: path,
|
path: path,
|
||||||
@ -74,4 +74,4 @@ function createRegionDoc(folder, relativePath, regionName, regionContents) {
|
|||||||
aliases: [id],
|
aliases: [id],
|
||||||
contents: regionContents
|
contents: regionContents
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ describe('collectExampleRegions processor', () => {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
|
||||||
regionParser = jasmine.createSpy('regionParser').and.callFake(function(contents, extension) {
|
regionParser = jasmine.createSpy('regionParser').and.callFake(function(contents, extension) {
|
||||||
return { contents: 'PARSED:' + contents, regions: {dummy: extension} }
|
return { contents: 'PARSED:' + contents, regions: {dummy: extension} };
|
||||||
});
|
});
|
||||||
|
|
||||||
const dgeni =
|
const dgeni =
|
||||||
@ -82,7 +82,7 @@ describe('collectExampleRegions processor', () => {
|
|||||||
createDoc('Other doc 2', 'other/b/c.js', 'content')
|
createDoc('Other doc 2', 'other/b/c.js', 'content')
|
||||||
];
|
];
|
||||||
|
|
||||||
const processedDocs = processor.$process(docs);
|
processor.$process(docs);
|
||||||
|
|
||||||
expect(regionParser).toHaveBeenCalledTimes(3);
|
expect(regionParser).toHaveBeenCalledTimes(3);
|
||||||
expect(regionParser).toHaveBeenCalledWith('Example A', 'js');
|
expect(regionParser).toHaveBeenCalledWith('Example A', 'js');
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
var testPackage = require('../../helpers/test-package');
|
var testPackage = require('../../helpers/test-package');
|
||||||
var Dgeni = require('dgeni');
|
var Dgeni = require('dgeni');
|
||||||
var path = require('path');
|
|
||||||
|
|
||||||
describe('renderExamples processor', () => {
|
describe('renderExamples processor', () => {
|
||||||
var injector, processor, exampleMap, regionParser, collectExamples, exampleMap;
|
var injector, processor, exampleMap, collectExamples;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
const dgeni = new Dgeni([testPackage('examples-package', true)]);
|
const dgeni = new Dgeni([testPackage('examples-package', true)]);
|
||||||
@ -24,7 +23,7 @@ describe('renderExamples processor', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should run before the correct processor', () => {
|
it('should run before the correct processor', () => {
|
||||||
expect(processor.$runBefore).toEqual(['writing-files'])
|
expect(processor.$runBefore).toEqual(['writing-files']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should run after the correct processor', () => {
|
it('should run after the correct processor', () => {
|
||||||
@ -90,4 +89,4 @@ describe('renderExamples processor', () => {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -47,12 +47,12 @@ module.exports = function parseArgString() {
|
|||||||
key = key.substr(1);
|
key = key.substr(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unnammedArgs.push(arg)
|
unnammedArgs.push(arg);
|
||||||
key = null;
|
key = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (match !== null);
|
} while (match !== null);
|
||||||
return args;
|
return args;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
@ -3,7 +3,6 @@ const html = require('./region-matchers/html');
|
|||||||
const inlineC = require('./region-matchers/inline-c');
|
const inlineC = require('./region-matchers/inline-c');
|
||||||
const inlineCOnly = require('./region-matchers/inline-c-only');
|
const inlineCOnly = require('./region-matchers/inline-c-only');
|
||||||
const inlineHash = require('./region-matchers/inline-hash');
|
const inlineHash = require('./region-matchers/inline-hash');
|
||||||
const NO_NAME_REGION = '';
|
|
||||||
const DEFAULT_PLASTER = '. . .';
|
const DEFAULT_PLASTER = '. . .';
|
||||||
const {mapObject} = require('../utils');
|
const {mapObject} = require('../utils');
|
||||||
|
|
||||||
@ -140,4 +139,4 @@ function RegionParserError(message, index) {
|
|||||||
this.stack = (new Error()).stack;
|
this.stack = (new Error()).stack;
|
||||||
}
|
}
|
||||||
RegionParserError.prototype = Object.create(Error.prototype);
|
RegionParserError.prototype = Object.create(Error.prototype);
|
||||||
RegionParserError.prototype.constructor = RegionParserError;
|
RegionParserError.prototype.constructor = RegionParserError;
|
||||||
|
@ -172,7 +172,7 @@ describe('regionParser service', () => {
|
|||||||
expect(output.regions['A']).toEqual(t('abc', 'xyz'));
|
expect(output.regions['A']).toEqual(t('abc', 'xyz'));
|
||||||
expect(output.regions['B']).toEqual(t('abc'));
|
expect(output.regions['B']).toEqual(t('abc'));
|
||||||
expect(output.regions['C']).toEqual(t('xyz'));
|
expect(output.regions['C']).toEqual(t('xyz'));
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function t() {
|
function t() {
|
||||||
|
@ -17,7 +17,7 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
parseAttributes(str) {
|
parseAttributes(str) {
|
||||||
const attrMap = {};
|
const attrMap = {};
|
||||||
let index = 0, key, value;
|
let index = 0;
|
||||||
|
|
||||||
skipSpace();
|
skipSpace();
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ module.exports = {
|
|||||||
|
|
||||||
function tryQuote() {
|
function tryQuote() {
|
||||||
const quote = str[index];
|
const quote = str[index];
|
||||||
if (['"', "'"].indexOf(quote) !== -1) {
|
if (['"', '\''].indexOf(quote) !== -1) {
|
||||||
index++;
|
index++;
|
||||||
return quote;
|
return quote;
|
||||||
}
|
}
|
||||||
@ -90,4 +90,4 @@ module.exports = {
|
|||||||
|
|
||||||
return attrMap;
|
return attrMap;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -71,6 +71,6 @@ describe('utils', () => {
|
|||||||
expect(() => parseAttributes('a="" b="two')).toThrowError(
|
expect(() => parseAttributes('a="" b="two')).toThrowError(
|
||||||
'Unterminated quoted attribute value in `a="" b="two`. Starting at 8. Expected a " but got "end of string".'
|
'Unterminated quoted attribute value in `a="" b="two`. Starting at 8. Expected a " but got "end of string".'
|
||||||
);
|
);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@ module.exports = function testPackage(packageName, mockTemplateEngine) {
|
|||||||
|
|
||||||
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
|
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
|
||||||
const PROJECT_ROOT = path.resolve(__dirname, '../../..');
|
const PROJECT_ROOT = path.resolve(__dirname, '../../..');
|
||||||
pkg.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); })
|
pkg.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); });
|
||||||
|
|
||||||
|
|
||||||
if (mockTemplateEngine) {
|
if (mockTemplateEngine) {
|
||||||
|
@ -4,7 +4,7 @@ var _ = require('lodash');
|
|||||||
* @dgService getDocFromAlias
|
* @dgService getDocFromAlias
|
||||||
* @description Get an array of docs that match this alias, relative to the originating doc.
|
* @description Get an array of docs that match this alias, relative to the originating doc.
|
||||||
*/
|
*/
|
||||||
module.exports = function getDocFromAlias(aliasMap, log) {
|
module.exports = function getDocFromAlias(aliasMap) {
|
||||||
|
|
||||||
return function getDocFromAlias(alias, originatingDoc) {
|
return function getDocFromAlias(alias, originatingDoc) {
|
||||||
var docs = aliasMap.getDocs(alias);
|
var docs = aliasMap.getDocs(alias);
|
||||||
@ -28,4 +28,4 @@ module.exports = function getDocFromAlias(aliasMap, log) {
|
|||||||
|
|
||||||
return docs;
|
return docs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -73,6 +73,6 @@ module.exports = function getLinkInfo(getDocFromAlias, encodeCodeBlock, log) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return linkInfo;
|
return linkInfo;
|
||||||
};
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ module.exports = function renderMarkdown() {
|
|||||||
|
|
||||||
walk.startFrom(endIdx + 2);
|
walk.startFrom(endIdx + 2);
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
|
|
||||||
renderMarkdownImpl.unformattedTags = [];
|
renderMarkdownImpl.unformattedTags = [];
|
||||||
|
|
||||||
@ -64,5 +64,5 @@ module.exports = function renderMarkdown() {
|
|||||||
function renderMarkdownImpl(content) {
|
function renderMarkdownImpl(content) {
|
||||||
const rawHtml = new rho.BlockCompiler(rho.options).toHtml(content);
|
const rawHtml = new rho.BlockCompiler(rho.options).toHtml(content);
|
||||||
return prettyPrint(rawHtml, { indent_size: 2, max_char: 0, unformatted: [...defaultUnformattedTags, ...renderMarkdownImpl.unformattedTags]});
|
return prettyPrint(rawHtml, { indent_size: 2, max_char: 0, unformatted: [...defaultUnformattedTags, ...renderMarkdownImpl.unformattedTags]});
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ module.exports = function targetEnvironments() {
|
|||||||
|
|
||||||
var updateActiveCount = function() {
|
var updateActiveCount = function() {
|
||||||
_activeCount = 0;
|
_activeCount = 0;
|
||||||
for (target in _targets) {
|
for (let target in _targets) {
|
||||||
if (_targets[target]) _activeCount++;
|
if (_targets[target]) _activeCount++;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -48,4 +48,4 @@ module.exports = function targetEnvironments() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1963,6 +1963,10 @@ escope@^3.6.0:
|
|||||||
esrecurse "^4.1.0"
|
esrecurse "^4.1.0"
|
||||||
estraverse "^4.1.1"
|
estraverse "^4.1.1"
|
||||||
|
|
||||||
|
eslint-plugin-jasmine@^2.2.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/eslint-plugin-jasmine/-/eslint-plugin-jasmine-2.2.0.tgz#7135879383c39a667c721d302b9f20f0389543de"
|
||||||
|
|
||||||
eslint@^3.19.0:
|
eslint@^3.19.0:
|
||||||
version "3.19.0"
|
version "3.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"
|
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user