Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
e05a24b39b | |||
019cc4937c | |||
bd69ae1b4f | |||
4a40c37be2 | |||
f4ea7f0d0a | |||
50eff3fbd5 |
@ -1,5 +1,5 @@
|
||||
# gitzone standard
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
@ -38,19 +38,7 @@ snyk:
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
@ -60,6 +48,18 @@ testSTABLE:
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
@ -78,19 +78,11 @@ release:
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
image: docker:stable
|
||||
allow_failure: true
|
||||
services:
|
||||
- docker:stable-dind
|
||||
script:
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
--volume "$PWD":/code
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
||||
artifacts:
|
||||
paths: [codeclimate.json]
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
@ -106,7 +98,9 @@ trigger:
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
image: hosttoday/ht-docker-dbase:npmci
|
||||
services:
|
||||
- docker:stable-dind
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
|
693
package-lock.json
generated
693
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@gitzone/tsdoc",
|
||||
"version": "1.0.20",
|
||||
"version": "1.0.23",
|
||||
"private": false,
|
||||
"description": "a tool for better documentation",
|
||||
"main": "dist/index.js",
|
||||
@ -13,32 +13,32 @@
|
||||
"scripts": {
|
||||
"test": "(tstest test/) && (node ./cli.ts.js) && rm -rf public/",
|
||||
"build": "(tsbuild)",
|
||||
"buildMkdocs": "(cd mkdocs/originalrepo && docker rmi -f mkdocs && docker build -t mkdocs .)",
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.24",
|
||||
"@pushrocks/tapbundle": "^3.0.11",
|
||||
"@types/node": "^12.6.8",
|
||||
"tslint": "^5.18.0",
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.0.13",
|
||||
"@types/node": "^12.7.12",
|
||||
"tslint": "^5.20.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartcli": "^3.0.7",
|
||||
"@pushrocks/smartfile": "^7.0.4",
|
||||
"@pushrocks/smartfile": "^7.0.6",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartlog-destination-local": "^8.0.2",
|
||||
"@pushrocks/smartshell": "^2.0.23",
|
||||
"typedoc": "^0.14.2",
|
||||
"typescript": "^3.5.3"
|
||||
"@pushrocks/smartshell": "^2.0.25",
|
||||
"typedoc": "^0.15.0",
|
||||
"typescript": "^3.6.4"
|
||||
},
|
||||
"files": [
|
||||
"ts/*",
|
||||
"ts_web/*",
|
||||
"dist/*",
|
||||
"dist_web/*",
|
||||
"dist_ts_web/*",
|
||||
"assets/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
|
@ -21,6 +21,6 @@ a tool for better documentation
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
@ -31,7 +31,7 @@ export class MkDocs {
|
||||
|
||||
// Instance
|
||||
public typedocDirectory: string;
|
||||
constructor(dirPathArg) {
|
||||
constructor(dirPathArg: string) {
|
||||
this.typedocDirectory = dirPathArg;
|
||||
}
|
||||
|
||||
@ -45,18 +45,14 @@ export class MkDocs {
|
||||
await this.update();
|
||||
await this.smartshellInstance.exec(`rm -rf public/`);
|
||||
await this.smartshellInstance.exec(
|
||||
`docker run --rm -p 8000:8000 -v ${
|
||||
paths.cwd
|
||||
}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs build`
|
||||
`docker run --rm -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 -p 8000:8000 -v ${
|
||||
paths.cwd
|
||||
}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs`
|
||||
`docker run --rm -p 8000:8000 -v ${paths.cwd}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs`
|
||||
);
|
||||
}
|
||||
|
||||
|
62
ts/tsdoc.classes.tsdoc.ts
Normal file
62
ts/tsdoc.classes.tsdoc.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import * as plugins from './tsdoc.plugins';
|
||||
import { MkDocs } from './tsdoc.classes.mkdocs';
|
||||
import { TypeDoc } from './tsdoc.classes.typedoc';
|
||||
import { logger } from './tsdoc.logging';
|
||||
|
||||
export type TDirectoryType = 'mkdocs' | 'typedoc';
|
||||
|
||||
export class TsDoc {
|
||||
public smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
});
|
||||
|
||||
public mkdocs: MkDocs;
|
||||
public typedoc: TypeDoc;
|
||||
|
||||
public cwd: string;
|
||||
public cwdDirType: TDirectoryType;
|
||||
|
||||
constructor(cwdArg: string) {
|
||||
this.cwd = cwdArg;
|
||||
this.mkdocs = new MkDocs(this.cwd);
|
||||
this.typedoc = new TypeDoc(this.cwd);
|
||||
}
|
||||
|
||||
public async buildDirectory() {
|
||||
await this.detectDirectoryType();
|
||||
if (this.cwdDirType === 'mkdocs') {
|
||||
await this.mkdocs.compile();
|
||||
} else if (this.cwdDirType === 'typedoc') {
|
||||
await this.typedoc.compile();
|
||||
}
|
||||
await this.runAdditionalTasks();
|
||||
}
|
||||
|
||||
private async detectDirectoryType () {
|
||||
logger.log('warn', `Auto detecting environment!`);
|
||||
switch (true) {
|
||||
case await TypeDoc.isTypeDocDir(this.cwd):
|
||||
logger.log('ok', `Detected TypeDoc compliant directory at ${this.cwd}`);
|
||||
this.cwdDirType = 'typedoc';
|
||||
break;
|
||||
case await MkDocs.isMkDocsDir(this.cwd):
|
||||
logger.log('ok', `Detected MkDocs compliant directory at ${this.cwd}`);
|
||||
this.cwdDirType = 'mkdocs';
|
||||
break;
|
||||
default:
|
||||
logger.log('error', `Cannot determine docs format at ${this.cwd}`);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* runs additional tasks from package.json
|
||||
*/
|
||||
public async runAdditionalTasks() {
|
||||
const packageJson = plugins.smartfile.fs.toObjectSync(plugins.path.join(this.cwd, 'package.json'));
|
||||
if (packageJson.scripts.tsdoc) {
|
||||
await this.smartshellInstance.exec('npm run tsdoc');
|
||||
}
|
||||
}
|
||||
}
|
@ -4,36 +4,21 @@ import { logger } from './tsdoc.logging';
|
||||
|
||||
import { TypeDoc } from './tsdoc.classes.typedoc';
|
||||
import { MkDocs } from './tsdoc.classes.mkdocs';
|
||||
import { TsDoc } from './tsdoc.classes.tsdoc';
|
||||
|
||||
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.standardTask().subscribe(async argvArg => {
|
||||
const tsdoc = new TsDoc(paths.cwd);
|
||||
await tsdoc.buildDirectory();
|
||||
});
|
||||
|
||||
tsdocCli.addCommand('mkdocs').subscribe(async argvArg => {
|
||||
await MkDocs.handleCommand(argvArg);
|
||||
});
|
||||
|
||||
tsdocCli.standardTask().subscribe(async argvArg => {
|
||||
logger.log('warn', `Auto detecting environment!`);
|
||||
switch (true) {
|
||||
case await TypeDoc.isTypeDocDir(paths.cwd):
|
||||
logger.log('ok', `Detected TypeDoc compliant directory at ${paths.cwd}`);
|
||||
tsdocCli.trigger('typedoc');
|
||||
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}`);
|
||||
}
|
||||
});
|
||||
|
||||
tsdocCli.addCommand('test').subscribe(argvArg => {
|
||||
tsdocCli.trigger('typedoc');
|
||||
process.on('exit', async () => {
|
||||
await plugins.smartfile.fs.remove(paths.publicDir);
|
||||
});
|
||||
|
Reference in New Issue
Block a user