fix(core): update
This commit is contained in:
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartdocumentation',
|
||||
version: '1.0.2',
|
||||
description: 'a tool for mapping git directories to documentation sites'
|
||||
}
|
3
ts/index.ts
Normal file
3
ts/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import * as plugins from './smartdocumentation.plugins.js';
|
||||
|
||||
export let demoExport = 'Hi there! :) This is an exported string';
|
48
ts/smartdocumentation.classes.documentationdirectory.ts
Normal file
48
ts/smartdocumentation.classes.documentationdirectory.ts
Normal file
@ -0,0 +1,48 @@
|
||||
import * as plugins from './smartdocumentation.plugins.js';
|
||||
|
||||
export interface IDocumentationDirectoryConstructorOptions {
|
||||
pathArg: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* a documentation directory maps to a directory with markdown documents
|
||||
*/
|
||||
export class DocumentationDirectory {
|
||||
public options: IDocumentationDirectoryConstructorOptions;
|
||||
public smartmarkdownInstance = new plugins.smartmarkdown.SmartMarkdown();
|
||||
public articles: plugins.tsclass.content.IArticle[];
|
||||
|
||||
constructor(optionsArg: IDocumentationDirectoryConstructorOptions) {
|
||||
this.options = optionsArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* reads a directory
|
||||
*/
|
||||
public async readDirectory() {
|
||||
const fileTreeComplete = await plugins.smartfile.fs.fileTreeToObject(
|
||||
this.options.pathArg,
|
||||
'**/*'
|
||||
);
|
||||
const articles: plugins.tsclass.content.IArticle[] = [];
|
||||
for (const markdownFile of fileTreeComplete.filter(
|
||||
(fileArg) => fileArg.parsedPath.ext === '.md'
|
||||
)) {
|
||||
const parsedMarkdown = await this.smartmarkdownInstance.getMdParsedResultFromMarkdown(markdownFile.contents.toString())
|
||||
articles.push({
|
||||
title: parsedMarkdown.title,
|
||||
author: parsedMarkdown.frontmatterData.author,
|
||||
content: parsedMarkdown.originalString,
|
||||
timestamp: Date.now(),
|
||||
tags: [
|
||||
`path:${markdownFile.path}`,
|
||||
],
|
||||
});
|
||||
}
|
||||
this.articles = articles;
|
||||
}
|
||||
|
||||
sendAsDocumentationSet(nameArg: string, targetArg: string) {
|
||||
|
||||
}
|
||||
}
|
9
ts/smartdocumentation.plugins.ts
Normal file
9
ts/smartdocumentation.plugins.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartmarkdown from '@pushrocks/smartmarkdown';
|
||||
|
||||
export {
|
||||
tsclass,
|
||||
smartfile,
|
||||
smartmarkdown,
|
||||
}
|
Reference in New Issue
Block a user