Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
d441f5b489 | |||
38f3ccb364 | |||
0c7f50e3cc | |||
7937cc8898 | |||
1a7f33d22b | |||
ea9dfa0e0d | |||
755babdd75 | |||
4fa345d20e |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@gitzone/tsdoc",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.11",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@gitzone/tsdoc",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.11",
|
||||
"private": false,
|
||||
"description": "a tool for better documentation",
|
||||
"main": "dist/index.js",
|
||||
|
@ -14,25 +14,54 @@ export class MkDocs {
|
||||
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 update() {
|
||||
await this.smartshellInstance.exec(
|
||||
`docker pull registry.gitlab.com/hosttoday/ht-docker-mkdocs`
|
||||
);
|
||||
}
|
||||
|
||||
public async compile () {
|
||||
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`);
|
||||
await this.smartshellInstance.exec(`gitzone commit`);
|
||||
await this.smartshellInstance.exec(
|
||||
`docker run --rm -p 8000:8000 -v ${
|
||||
paths.cwd
|
||||
}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs build`
|
||||
);
|
||||
}
|
||||
|
||||
public async serve () {
|
||||
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`);
|
||||
await this.smartshellInstance.exec(
|
||||
`docker run --rm -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`);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,9 @@ export class TypeDoc {
|
||||
this.typedocDirectory = dirPathArg;
|
||||
}
|
||||
|
||||
public async compile () {
|
||||
await this.smartshellInstance.exec(`typedoc --module "commonjs" --target "ES2016" --out public/ ts/`);
|
||||
public async compile() {
|
||||
await this.smartshellInstance.exec(
|
||||
`typedoc --module "commonjs" --target "ES2016" --out public/ ts/`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,13 @@ import { MkDocs } from './tsdoc.classes.mkdocs';
|
||||
export const run = async () => {
|
||||
const tsdocCli = new plugins.smartcli.Smartcli();
|
||||
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 => {
|
||||
logger.log('warn', `Auto detecting environment!`);
|
||||
@ -19,11 +22,10 @@ export const run = async () => {
|
||||
case await TypeDoc.isTypeDocDir(paths.cwd):
|
||||
logger.log('ok', `Detected TypeDoc compliant directory at ${paths.cwd}`);
|
||||
tsdocCli.trigger('typedoc');
|
||||
const typeDocInstance = new TypeDoc(paths.cwd);
|
||||
await typeDocInstance.compile();
|
||||
break;
|
||||
case await MkDocs.isMkDocsDir(paths.cwd):
|
||||
logger.log('ok', `Detected MkDocs compliant directory at ${paths.cwd}`);
|
||||
tsdocCli.trigger('mkdocs');
|
||||
break;
|
||||
default:
|
||||
logger.log('error', `Cannot determine docs format at ${paths.cwd}`);
|
||||
|
Reference in New Issue
Block a user