Compare commits

..

10 Commits

Author SHA1 Message Date
0c7f50e3cc 1.0.10 2019-05-15 21:40:19 +02:00
7937cc8898 fix(core): update 2019-05-15 21:40:18 +02:00
1a7f33d22b 1.0.9 2019-05-15 21:25:02 +02:00
ea9dfa0e0d fix(core): update 2019-05-15 21:25:02 +02:00
755babdd75 1.0.8 2019-05-15 21:23:45 +02:00
4fa345d20e fix(core): update 2019-05-15 21:23:45 +02:00
b8678cd808 1.0.7 2019-05-15 21:10:19 +02:00
4f25981183 fix(core): update 2019-05-15 21:10:19 +02:00
81a5f87eb7 1.0.6 2019-05-15 21:06:08 +02:00
dd3c4860a0 fix(core): update 2019-05-15 21:06:07 +02:00
5 changed files with 72 additions and 11 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tsdoc", "name": "@gitzone/tsdoc",
"version": "1.0.5", "version": "1.0.10",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tsdoc", "name": "@gitzone/tsdoc",
"version": "1.0.5", "version": "1.0.10",
"private": false, "private": false,
"description": "a tool for better documentation", "description": "a tool for better documentation",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -1,10 +1,67 @@
import * as plugins from './tsdoc.plugins'; import * as plugins from './tsdoc.plugins';
import * as paths from './tsdoc.paths';
export class MkDocs { export class MkDocs {
public smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
pathDirectories: [paths.binDir]
});
public static async isMkDocsDir(dirPathArg: string): Promise<boolean> { public static async isMkDocsDir(dirPathArg: string): Promise<boolean> {
const result = await plugins.smartfile.fs.fileExists( const result = await plugins.smartfile.fs.fileExists(
plugins.path.join(dirPathArg, 'mkdocs.yml') plugins.path.join(dirPathArg, 'mkdocs.yml')
); );
return !result; return result;
}
public static async handleCommand(argvArg) {
const mkdocsInstance = new MkDocs(paths.cwd);
switch (true) {
case argvArg.serve:
await mkdocsInstance.serve();
break;
case argvArg.publish:
await mkdocsInstance.publish();
break;
default:
await mkdocsInstance.compile();
break;
}
}
// Instance
public typedocDirectory: string;
constructor(dirPathArg) {
this.typedocDirectory = dirPathArg;
}
public async update() {
await this.smartshellInstance.exec(
`docker pull registry.gitlab.com/hosttoday/ht-docker-mkdocs`
);
}
public async compile() {
await this.update();
await this.smartshellInstance.exec(`rm -rf public/`);
await this.smartshellInstance.exec(
`docker run --rm -it -p 8000:8000 -v ${
paths.cwd
}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs build`
);
}
public async serve() {
await this.update();
await this.smartshellInstance.exec(
`docker run --rm -it -p 8000:8000 -v ${
paths.cwd
}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs`
);
}
public async publish() {
await this.compile();
await this.smartshellInstance.exec(`gitzone commit`);
} }
} }

View File

@ -21,7 +21,9 @@ export class TypeDoc {
this.typedocDirectory = dirPathArg; this.typedocDirectory = dirPathArg;
} }
public async compile () { public async compile() {
await this.smartshellInstance.exec(`typedoc --module "commonjs" --target "ES2016" --out public/ ts/`); await this.smartshellInstance.exec(
`typedoc --module "commonjs" --target "ES2016" --out public/ ts/`
);
} }
} }

View File

@ -8,10 +8,13 @@ import { MkDocs } from './tsdoc.classes.mkdocs';
export const run = async () => { export const run = async () => {
const tsdocCli = new plugins.smartcli.Smartcli(); const tsdocCli = new plugins.smartcli.Smartcli();
tsdocCli.addCommand('typedoc').subscribe(async argvArg => { tsdocCli.addCommand('typedoc').subscribe(async argvArg => {
const typeDocInstance = new TypeDoc(paths.cwd);
await typeDocInstance.compile();
}); });
tsdocCli.addCommand('mkdocs').subscribe(async argvArg => {}); tsdocCli.addCommand('mkdocs').subscribe(async argvArg => {
await MkDocs.handleCommand(argvArg);
});
tsdocCli.standardTask().subscribe(async argvArg => { tsdocCli.standardTask().subscribe(async argvArg => {
logger.log('warn', `Auto detecting environment!`); logger.log('warn', `Auto detecting environment!`);
@ -19,11 +22,10 @@ export const run = async () => {
case await TypeDoc.isTypeDocDir(paths.cwd): case await TypeDoc.isTypeDocDir(paths.cwd):
logger.log('ok', `Detected TypeDoc compliant directory at ${paths.cwd}`); logger.log('ok', `Detected TypeDoc compliant directory at ${paths.cwd}`);
tsdocCli.trigger('typedoc'); tsdocCli.trigger('typedoc');
const typeDocInstance = new TypeDoc(paths.cwd);
await typeDocInstance.compile();
break; break;
case await MkDocs.isMkDocsDir(paths.cwd): case await MkDocs.isMkDocsDir(paths.cwd):
logger.log('ok', `Detected MkDocs compliant directory at ${paths.cwd}`); logger.log('ok', `Detected MkDocs compliant directory at ${paths.cwd}`);
tsdocCli.trigger('mkdocs');
break; break;
default: default:
logger.log('error', `Cannot determine docs format at ${paths.cwd}`); logger.log('error', `Cannot determine docs format at ${paths.cwd}`);