[ADF-2969] Moved doc tools to new tools folder (#3314)

* [ADF-2969] Moved doc tools to new tools folder

* [ADF-2969] Added files missing from schematic

* [ADF-2969] Added missing files to schematic
This commit is contained in:
Andy Stark
2018-05-11 14:01:19 +01:00
committed by Eugenio Romano
parent 9d0ccff189
commit 60644d9917
43 changed files with 843 additions and 23 deletions

View File

@@ -0,0 +1,2 @@
import { Rule } from '@angular-devkit/schematics';
export declare function docpage(options: any): Rule;

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
function docpage(options) {
let nameParts = options.name.match(/([a-zA-Z-0-9_\-]+)\.(component|directive|interface|model|pipe|service|widget)/);
if (!nameParts) {
throw new schematics_1.SchematicsException('Doc filename in wrong format. Must be "lib-name/file-name.type.md"');
}
let libFolder = options.path.match(/\/([a-zA-Z-0-9_\-]+)/)[1];
if (!libFolder.match(/content-services|core|process-services|insights/)) {
throw new schematics_1.SchematicsException(`Folder "${libFolder}" is not a valid ADF library (must be "content-services", "core", "process-services" or "insights".`);
}
let templateContext = {
"name": options.name,
"basename": nameParts[1],
"displayName": dekebabifyName(nameParts[1]),
"type": nameParts[2]
};
const templateSource = schematics_1.apply(schematics_1.url('./templates'), [
schematics_1.template(templateContext),
schematics_1.move("docs/" + libFolder)
]);
return schematics_1.chain([
schematics_1.mergeWith(templateSource)
]);
}
exports.docpage = docpage;
function dekebabifyName(name) {
var result = name.replace(/-/g, " ");
result = result.substr(0, 1).toUpperCase() + result.substr(1);
return result;
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,2DAGoC;AAIpC,iBAAwB,OAAY;IAClC,IAAI,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,+EAA+E,CAAC,CAAC;IAEpH,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,gCAAmB,CAAC,oEAAoE,CAAC,CAAC;KACrG;IAED,IAAI,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iDAAiD,CAAC,EAAE;QACvE,MAAM,IAAI,gCAAmB,CAAC,WAAW,SAAS,qGAAqG,CAAC,CAAC;KAC1J;IAED,IAAI,eAAe,GAAG;QAClB,MAAM,EAAE,OAAO,CAAC,IAAI;QACpB,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;QACxB,aAAa,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;KACvB,CAAA;IAED,MAAM,cAAc,GAAG,kBAAK,CAAC,gBAAG,CAAC,aAAa,CAAC,EAAE;QAC/C,qBAAQ,CAAC,eAAe,CAAC;QACzB,iBAAI,CAAC,OAAO,GAAG,SAAS,CAAC;KAC1B,CAAC,CAAC;IAEH,OAAO,kBAAK,CAAC;QACX,sBAAS,CAAC,cAAc,CAAC;KAC1B,CAAC,CAAC;AAEL,CAAC;AA7BD,0BA6BC;AAGD,wBAAwB,IAAY;IAClC,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACrC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC;AAChB,CAAC"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const testing_1 = require("@angular-devkit/schematics/testing");
const path = require("path");
const collectionPath = path.join(__dirname, '../collection.json');
describe('adf', () => {
it('works', () => {
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
const tree = runner.runSchematic('adf', {}, schematics_1.Tree.empty());
expect(tree.files).toEqual([]);
});
});
//# sourceMappingURL=index_spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,6BAA6B;AAG7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAGlE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;IACnB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACf,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAE1D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,34 @@
---
Added: v2.4.0
Status: Active
---
# <%= displayName + " " + type %>
One-line description for the index page goes here.
![Screenshot if required](../docassets/images/<%= basename + "." + type %>.png)
## Basic usage
Typescript and/or HTML usage sample goes here. Delete this section if you
don't need it.
## Class members
Don't add anything here. Use "npm run docbuild" from the "lib"
folder to generate property and method tables from the JSDocs.
## Details
Main text goes here.
### Subsection
Use level 3 subsections within the Details section to introduce
topics.
## See also
- [Delete this section](link1.md)
- [if you don't need it](link2.md)

View File

@@ -0,0 +1,9 @@
{
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"docpage": {
"description": "Creates a new documentation file for an ADF component.",
"factory": "./adf/index#docpage"
}
}
}