mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* upgrade and deprecate libs * upgrade flex layout * cleanup tslint libs * diable the test * exclude flaky e2e
49 lines
1.0 KiB
TypeScript
49 lines
1.0 KiB
TypeScript
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
|
|
import { graphql, buildSchema } from 'graphql';
|
|
|
|
import * as remark from 'remark';
|
|
import * as frontMatter from 'remark-frontmatter';
|
|
import { MDAST } from 'mdast';
|
|
import * as removePosInfo from 'unist-util-remove-position';
|
|
|
|
import * as MQ from './mqDefs';
|
|
|
|
const docFilePath = path.resolve('..', '..', 'docs', 'core', 'about.component.md');
|
|
const docSrc = fs.readFileSync(docFilePath, 'utf8');
|
|
|
|
let tree: MDAST.Root = remark()
|
|
.use(frontMatter, ['yaml'])
|
|
.parse(docSrc);
|
|
|
|
tree = removePosInfo(tree);
|
|
|
|
const schema = buildSchema(MQ.schema);
|
|
|
|
const root = {
|
|
document: () => new MQ.Root(tree)
|
|
};
|
|
|
|
const query = `
|
|
{
|
|
document {
|
|
metadata(key: "Status")
|
|
heading {
|
|
link {
|
|
text {
|
|
value
|
|
}
|
|
}
|
|
}
|
|
paragraph {
|
|
plaintext
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
graphql(schema, query, root).then((response) => {
|
|
console.log(JSON.stringify(response));
|
|
});
|